lockbox

password manager
Log | Files | Refs | README | LICENSE

commit 7364430a241411ff44467bd90c869ae86a2639b3
parent a4f721843a008d8c79e3ef3e178eec416451c332
Author: Sean Enck <sean@ttypty.com>
Date:   Wed,  1 Mar 2023 18:51:12 -0500

deps update

Diffstat:
Mcmd/main.go | 2+-
Mcmd/vers.txt | 4++--
Minternal/util/core.go | 21+++++++++------------
3 files changed, 12 insertions(+), 15 deletions(-)

diff --git a/cmd/main.go b/cmd/main.go @@ -362,7 +362,7 @@ func clearClipboard(args []string) error { func confirm(prompt string) bool { yesNo, err := inputs.ConfirmYesNoPrompt(prompt) if err != nil { - util.Die("failed to read stdin for confirmation", err) + util.Dief("failed to read stdin for confirmation: %v", err) } return yesNo } diff --git a/cmd/vers.txt b/cmd/vers.txt @@ -1 +1 @@ -v23.02.00 -\ No newline at end of file +v23.03.00 +\ No newline at end of file diff --git a/internal/util/core.go b/internal/util/core.go @@ -20,21 +20,18 @@ func PathExists(file string) bool { // Fatal will call Die but without a message func Fatal(err error) { - Die("", err) + Die(err) +} + +// Dief will for a message and die +func Dief(format string, a ...any) { + Die(fmt.Sprintf(format, a...)) } // Die will write to stderr and exit (1) -func Die(message string, err error) { - msg := message - if err != nil { - if msg == "" { - msg = err.Error() - } else { - msg = fmt.Sprintf("%s (%v)", msg, err) - } - } - if msg != "" { - fmt.Fprintf(os.Stderr, "%s\n", msg) +func Die(a any) { + if a != nil { + fmt.Fprintf(os.Stderr, "%v\n", a) } os.Exit(1) }