diff options
author | Gabriel F. T. Gomes <gabriel@inconstante.net.br> | 2020-08-03 18:43:13 -0300 |
---|---|---|
committer | Gabriel F. T. Gomes <gabriel@inconstante.net.br> | 2020-08-03 18:43:13 -0300 |
commit | 95623d39d6029ba78ec96ad5ea08e9ac12629b91 (patch) | |
tree | ea0fe36eb5e6f40e0a1f765d44c4b0c0b2bfb089 /completions/dmypy | |
parent | 019f3cc463db63abc6460f97deb488deec43840b (diff) | |
download | bash-completion-upstream.tar.gz |
New upstream version 2.11upstream/2.11upstream
Diffstat (limited to 'completions/dmypy')
-rw-r--r-- | completions/dmypy | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/completions/dmypy b/completions/dmypy index a8c07437..5abe37d7 100644 --- a/completions/dmypy +++ b/completions/dmypy @@ -6,7 +6,7 @@ _dmypy() _init_completion || return case $prev in - --help|--version|-[hV]) + --help | --version | -[hV]) return ;; --status-file) @@ -16,32 +16,33 @@ _dmypy() esac local cmd i - for (( i=1; i < cword; i++ )); do - if [[ ${words[i]} != -* && ${words[i-1]} != --status-file ]]; then + for ((i = 1; i < cword; i++)); do + if [[ ${words[i]} != -* && ${words[i - 1]} != --status-file ]]; then cmd=${words[i]} break fi done - case $cmd in - check|run) + case ${cmd-} in + check | run) _filedir '@(py|pyi)' return + ;; esac if [[ $cur == -* ]]; then - COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) + COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) return fi - if [[ ! $cmd ]]; then - local cmds=$($1 --help 2>&1 \ - | command sed -ne '/positional arguments/{p;n;p;q}' \ - | command sed -ne 's/{\(.*\)}/\1/p') - COMPREPLY=( $(IFS="," compgen -W '$cmds' -- "$cur") ) + if [[ ! -v cmd ]]; then + local cmds=$($1 --help 2>&1 | + command sed -ne '/positional arguments/{p;n;p;q}' | + command sed -ne 's/{\(.*\)}/\1/p') + COMPREPLY=($(IFS="," compgen -W '$cmds' -- "$cur")) return fi } && -complete -F _dmypy dmypy + complete -F _dmypy dmypy # ex: filetype=sh |