| 1 |
_have black && |
| 2 |
_black() |
| 3 |
{ |
| 4 |
local cur prev |
| 5 |
|
| 6 |
COMPREPLY=() |
| 7 |
cur=${COMP_WORDS[COMP_CWORD]} |
| 8 |
prev=${COMP_WORDS[COMP_CWORD-1]} |
| 9 |
|
| 10 |
case $prev in |
| 11 |
-l|--line-length|--include|--exclude|--python-cell-magics|--required-version|--extend-exclude|--force-exclude|-W|--workers) |
| 12 |
return 0;; |
| 13 |
-t|--target-version) |
| 14 |
COMPREPLY=( $(compgen -W "py33 py34 py35 py36 py37 py38 py39 py310 py311 py312" -- $cur) ) |
| 15 |
return;; |
| 16 |
esac |
| 17 |
if [[ "$cur" == -* ]]; then |
| 18 |
opts='-c -l -t -S -C -W -q -v -h' |
| 19 |
lopts=' |
| 20 |
--code |
| 21 |
--line-length |
| 22 |
--pypi |
| 23 |
--ipynb |
| 24 |
--python-cell-magics |
| 25 |
--skip-string-normalization |
| 26 |
--skip-magic-trailing-comma |
| 27 |
--preview |
| 28 |
--check |
| 29 |
--diff |
| 30 |
--color |
| 31 |
--no-color |
| 32 |
--fast |
| 33 |
--safe |
| 34 |
--required-version |
| 35 |
--include |
| 36 |
--exclude |
| 37 |
--extend-exclude |
| 38 |
--force-exclude |
| 39 |
--stdin-filename |
| 40 |
--workers |
| 41 |
--quiet |
| 42 |
--verbose |
| 43 |
--version |
| 44 |
--config |
| 45 |
' |
| 46 |
COMPREPLY=( $(compgen -W "${opts[*]} ${lopts[*]}" -- $cur) ) |
| 47 |
else |
| 48 |
_filedir |
| 49 |
fi |
| 50 |
} |
| 51 |
complete -F _black $filenames black |