From 6a345d2206cc59fdb3ea6bc14063cd6ebb7ee3db Mon Sep 17 00:00:00 2001 From: Randall Winkhart Date: Thu, 14 Mar 2024 17:01:12 -0400 Subject: [PATCH] Switch Windows to use ":" instead of "-" for options flags because PowerShell is horrible and interprets "-" as a named parameter --- src/cli/entryReader.go | 2 +- src/cli/printInfo.go | 56 ++++++++++++++++++++-------------------- src/cli/printInfoUNIX.go | 5 ++++ src/cli/printInfoWIN.go | 5 ++++ 4 files changed, 39 insertions(+), 29 deletions(-) create mode 100644 src/cli/printInfoUNIX.go create mode 100644 src/cli/printInfoWIN.go diff --git a/src/cli/entryReader.go b/src/cli/entryReader.go index 3ba9de9..30e8e39 100644 --- a/src/cli/entryReader.go +++ b/src/cli/entryReader.go @@ -34,7 +34,7 @@ func EntryReader(decryptedEntry []string, hidePassword bool, sync bool) { if !hidePassword { fmt.Print(ansiDirectoryHeader + "Password:" + offline.AnsiReset + "\n" + ansiShownPassword + decryptedEntry[0] + offline.AnsiReset + "\n\n") } else { - fmt.Print(ansiDirectoryHeader + "Password:" + offline.AnsiReset + "\n" + ansiEmptyDirectoryWarning + "End command in \"show\" or \"-s\" to view" + offline.AnsiReset + "\n\n") + fmt.Print(ansiDirectoryHeader + "Password:" + offline.AnsiReset + "\n" + ansiEmptyDirectoryWarning + "End command in \"show\" or \"" + OptionFlag + "s\" to view" + offline.AnsiReset + "\n\n") } } case 2: diff --git a/src/cli/printInfo.go b/src/cli/printInfo.go index 5ec7863..8f43701 100644 --- a/src/cli/printInfo.go +++ b/src/cli/printInfo.go @@ -20,8 +20,8 @@ This program comes with absolutely no warranty; type "mutn version" for details. ` + ansiBold + "Usage:" + offline.AnsiReset + ` mutn [/ [argument] [option]] | [argument] ` + ansiBold + "Arguments:" + offline.AnsiReset + ` - help/--help/-h Bring up this menu - version/-v Display version and license information + help|` + OptionFlag + `h Bring up this menu + version|` + OptionFlag + `v Display version and license information init Set up MUTN (generates libmutton.ini) tweak Change configuration options add Add an entry @@ -33,22 +33,22 @@ This program comes with absolutely no warranty; type "mutn version" for details. ` + ansiBold + "Options:" + offline.AnsiReset + ` add: - password/-p Add a password entry - note/-n Add a note entry - folder/-f Add a new folder for entries + password|` + OptionFlag + `p Add a password entry + note|` + OptionFlag + `n Add a note entry + folder|` + OptionFlag + `f Add a new folder for entries edit: - rename/-r Rename or relocate an entry - username/-u Change the username of an entry - password/-p Change the password of an entry - url/-l Change the url attached to an entry - note/-n Change the note attached to an entry + rename|` + OptionFlag + `r Rename or relocate an entry + username|` + OptionFlag + `u Change the username of an entry + password|` + OptionFlag + `p Change the password of an entry + url|` + OptionFlag + `l Change the url attached to an entry + note|` + OptionFlag + `n Change the note attached to an entry copy: - username/-u Copy the username of an entry to your clipboard - password/-p Copy the password of an entry to your clipboard - url/-l Copy the url of an entry to your clipboard - note/-n Copy the note of an entry to your clipboard + username|` + OptionFlag + `u Copy the username of an entry to your clipboard + password|` + OptionFlag + `p Copy the password of an entry to your clipboard + url|` + OptionFlag + `l Copy the url of an entry to your clipboard + note|` + OptionFlag + `n Copy the note of an entry to your clipboard gen: - update/-u Generate a password for an existing entry + update|` + OptionFlag + `u Generate a password for an existing entry ` + ansiBold + "Tip 1:" + offline.AnsiReset + ` You can quickly read an entry with "mutn /" ` + ansiBold + "Tip 2:" + offline.AnsiReset + ` Type "mutn" (no arguments/options) to view a list of saved entries @@ -61,9 +61,9 @@ func HelpAdd() { ` + ansiBold + "Options:" + offline.AnsiReset + ` add: - password/-p Add a password entry - note/-n Add a note entry - folder/-f Add a new folder for entries` + "\n\n") + password|` + OptionFlag + `p Add a password entry + note|` + OptionFlag + `n Add a note entry + folder|` + OptionFlag + `f Add a new folder for entries` + "\n\n") os.Exit(0) } @@ -72,11 +72,11 @@ func HelpEdit() { ` + ansiBold + "Options:" + offline.AnsiReset + ` edit: - rename/-r Rename or relocate an entry - username/-u Change the username of an entry - password/-p Change the password of an entry - url/-l Change the url attached to an entry - note/-n Change the note attached to an entry` + "\n\n") + rename|` + OptionFlag + `r Rename or relocate an entry + username|` + OptionFlag + `u Change the username of an entry + password|` + OptionFlag + `p Change the password of an entry + url|` + OptionFlag + `l Change the url attached to an entry + note|` + OptionFlag + `n Change the note attached to an entry` + "\n\n") os.Exit(0) } @@ -85,10 +85,10 @@ func HelpCopy() { ` + ansiBold + "Options:" + offline.AnsiReset + ` copy: - username/-u Copy the username in an entry to your clipboard - password/-p Copy the password in an entry to your clipboard - url/-l Copy the url in an entry to your clipboard - note/-n Copy the first note line in an entry to your clipboard` + "\n\n") + username|` + OptionFlag + `u Copy the username in an entry to your clipboard + password|` + OptionFlag + `p Copy the password in an entry to your clipboard + url|` + OptionFlag + `l Copy the url in an entry to your clipboard + note|` + OptionFlag + `n Copy the first note line in an entry to your clipboard` + "\n\n") os.Exit(0) } @@ -97,7 +97,7 @@ func HelpGen() { ` + ansiBold + "Options:" + offline.AnsiReset + ` gen: - update/-u Generate a password for an existing entry + update|` + OptionFlag + `u Generate a password for an existing entry ` + ansiBold + "Tip:" + offline.AnsiReset + " If no options are provided, a new password entry is generated\n\n") os.Exit(0) diff --git a/src/cli/printInfoUNIX.go b/src/cli/printInfoUNIX.go new file mode 100644 index 0000000..6b57567 --- /dev/null +++ b/src/cli/printInfoUNIX.go @@ -0,0 +1,5 @@ +//go:build !windows + +package cli + +const OptionFlag = "-" diff --git a/src/cli/printInfoWIN.go b/src/cli/printInfoWIN.go new file mode 100644 index 0000000..c10e3a7 --- /dev/null +++ b/src/cli/printInfoWIN.go @@ -0,0 +1,5 @@ +//go:build windows + +package cli + +const OptionFlag = ":"