Open tersec opened 2 years ago
import confutils type Command = enum noCommand IntConf = object case cmd {. command defaultValue: noCommand }: Command of noCommand: uint8Arg: uint8 uint16Arg: uint16 uint32Arg: uint32 let conf = IntConf.load() echo "uint8Arg = ", conf.uint8Arg echo "uint16Arg = ", conf.uint16Arg echo "uint32Arg = ", conf.uint32Arg
$ ./env.sh nim c -r --hints:off -o:$(mktemp) intconf.nim --uint8Arg=256 --uint16Arg=65536 --uint32Arg=4294967296 uint8Arg = 0 uint16Arg = 0 uint32Arg = 0 $ ./env.sh nim c -r --hints:off -o:$(mktemp) intconf.nim --uint8Arg=257 --uint16Arg=65537 --uint32Arg=4294967297 uint8Arg = 1 uint16Arg = 1 uint32Arg = 1