Updated help text

master
Aaron Johnon 1 year ago
parent 2686154c6f
commit 78c3977594

@ -13,17 +13,29 @@ import (
func main() {
// Define the shift, hex, space, and grouping flags
shift := flag.Int("s", 0, "Shift value for alphabet positions (can be negative)")
useHex := flag.Bool("x", false, "Encode numbers in hexadecimal")
encodeSpaces := flag.Bool("S", false, "Encode spaces as '00'")
useHex := flag.Bool("x", false, "Encode numbers in hexadecimal instead of decimal")
encodeSpaces := flag.Bool("S", false, "Encodes spaces as '00'")
groupSize := flag.Int("g", 2, "Group size for output digits (minimum value of 2, default 2)")
flag.Usage = func() {
fmt.Fprintf(os.Stderr, "Usage: %s [options] <<< \"String\"\n", os.Args[0])
fmt.Fprintf(os.Stderr, " %s [options] < file.txt\n", os.Args[0])
fmt.Fprintf(os.Stderr, " echo \"string\" | %s [options]\n", os.Args[0])
fmt.Fprintf(os.Stderr, "\nDescription:\n")
fmt.Fprintf(os.Stderr, " A companion program to numberstation, intended to make easy work of making very basic ciphers for numbers station projects.\n")
fmt.Fprintf(os.Stderr, "\nOptions:\n")
flag.PrintDefaults() // Print the default flag help information
fmt.Fprintf(os.Stderr, "\nExamples:\n")
fmt.Fprintf(os.Stderr, " %s -s 2 -g 5 <<< \"This is a test.\"\n", os.Args[0])
fmt.Fprintf(os.Stderr, " %s -S -s 16 -x -g 4 < file.txt | numberstation -r\n", os.Args[0])
}
flag.Parse()
// Check for invalid group size
if *groupSize == 1 {
if *groupSize < 2 {
fmt.Fprintln(os.Stderr, "Error: Minimum group size is 2. Exiting.")
os.Exit(1)
} else if *groupSize <= 0 {
*groupSize = 2
}
// Check if input is being piped or passed as an argument

Loading…
Cancel
Save