summaryrefslogtreecommitdiffstats
path: root/completions/ulimit
diff options
context:
space:
mode:
Diffstat (limited to 'completions/ulimit')
-rw-r--r--completions/ulimit21
1 files changed, 9 insertions, 12 deletions
diff --git a/completions/ulimit b/completions/ulimit
index e596bf7..9f6f13b 100644
--- a/completions/ulimit
+++ b/completions/ulimit
@@ -1,16 +1,16 @@
# bash completion for ulimit -*- shell-script -*-
-_ulimit()
+_comp_cmd_ulimit()
{
- local cur prev words cword
- _init_completion || return
+ local cur prev words cword comp_args
+ _comp_initialize -- "$@" || return
# TODO combined option support (-aH, -Sc etc)
- local mode
+ local mode=
case $prev in
-a)
- COMPREPLY=($(compgen -W "-S -H" -- "$cur"))
+ _comp_compgen -- -W "-S -H"
return
;;
-[SH]) ;;
@@ -20,23 +20,20 @@ _ulimit()
;;
esac
- if [[ ! -v mode ]]; then
+ if [[ ! $mode ]]; then
local word
for word in "${words[@]}"; do
[[ $word == -*a* ]] && return
done
if [[ $cur == -* ]]; then
- COMPREPLY=($(compgen -W '$(_parse_usage "$1")' -- "$cur"))
+ _comp_compgen_usage -c help -s "$1"
return
fi
fi
- local args
- _count_args
- ((args == 1)) &&
- COMPREPLY=($(compgen -W "soft hard unlimited" -- "$cur"))
+ [[ ${mode-} ]] && _comp_compgen -- -W "soft hard unlimited"
} &&
- complete -F _ulimit ulimit
+ complete -F _comp_cmd_ulimit ulimit
# ex: filetype=sh