summaryrefslogtreecommitdiff
path: root/args.go
diff options
context:
space:
mode:
authorAdrien Hopkins <adrien.p.hopkins@gmail.com>2023-09-12 20:01:33 -0500
committerAdrien Hopkins <adrien.p.hopkins@gmail.com>2023-09-12 20:01:33 -0500
commit345f6bae7b005cdd386833aa496aa71ca11c7b97 (patch)
tree023e583e692b5dfff9ccfc0e290fc1fdb10f62e5 /args.go
parentd6bb5352f93f2260f4a37ccd7c71bd08c4d03340 (diff)
Add option to show digit map only
This is intended to allow users to easily view the digit maps of many different radices at once by running the program multiple times.
Diffstat (limited to 'args.go')
-rw-r--r--args.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/args.go b/args.go
index d0f5da9..2adb076 100644
--- a/args.go
+++ b/args.go
@@ -16,6 +16,7 @@ type args struct {
FullMap bool
ExactMTCLarge bool
TotativeDigits bool
+ DigitMapOnly bool
// If true, exit the program immediately after parsing args.
Exit bool
}
@@ -23,6 +24,8 @@ type args struct {
func parseArgs() (args, error) {
var a args
flag.BoolVar(&a.Compact, "c", false, "Compact the output display")
+ flag.BoolVar(&a.DigitMapOnly, "d", false,
+ "Show only the digit map; incompatible with -m and -t")
flag.BoolVar(&a.FullMap, "f", false,
fmt.Sprintf("Show full digit map (up to %d) for every radix",
maxSmallRadix))
@@ -45,6 +48,8 @@ func parseArgs() (args, error) {
return args{Exit: true}, nil
} else if a.Compact && a.TotativeDigits {
return args{}, errors.New("You cannot use both -t and -c at the same time.")
+ } else if a.DigitMapOnly && (a.TotativeDigits || a.ExactMTCLarge) {
+ return args{}, errors.New("You cannot use both -d and -t or -m at the same time.")
} else {
if flag.NArg() == 1 {
if radix, err := strconv.ParseUint(flag.Arg(0), 0, 0); err == nil {