Open musjj opened 1 year ago
Hello @musjj
The parsing library is still the default docopt (without S) lib. So this is a limitation of the actual parser. See:
https://github.com/docopt/docopt/issues/333
https://github.com/docopt/docopt/issues/190
Until I move to another parser with more power full capability it can't be solved as is. Unfortunately I'm not working actively on the new parser actually. :shrug:
You can think for work around though:
./cli.sh
:
#!/usr/bin/env bash
help="
Usage:
cli <args>... [--other=<extra-args>...]
"
docopts --no-declare -A args -h "$help" : "$@"
output
./cli.sh pos pos2 --other=extra1
args['--other,0']='extra1'
args['--other,#']=1
args['<args>,0']='pos'
args['<args>,1']='pos2'
args['<args>,#']=2
Two arguments for --extra
./cli.sh pos pos2 --other=extra1 --other=extra2
XY problem, may be, what are you trying to accomplish?
I'm trying to separate positional arguments from extra arguments, like this:
But running
./cli.sh pos -- extra
will print this:All of the positional arguments are consumed by
<args>
. How do I separate them?