c-blake / cligen

Nim library to infer/generate command-line-interfaces / option / argument parsing; Docs at
https://c-blake.github.io/cligen/
ISC License
506 stars 24 forks source link

dispathAs(foobar, foobarMain) => creates `proc foobarMain(args: seq[string]): int` #45

Closed timotheecour closed 5 years ago

timotheecour commented 5 years ago

/cc @c-blake

I'd like to use cligen in a more flexible way as follows:

proc foobar(foo=1, bar=2.0, baz="hi", verb=false, paths: seq[string]): int =
  ...

dispathAs(foobar, foobarMain)
# creates `proc foobarMain*(args: seq[string]): int` ; this can be called eg via: foobarMain(["-f:3", "--baz:mybaz"])

it adds flexibility to integrate in more complex libraries, eg when args are provided from another source (could be forwarded from post processed command line or from any other source)

Hopefully this is a simple change