cmd = Cli.mk() option('output', fn c: c { info: Just('sum option help') , short: Just('o') }) help('miau miau miau') cmd = Cli.mk() arg(Cli.int, fn(): Cli.def()) option('output', Cli.int, fn()): Cli.def() info('this is a typeclass yo') short('o') default(420) short('m', Cli.bool, fn()): # only short. info('asjkdlajksd') command('build', fn()): arg(Cli.str) option('debug', Cli.bool, fn()): Cli.def() help('yoo!') default(True) help('miau miau miau') xx = cmd Cli.parse(Args.get()) # ??? cmd = Cli.mk() arg(Cli.int, fn(s, x): s { first-arg: x }, fn(): Cli.def()) option('output', Cli.int, fn(s, x): s { output: x }, fn()): Cli.def() info('this is a typeclass yo') short('o') default(420) short('m', Cli.bool, fn()): Cli.def() # only short. info('asjkdlajksd') required() command('build', fn(s, b): s { build-options: b }, fn()): Cli.def() # basically, by default it's undefined, and to override it, specify `default`. arg(Cli.str, fn(s, a): s { what: a }) option('debug', Cli.bool, fn(b, d): b { debug: d }, fn()): Cli.def() help('yoo!') default(True) default(BuildOptions { what: @undefined, debug: False }) help('miau miau miau') default(Prog { ... }) xx = cmd Cli.parse(Args.get()) # the function constructors (like fn(s, x): s { first-arg: x }) are also nice cuz instead of creating structs, # we can also do this: fn(_, x): some-ptr set-ptr(x) and return unit # ... # alternative representation! # won't require typeclasses (at least for basic operation, we can restrict or automatically make options for different types etc) # no need to write Cli.def() cmd = Cli.mk( [ arg(Cli.int, fn(s, x): s { first-arg: x }, []) , option('output', Cli.int, fn(s, x): s { output: x }, [ info('this is a typeclass yo') , short('o') , default(420) ]) , short('m', Cli.bool, [ info('asjkdlajksd') , required() ]) ] # i think I prefer the non-list one. # maybe only for the parameters it's not that bad.