48 lines
1.3 KiB
Plaintext
48 lines
1.3 KiB
Plaintext
# 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
|
|
;;
|
|
*)
|
|
COMPREPLY=($(compgen -f -- ${cur}))
|
|
return 0
|
|
;;
|
|
esac
|
|
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
|
|
}
|
|
complete -F _dfmt dfmt
|