Closed impguard closed 3 years ago
Hi @impguard,
The --debug
mode is for developer, when you want debug the command docopts
itself. I think it is not documented.
What to did you expect exactly?
It works, as I would expect:
I put your code into a variable:
$ HELP="A script
>
> Helpful commands to work with this project.
>
> Usage:
> ./make admin COMMAND
> "
$ echo "$HELP"
A script
Helpful commands to work with this project.
Usage:
./make admin COMMAND
Using the debug mode, you get an output not suitable for eval: I will describe the output bellow.
$ ./docopts -h "$HELP" --debug :
################## golang ##################
--debug : true
--help : A script
Helpful commands to work with this project.
Usage:
./make admin COMMAND
--no-declare : false
--no-help : false
--no-mangle : false
--options-first : false
--separator : ----
--version : <nil>
-A : <nil>
-G : <nil>
: : true
<argv> : []
doc : A script
Helpful commands to work with this project.
Usage:
./make admin COMMAND
bash_version :
echo 'error:
Usage:
./make admin COMMAND' >&2
exit 64
Here I didn't send any param to the bash parser: the colon :
separator is mandatory and followed by nothing.
We got only one section, the golang section, showing all value of all switches for the binary.
If I add some parameter for the bash script:
./docopts -h "$HELP" --debug : admin "reboot"
################## golang ##################
--debug : true
--help : A script
Helpful commands to work with this project.
Usage:
./make admin COMMAND
--no-declare : false
--no-help : false
--no-mangle : false
--options-first : false
--separator : ----
--version : <nil>
-A : <nil>
-G : <nil>
: : true
<argv> : [admin reboot]
doc : A script
Helpful commands to work with this project.
Usage:
./make admin COMMAND
bash_version :
################## bash ##################
COMMAND : reboot
admin : true
----------------------------------------
COMMAND='reboot'
admin=true
We got a new section ################## bash ##################
Which shows what the parser extracted and mapped the bash's argument to the HELP string given.
And finally the the output for eval:
COMMAND='reboot'
admin=true
Could you precise your question, regarding the information above?
Ah, I did not consider that the debug output was outputting to standard out and would be eval'd.
That will resolve this issue. However, it does indicate that [--] does not work as intended currently. But I can create a separate issue for that.
Seeing debug print strange output on OSX:
Output I see
I wanted to test using
[--]
since it wasn't working as I expected. But the debug output is not presenting something useful. If I remove the--debug
flag I get: