Open ikskuh opened 6 months ago
Some programs require "troolean" options that can have a default, but also be forced to true and false.
true
false
We can either implement it as a special case for ?bool or provide a custom type for this:
?bool
const Trinary = enum { unset, false, true }; var cli = parse(struct { @"emit-bin": ?bool = null, // --emit-bin and --no-emit-bin @"emit-bin": args.Trinary = .unset, // --emit-bin and --no-emit-bin }, …);
Some programs require "troolean" options that can have a default, but also be forced to
true
andfalse
.We can either implement it as a special case for
?bool
or provide a custom type for this: