lockbox

password manager
Log | Files | Refs | README | LICENSE

commit 7d244f150cfba3306788cf66857b24cd565b534c
parent 503bcdee60d0cc30176893674c4a78219a59870e
Author: Sean Enck <sean@ttypty.com>
Date:   Fri,  3 Mar 2023 18:32:06 -0500

common confirm method

Diffstat:
Ainternal/commands/core.go | 7+++++++
Minternal/commands/insert.go | 2+-
Minternal/commands/move.go | 2+-
Minternal/commands/remove.go | 2+-
4 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/internal/commands/core.go b/internal/commands/core.go @@ -0,0 +1,7 @@ +// Package commands common objects +package commands + +type ( + // Confirm user inputs + Confirm func(string) bool +) diff --git a/internal/commands/insert.go b/internal/commands/insert.go @@ -19,7 +19,7 @@ func insertError(message string, err error) error { // Insert will insert new entries // NOTE: almost entirely tested via regresssion due to complexities around piping/inputs -func Insert(w io.Writer, t *backend.Transaction, args []string, confirm func(string) bool) error { +func Insert(w io.Writer, t *backend.Transaction, args []string, confirm Confirm) error { multi := false isTOTP := false idx := 0 diff --git a/internal/commands/move.go b/internal/commands/move.go @@ -7,7 +7,7 @@ import ( ) // Move is the CLI command to move entries -func Move(t *backend.Transaction, args []string, confirm func(string) bool) error { +func Move(t *backend.Transaction, args []string, confirm Confirm) error { if len(args) != 2 { return errors.New("src/dst required for move") } diff --git a/internal/commands/remove.go b/internal/commands/remove.go @@ -10,7 +10,7 @@ import ( ) // Remove will remove an entry -func Remove(w io.Writer, t *backend.Transaction, args []string, confirm func(string) bool) error { +func Remove(w io.Writer, t *backend.Transaction, args []string, confirm Confirm) error { if len(args) != 1 { return errors.New("remove requires an entry") }