diff options
Diffstat (limited to 'completions/quota')
-rw-r--r-- | completions/quota | 116 |
1 files changed, 57 insertions, 59 deletions
diff --git a/completions/quota b/completions/quota index f5f9cc8..504284c 100644 --- a/completions/quota +++ b/completions/quota @@ -1,49 +1,47 @@ # bash completion for quota-tools -*- shell-script -*- -_user_or_group() +_comp_cmd_quota__user_or_group() { local i # complete on groups if -g was given for ((i = 1; i < cword; i++)); do if [[ ${words[i]} == -@(g|-group) ]]; then - COMPREPLY=($(compgen -g -- "$cur")) + _comp_compgen -- -g return fi done # otherwise complete on users - COMPREPLY=($(compgen -u -- "$cur")) + _comp_compgen -- -u } -_quota_parse_help() +_comp_cmd_quota__parse_help() { - local opts=$(_parse_help "$1") - COMPREPLY=($(compgen -W '${opts:-$(_parse_usage "$1")}' -- "$cur")) + _comp_compgen_help || _comp_compgen_usage [[ ${COMPREPLY-} == *= ]] && compopt -o nospace } -_quota_formats() +_comp_cmd_quota__formats() { - COMPREPLY=($(compgen -W 'vfsold vfsv0 rpc xfs' -- "$cur")) + _comp_compgen -- -W 'vfsold vfsv0 rpc xfs' } -_filesystems() +_comp_cmd_quota__filesystems() { # Only list filesystems starting with "/", otherwise we also get #+ "binfmt_misc", "proc", "tmpfs", ... - COMPREPLY=($(compgen -W "$(awk '/^\// {print $1}' /etc/mtab)" \ - -- "$cur")) + _comp_compgen_split -- "$(_comp_awk '/^\// {print $1}' /etc/mtab)" } -_quota() +_comp_cmd_quota() { - local cur prev words cword split - _init_completion -s || return + local cur prev words cword was_split comp_args + _comp_initialize -s -- "$@" || return case $prev in -F | --format) - _quota_formats + _comp_cmd_quota__formats return ;; -h | --help | -V | --version) @@ -51,28 +49,28 @@ _quota() ;; esac - $split && return + [[ $was_split ]] && return if [[ $cur == -* ]]; then - _quota_parse_help "$1" + _comp_cmd_quota__parse_help "$1" else - _user_or_group + _comp_cmd_quota__user_or_group fi } && - complete -F _quota -o default quota + complete -F _comp_cmd_quota -o default quota -_setquota() +_comp_cmd_setquota() { - local cur prev words cword split - _init_completion -s || return + local cur prev words cword was_split comp_args + _comp_initialize -s -- "$@" || return case $prev in -F | --format) - _quota_formats + _comp_cmd_quota__formats return ;; -p | --prototype) - _user_or_group + _comp_cmd_quota__user_or_group return ;; -h | --help | -V | --version) @@ -80,43 +78,43 @@ _setquota() ;; esac - $split && return + [[ $was_split ]] && return if [[ $cur == -* ]]; then - _quota_parse_help "$1" + _comp_cmd_quota__parse_help "$1" else - local args - _count_args + local REPLY + _comp_count_args - case $args in + case $REPLY in 1) - _user_or_group + _comp_cmd_quota__user_or_group ;; 2) - _filesystems + _comp_cmd_quota__filesystems ;; esac fi } && - complete -F _setquota -o default setquota + complete -F _comp_cmd_setquota -o default setquota -_edquota() +_comp_cmd_edquota() { - local cur prev words cword split - _init_completion -s || return + local cur prev words cword was_split comp_args + _comp_initialize -s -- "$@" || return case $prev in -F | --format) - _quota_formats + _comp_cmd_quota__formats return ;; -f | --filesystem) - _filesystems + _comp_cmd_quota__filesystems return ;; -p | --prototype) - _user_or_group + _comp_cmd_quota__user_or_group return ;; -h | --help | -V | --version) @@ -124,24 +122,24 @@ _edquota() ;; esac - $split && return + [[ $was_split ]] && return if [[ $cur == -* ]]; then - _quota_parse_help "$1" + _comp_cmd_quota__parse_help "$1" else - _user_or_group + _comp_cmd_quota__user_or_group fi } && - complete -F _edquota -o default edquota + complete -F _comp_cmd_edquota -o default edquota -_quotacheck() +_comp_cmd_quotacheck() { - local cur prev words cword split - _init_completion -s || return + local cur prev words cword was_split comp_args + _comp_initialize -s -- "$@" || return case $prev in -F | --format) - _quota_formats + _comp_cmd_quota__formats return ;; -h | --help | -V | --version) @@ -149,28 +147,28 @@ _quotacheck() ;; esac - $split && return + [[ $was_split ]] && return if [[ $cur == -* ]]; then - _quota_parse_help "$1" + _comp_cmd_quota__parse_help "$1" else - _filesystems + _comp_cmd_quota__filesystems fi } && - complete -F _quotacheck -o default quotacheck repquota + complete -F _comp_cmd_quotacheck -o default quotacheck repquota -_quotaon() +_comp_cmd_quotaon() { - local cur prev words cword split - _init_completion -s || return + local cur prev words cword was_split comp_args + _comp_initialize -s -- "$@" || return case $prev in -F | --format) - _quota_formats + _comp_cmd_quota__formats return ;; -x | --xfs-command) - COMPREPLY=($(compgen -W 'delete enforce' -- "$cur")) + _comp_compgen -- -W 'delete enforce' return ;; -h | --help | -V | --version) @@ -178,14 +176,14 @@ _quotaon() ;; esac - $split && return + [[ $was_split ]] && return if [[ $cur == -* ]]; then - _quota_parse_help "$1" + _comp_cmd_quota__parse_help "$1" else - _filesystems + _comp_cmd_quota__filesystems fi } && - complete -F _quotaon -o default quotaon quotaoff + complete -F _comp_cmd_quotaon -o default quotaon quotaoff # ex: filetype=sh |