Add bash completion support. Fix #218
This commit is contained in:
parent
4c5dfb5881
commit
abe51015c4
|
@ -4,4 +4,4 @@ bin
|
|||
.dub
|
||||
dub.selections.json
|
||||
.gdb_history
|
||||
dfmt
|
||||
bin/dfmt
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
# Completion for dfmt
|
||||
_dfmt()
|
||||
{
|
||||
local cur prev opts
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
opts="--help -h --inplace -i --version --align_switch_statements --brace_style\
|
||||
--end_of_line --indent_size --indent_style -t --soft_max_line_length\
|
||||
--max_line_length --outdent_attributes --space_after_cast\
|
||||
--selective_import_space --split_operator_at_line_end\
|
||||
--compact_labeled_statements --template_constraint_style"
|
||||
eolOpts="lf cr crlf"
|
||||
braceOpts="allman otbs stroustrup"
|
||||
indentOpts="tab space"
|
||||
constraintOpts="conditional_newline_indent conditional_newline always_newline always_newline_indent"
|
||||
if [[ ${cur} == -* ]]; then
|
||||
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
|
||||
return 0;
|
||||
fi
|
||||
case "${prev}" in
|
||||
"--brace_style")
|
||||
COMPREPLY=($(compgen -W "${braceOpts}" -- ${cur}))
|
||||
return 0
|
||||
;;
|
||||
"--end_of_line")
|
||||
COMPREPLY=($(compgen -W "${eolOpts}" -- ${cur}))
|
||||
return 0
|
||||
;;
|
||||
"-t")
|
||||
;&
|
||||
"--indent_style")
|
||||
COMPREPLY=($(compgen -W "${indentOpts}" -- ${cur}))
|
||||
return 0
|
||||
;;
|
||||
"--template_constraint_style")
|
||||
COMPREPLY=($(compgen -W "${constraintOpts}" -- ${cur}))
|
||||
return 0
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
|
||||
}
|
||||
complete -F _dfmt dfmt
|
Loading…
Reference in New Issue