You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I know this is not maintained (which is sad), but just in case someone picks up maintenance some day, here is a bug that caused me some headache.
The below docopt usage pattern does not work.
Usage:
run run
Reproduce
Save the below as test.rb
require"docopt"doc=<<DOCOPTUsage: run ship run runDOCOPTbeginpDocopt::docopt(doc)rescueDocopt::Exit=>eputse.messageexitendputs"execution continued"
Then run:
$ ruby test.rb
Expected Behavior
The usage pattern should be displayed, and execution should be halted
Actual Behavior
The execution continues as if a valid usage pattern was provided. Removing the run run usage pattern from the docopt string, restores correct behavior.
require"docopt"doc=<<~DOCOPT Usage: run server start run server stop run server runDOCOPTbeginppDocopt::docoptdocrescueDocopt::Exit=>eputse.messageend
Output
# the `run` command is completely omitted
$ ruby test.rb
{"server"=>false, "start"=>false, "stop"=>false}
# ... and not accepted of course
$ ruby test.rb server run
Usage:
run server start
run server stop
run server run
I know this is not maintained (which is sad), but just in case someone picks up maintenance some day, here is a bug that caused me some headache.
The below docopt usage pattern does not work.
Reproduce
Save the below as
test.rb
Then run:
Expected Behavior
The usage pattern should be displayed, and execution should be halted
Actual Behavior
The execution continues as if a valid usage pattern was provided. Removing the
run run
usage pattern from the docopt string, restores correct behavior.I believe the root cause is in
#formal_usage
The text was updated successfully, but these errors were encountered: