mirror of
https://github.com/rwinkhart/MUTN.git
synced 2026-08-28 04:46:41 -04:00
Switch Windows to use ":" instead of "-" for options flags because PowerShell is horrible and interprets "-" as a named parameter
This commit is contained in:
@@ -45,6 +45,6 @@ function mutn {
|
|||||||
[ArgumentCompleter({ MUTNArgumentCompleter @args })]
|
[ArgumentCompleter({ MUTNArgumentCompleter @args })]
|
||||||
[string]$option
|
[string]$option
|
||||||
)
|
)
|
||||||
#Invoke-Expression -Command ('/usr/local/bin/mutn ' + ($entry -replace ' ', '` '), $argument, $option).Trim() # UNIX testing
|
#Invoke-Expression -Command ('/usr/local/bin/mutn ' + ($entry -replace ' ', '` '), $argument, ($option -replace ':', '-')).Trim() # UNIX testing
|
||||||
Invoke-Expression -Command ('mutn.exe ' + ($entry -replace ' ', '` '), $argument, $option).Trim()
|
Invoke-Expression -Command ('mutn.exe ' + ($entry -replace ' ', '` '), $argument, $option).Trim()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ func main() {
|
|||||||
} else if argsCount == 3 {
|
} else if argsCount == 3 {
|
||||||
|
|
||||||
switch args[2] {
|
switch args[2] {
|
||||||
case "show", "-s":
|
case "show", cli.OptionFlag + "s":
|
||||||
cli.EntryReaderShortcut(targetLocation, false, false)
|
cli.EntryReaderShortcut(targetLocation, false, false)
|
||||||
case "shear":
|
case "shear":
|
||||||
offline.Shear(targetLocation)
|
offline.Shear(targetLocation)
|
||||||
@@ -56,13 +56,13 @@ func main() {
|
|||||||
case "copy":
|
case "copy":
|
||||||
var field int // indicates which (numbered) field to copy
|
var field int // indicates which (numbered) field to copy
|
||||||
switch args[3] {
|
switch args[3] {
|
||||||
case "password", "-p":
|
case "password", cli.OptionFlag + "p":
|
||||||
field = 0
|
field = 0
|
||||||
case "username", "-u":
|
case "username", cli.OptionFlag + "u":
|
||||||
field = 1
|
field = 1
|
||||||
case "url", "-l":
|
case "url", cli.OptionFlag + "l":
|
||||||
field = 2
|
field = 2
|
||||||
case "note", "-n":
|
case "note", cli.OptionFlag + "n":
|
||||||
field = 3
|
field = 3
|
||||||
default:
|
default:
|
||||||
cli.HelpCopy()
|
cli.HelpCopy()
|
||||||
@@ -71,24 +71,24 @@ func main() {
|
|||||||
case "edit":
|
case "edit":
|
||||||
var field int // indicates which field to edit
|
var field int // indicates which field to edit
|
||||||
switch args[3] {
|
switch args[3] {
|
||||||
case "password", "-p":
|
case "password", cli.OptionFlag + "p":
|
||||||
field = 0
|
field = 0
|
||||||
case "username", "-u":
|
case "username", cli.OptionFlag + "u":
|
||||||
field = 1
|
field = 1
|
||||||
case "url", "-l":
|
case "url", cli.OptionFlag + "l":
|
||||||
field = 2
|
field = 2
|
||||||
case "note", "-n":
|
case "note", cli.OptionFlag + "n":
|
||||||
if argsCount == 4 {
|
if argsCount == 4 {
|
||||||
cli.EditEntryNote(targetLocation, true)
|
cli.EditEntryNote(targetLocation, true)
|
||||||
} else {
|
} else {
|
||||||
switch args[4] {
|
switch args[4] {
|
||||||
case "show", "-s":
|
case "show", cli.OptionFlag + "s":
|
||||||
cli.EditEntryNote(targetLocation, false)
|
cli.EditEntryNote(targetLocation, false)
|
||||||
default:
|
default:
|
||||||
cli.EditEntryNote(targetLocation, true)
|
cli.EditEntryNote(targetLocation, true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case "rename", "-r":
|
case "rename", cli.OptionFlag + "r":
|
||||||
cli.RenameCli(targetLocation)
|
cli.RenameCli(targetLocation)
|
||||||
default:
|
default:
|
||||||
cli.HelpEdit()
|
cli.HelpEdit()
|
||||||
@@ -97,7 +97,7 @@ func main() {
|
|||||||
cli.EditEntry(targetLocation, true, field)
|
cli.EditEntry(targetLocation, true, field)
|
||||||
} else {
|
} else {
|
||||||
switch args[4] {
|
switch args[4] {
|
||||||
case "show", "-s":
|
case "show", cli.OptionFlag + "s":
|
||||||
cli.EditEntry(targetLocation, false, field)
|
cli.EditEntry(targetLocation, false, field)
|
||||||
default:
|
default:
|
||||||
cli.EditEntry(targetLocation, true, field)
|
cli.EditEntry(targetLocation, true, field)
|
||||||
@@ -106,16 +106,16 @@ func main() {
|
|||||||
case "gen":
|
case "gen":
|
||||||
if argsCount == 4 {
|
if argsCount == 4 {
|
||||||
switch args[3] {
|
switch args[3] {
|
||||||
case "show", "-s":
|
case "show", cli.OptionFlag + "s":
|
||||||
cli.AddEntry(targetLocation, false, 1)
|
cli.AddEntry(targetLocation, false, 1)
|
||||||
case "update", "-u":
|
case "update", cli.OptionFlag + "u":
|
||||||
cli.GenUpdate(targetLocation, true)
|
cli.GenUpdate(targetLocation, true)
|
||||||
default:
|
default:
|
||||||
cli.HelpGen()
|
cli.HelpGen()
|
||||||
}
|
}
|
||||||
} else if args[3] == "update" || args[3] == "-u" {
|
} else if args[3] == "update" || args[3] == cli.OptionFlag+"u" {
|
||||||
switch args[4] {
|
switch args[4] {
|
||||||
case "show", "-s":
|
case "show", cli.OptionFlag + "s":
|
||||||
cli.GenUpdate(targetLocation, false)
|
cli.GenUpdate(targetLocation, false)
|
||||||
default:
|
default:
|
||||||
cli.GenUpdate(targetLocation, true)
|
cli.GenUpdate(targetLocation, true)
|
||||||
@@ -124,20 +124,20 @@ func main() {
|
|||||||
cli.HelpGen()
|
cli.HelpGen()
|
||||||
case "add":
|
case "add":
|
||||||
switch args[3] {
|
switch args[3] {
|
||||||
case "password", "-p":
|
case "password", cli.OptionFlag + "p":
|
||||||
if argsCount == 4 {
|
if argsCount == 4 {
|
||||||
cli.AddEntry(targetLocation, true, 0)
|
cli.AddEntry(targetLocation, true, 0)
|
||||||
} else {
|
} else {
|
||||||
switch args[4] {
|
switch args[4] {
|
||||||
case "show", "-s":
|
case "show", cli.OptionFlag + "s":
|
||||||
cli.AddEntry(targetLocation, false, 0)
|
cli.AddEntry(targetLocation, false, 0)
|
||||||
default:
|
default:
|
||||||
cli.AddEntry(targetLocation, true, 0)
|
cli.AddEntry(targetLocation, true, 0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case "note", "-n":
|
case "note", cli.OptionFlag + "n":
|
||||||
cli.AddEntry(targetLocation, true, 2)
|
cli.AddEntry(targetLocation, true, 2)
|
||||||
case "folder", "-f":
|
case "folder", cli.OptionFlag + "f":
|
||||||
offline.AddFolder(targetLocation)
|
offline.AddFolder(targetLocation)
|
||||||
default:
|
default:
|
||||||
cli.HelpAdd()
|
cli.HelpAdd()
|
||||||
@@ -173,7 +173,7 @@ func main() {
|
|||||||
cli.HelpCopy()
|
cli.HelpCopy()
|
||||||
case "gen":
|
case "gen":
|
||||||
cli.HelpGen()
|
cli.HelpGen()
|
||||||
case "version", "-v":
|
case "version", cli.OptionFlag + "v":
|
||||||
cli.Version()
|
cli.Version()
|
||||||
default:
|
default:
|
||||||
cli.HelpMain()
|
cli.HelpMain()
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ func EntryReader(decryptedEntry []string, hidePassword bool, sync bool) {
|
|||||||
if !hidePassword {
|
if !hidePassword {
|
||||||
fmt.Print(ansiDirectoryHeader + "Password:" + offline.AnsiReset + "\n" + ansiShownPassword + decryptedEntry[0] + offline.AnsiReset + "\n\n")
|
fmt.Print(ansiDirectoryHeader + "Password:" + offline.AnsiReset + "\n" + ansiShownPassword + decryptedEntry[0] + offline.AnsiReset + "\n\n")
|
||||||
} else {
|
} 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:
|
case 2:
|
||||||
|
|||||||
+28
-28
@@ -20,8 +20,8 @@ This program comes with absolutely no warranty; type "mutn version" for details.
|
|||||||
` + ansiBold + "Usage:" + offline.AnsiReset + ` mutn [/<entry name> [argument] [option]] | [argument]
|
` + ansiBold + "Usage:" + offline.AnsiReset + ` mutn [/<entry name> [argument] [option]] | [argument]
|
||||||
|
|
||||||
` + ansiBold + "Arguments:" + offline.AnsiReset + `
|
` + ansiBold + "Arguments:" + offline.AnsiReset + `
|
||||||
help/--help/-h Bring up this menu
|
help|` + OptionFlag + `h Bring up this menu
|
||||||
version/-v Display version and license information
|
version|` + OptionFlag + `v Display version and license information
|
||||||
init Set up MUTN (generates libmutton.ini)
|
init Set up MUTN (generates libmutton.ini)
|
||||||
tweak Change configuration options
|
tweak Change configuration options
|
||||||
add Add an entry
|
add Add an entry
|
||||||
@@ -33,22 +33,22 @@ This program comes with absolutely no warranty; type "mutn version" for details.
|
|||||||
|
|
||||||
` + ansiBold + "Options:" + offline.AnsiReset + `
|
` + ansiBold + "Options:" + offline.AnsiReset + `
|
||||||
add:
|
add:
|
||||||
password/-p Add a password entry
|
password|` + OptionFlag + `p Add a password entry
|
||||||
note/-n Add a note entry
|
note|` + OptionFlag + `n Add a note entry
|
||||||
folder/-f Add a new folder for entries
|
folder|` + OptionFlag + `f Add a new folder for entries
|
||||||
edit:
|
edit:
|
||||||
rename/-r Rename or relocate an entry
|
rename|` + OptionFlag + `r Rename or relocate an entry
|
||||||
username/-u Change the username of an entry
|
username|` + OptionFlag + `u Change the username of an entry
|
||||||
password/-p Change the password of an entry
|
password|` + OptionFlag + `p Change the password of an entry
|
||||||
url/-l Change the url attached to an entry
|
url|` + OptionFlag + `l Change the url attached to an entry
|
||||||
note/-n Change the note attached to an entry
|
note|` + OptionFlag + `n Change the note attached to an entry
|
||||||
copy:
|
copy:
|
||||||
username/-u Copy the username of an entry to your clipboard
|
username|` + OptionFlag + `u Copy the username of an entry to your clipboard
|
||||||
password/-p Copy the password of an entry to your clipboard
|
password|` + OptionFlag + `p Copy the password of an entry to your clipboard
|
||||||
url/-l Copy the url of an entry to your clipboard
|
url|` + OptionFlag + `l Copy the url of an entry to your clipboard
|
||||||
note/-n Copy the note of an entry to your clipboard
|
note|` + OptionFlag + `n Copy the note of an entry to your clipboard
|
||||||
gen:
|
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 /<entry name>"
|
` + ansiBold + "Tip 1:" + offline.AnsiReset + ` You can quickly read an entry with "mutn /<entry name>"
|
||||||
` + ansiBold + "Tip 2:" + offline.AnsiReset + ` Type "mutn" (no arguments/options) to view a list of saved entries
|
` + 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 + `
|
` + ansiBold + "Options:" + offline.AnsiReset + `
|
||||||
add:
|
add:
|
||||||
password/-p Add a password entry
|
password|` + OptionFlag + `p Add a password entry
|
||||||
note/-n Add a note entry
|
note|` + OptionFlag + `n Add a note entry
|
||||||
folder/-f Add a new folder for entries` + "\n\n")
|
folder|` + OptionFlag + `f Add a new folder for entries` + "\n\n")
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,11 +72,11 @@ func HelpEdit() {
|
|||||||
|
|
||||||
` + ansiBold + "Options:" + offline.AnsiReset + `
|
` + ansiBold + "Options:" + offline.AnsiReset + `
|
||||||
edit:
|
edit:
|
||||||
rename/-r Rename or relocate an entry
|
rename|` + OptionFlag + `r Rename or relocate an entry
|
||||||
username/-u Change the username of an entry
|
username|` + OptionFlag + `u Change the username of an entry
|
||||||
password/-p Change the password of an entry
|
password|` + OptionFlag + `p Change the password of an entry
|
||||||
url/-l Change the url attached to an entry
|
url|` + OptionFlag + `l Change the url attached to an entry
|
||||||
note/-n Change the note attached to an entry` + "\n\n")
|
note|` + OptionFlag + `n Change the note attached to an entry` + "\n\n")
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,10 +85,10 @@ func HelpCopy() {
|
|||||||
|
|
||||||
` + ansiBold + "Options:" + offline.AnsiReset + `
|
` + ansiBold + "Options:" + offline.AnsiReset + `
|
||||||
copy:
|
copy:
|
||||||
username/-u Copy the username in an entry to your clipboard
|
username|` + OptionFlag + `u Copy the username in an entry to your clipboard
|
||||||
password/-p Copy the password in an entry to your clipboard
|
password|` + OptionFlag + `p Copy the password in an entry to your clipboard
|
||||||
url/-l Copy the url in an entry to your clipboard
|
url|` + OptionFlag + `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")
|
note|` + OptionFlag + `n Copy the first note line in an entry to your clipboard` + "\n\n")
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,7 +97,7 @@ func HelpGen() {
|
|||||||
|
|
||||||
` + ansiBold + "Options:" + offline.AnsiReset + `
|
` + ansiBold + "Options:" + offline.AnsiReset + `
|
||||||
gen:
|
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")
|
` + ansiBold + "Tip:" + offline.AnsiReset + " If no options are provided, a new password entry is generated\n\n")
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
//go:build !windows
|
||||||
|
|
||||||
|
package cli
|
||||||
|
|
||||||
|
const OptionFlag = "-"
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
//go:build windows
|
||||||
|
|
||||||
|
package cli
|
||||||
|
|
||||||
|
const OptionFlag = ":"
|
||||||
Reference in New Issue
Block a user