diff --git a/libmuttonserver.go b/libmuttonserver.go index 58b2c1d..18e717e 100644 --- a/libmuttonserver.go +++ b/libmuttonserver.go @@ -3,6 +3,7 @@ package main import ( "fmt" "github.com/rwinkhart/MUTN/src/backend" + "github.com/rwinkhart/MUTN/src/cli" "github.com/rwinkhart/MUTN/src/sync" "os" "strings" @@ -11,8 +12,7 @@ import ( func main() { args := os.Args if len(args) < 2 { - fmt.Println(backend.AnsiError + "No arguments supplied" + backend.AnsiReset) // TODO add server help menu - os.Exit(0) + helpServer() } switch args[1] { @@ -34,7 +34,30 @@ func main() { // create the necessary directories for libmuttonserver to function backend.DirInit() os.MkdirAll(backend.ConfigDir+backend.PathSeparator+"deletions", 0700) + case "version", "-v": + versionServer() default: - fmt.Println(backend.AnsiError + "Invalid argument" + backend.AnsiReset) // TODO add server help menu + helpServer() } } + +func helpServer() { + fmt.Print(cli.AnsiBold + "\nlibmuttonserver | Copyright (c) 2024 Randall Winkhart\n" + backend.AnsiReset + ` +This software exists under the MIT license; you may redistribute it under certain conditions. +This program comes with absolutely no warranty; type "libmuttonserver version" for details. + +` + cli.AnsiBold + "Usage:" + backend.AnsiReset + ` libmuttonserver + +` + cli.AnsiBold + "Arguments (user):" + backend.AnsiReset + ` + help|-h Bring up this menu + version|-v Display version and license information + init Create the necessary directories for libmuttonserver to function` + "\n\n") + os.Exit(0) +} + +func versionServer() { + cli.MITLicense() + fmt.Print(cli.AnsiBold + "\n\n libmuttonserver" + backend.AnsiReset + " Version " + backend.LibmuttonVersion + ` + + Copyright (c) 2024 Randall Winkhart` + "\n\n") +} diff --git a/src/backend/1globals.go b/src/backend/1globals.go index cd816e6..cf59bac 100644 --- a/src/backend/1globals.go +++ b/src/backend/1globals.go @@ -11,6 +11,7 @@ var ( // global constants used across multiple files const ( - AnsiError = "\033[38;5;9m" - AnsiReset = "\033[0m" + AnsiError = "\033[38;5;9m" + AnsiReset = "\033[0m" + LibmuttonVersion = "0.2.X" ) diff --git a/src/cli/1globals.go b/src/cli/1globals.go index 7a7ab43..ecf6828 100644 --- a/src/cli/1globals.go +++ b/src/cli/1globals.go @@ -12,6 +12,6 @@ var ( // global constants used across multiple files const ( - ansiBold = "\033[1m" + AnsiBold = "\033[1m" ansiBlackOnWhite = "\033[38;5;0;48;5;15m" ) diff --git a/src/cli/printInfo.go b/src/cli/printInfo.go index 1d1b2f6..fd2f124 100644 --- a/src/cli/printInfo.go +++ b/src/cli/printInfo.go @@ -14,13 +14,13 @@ const ( ) func HelpMain() { - fmt.Print(ansiBold + "\nMUTN | Copyright (c) 2024 Randall Winkhart\n" + backend.AnsiReset + ` + fmt.Print(AnsiBold + "\nMUTN | Copyright (c) 2024 Randall Winkhart\n" + backend.AnsiReset + ` This software exists under the MIT license; you may redistribute it under certain conditions. This program comes with absolutely no warranty; type "mutn version" for details. -` + ansiBold + "Usage:" + backend.AnsiReset + ` mutn [/ [argument] [option]] | [argument] +` + AnsiBold + "Usage:" + backend.AnsiReset + ` mutn [/ [argument] [option]] | [argument] -` + ansiBold + "Arguments:" + backend.AnsiReset + ` +` + AnsiBold + "Arguments:" + backend.AnsiReset + ` help|-h Bring up this menu version|-v Display version and license information init Set up MUTN (generates libmutton.ini) @@ -32,7 +32,7 @@ This program comes with absolutely no warranty; type "mutn version" for details. shear Delete an existing entry sync Manually sync the entry directory -` + ansiBold + "Options:" + backend.AnsiReset + ` +` + AnsiBold + "Options:" + backend.AnsiReset + ` copy: password|-pw| Copy the password of an entry to your clipboard username|-u Copy the username of an entry to your clipboard @@ -52,17 +52,17 @@ This program comes with absolutely no warranty; type "mutn version" for details. note|-n Add a note entry folder|-f Add a new folder for entries -` + ansiBold + "Tip 1:" + backend.AnsiReset + ` You can quickly read an entry with "mutn /" -` + ansiBold + "Tip 2:" + backend.AnsiReset + ` Type "mutn" (no arguments/options) to view a list of saved entries -` + ansiBold + "Tip 3:" + backend.AnsiReset + ` Provide "add", "edit", "copy", or "gen" as the only argument to receive more specific help -` + ansiBold + "Tip 4:" + backend.AnsiReset + " Using \"add\", \"edit\", or \"copy\" without specifying an option (field) will default to \"password\"\n\n") +` + AnsiBold + "Tip 1:" + backend.AnsiReset + ` You can quickly read an entry with "mutn /" +` + AnsiBold + "Tip 2:" + backend.AnsiReset + ` Type "mutn" (no arguments/options) to view a list of saved entries +` + AnsiBold + "Tip 3:" + backend.AnsiReset + ` Provide "add", "edit", "copy", or "gen" as the only argument to receive more specific help +` + AnsiBold + "Tip 4:" + backend.AnsiReset + " Using \"add\", \"edit\", or \"copy\" without specifying an option (field) will default to \"password\"\n\n") os.Exit(0) } func HelpAdd() { - fmt.Print(ansiBold + "\nUsage:" + backend.AnsiReset + ` mutn / add