diff options
Diffstat (limited to 'args.go')
| -rw-r--r-- | args.go | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -11,10 +11,11 @@ const ProgramVersion = "1.0.0-alpha+dev" // The arguments to this program type args struct { - Radix uint - Compact bool - FullMap bool - ExactMTCLarge bool + Radix uint + Compact bool + FullMap bool + ExactMTCLarge bool + TotativeDigits bool // If true, exit the program immediately after parsing args. Exit bool } @@ -28,6 +29,8 @@ func parseArgs() (args, error) { flag.BoolVar(&a.ExactMTCLarge, "m", false, fmt.Sprintf("Calculate exact MTC for very large radices (up to %d instead of %d), which may take a while.", maxExtended, maxNormal)) + flag.BoolVar(&a.TotativeDigits, "t", false, + "Calculate the radix's totative digits instead of just how many there are; incompatible with -c.") help := flag.Bool("?", false, "Get information about program usage then exit") version := flag.Bool("V", false, @@ -40,6 +43,8 @@ func parseArgs() (args, error) { } else if *version { fmt.Println("Radix Info version", ProgramVersion) 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 flag.NArg() == 1 { if radix, err := strconv.ParseUint(flag.Arg(0), 0, 0); err == nil { |
