-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
Here is my test program:
Usage:
#{__FILE__} [--test=<test-value>]
#{__FILE__} -h | --help | --version
Options:
-h, --help Shows this screen.
-v, --version Display the program version.
-t, --test <test-value> My own test valueHere are some use-cases for the above program (I'm using docopt.rb here):
# Valid case: long option with equals sign
./docopt-test.rb --test=1234
# Output
{"--test"=>"1234", "--help"=>false, "--version"=>false}
# Valid case: short option with a space
./docopt-test.rb -t 1234
# Output
{"--test"=>"1234", "--help"=>false, "--version"=>false}
# Invalid case: short option with an equal sign
./docopt-test.rb -t=1234
# Output (the value is =1234 here)
{"--test"=>"=1234", "--help"=>false, "--version"=>false}Here is the autocomplete file I get when using this tool:
_docopttestrb()
{
local cur
cur="${COMP_WORDS[COMP_CWORD]}"
if [ $COMP_CWORD -ge 1 ]; then
COMPREPLY=( $( compgen -W '-t= --test= -h --help -h --help -v --version ' -- $cur) )
fi
}
complete -o bashdefault -o default -o filenames -F _docopttestrb docopt-test.rbIt basically only autocompletes with -t=, which is an invalid option as far as docopt is concerned.
Is this a problem on my script or could this be a bug?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels