summaryrefslogtreecommitdiff
path: root/completions/sudo
diff options
context:
space:
mode:
Diffstat (limited to 'completions/sudo')
-rw-r--r--completions/sudo48
1 files changed, 24 insertions, 24 deletions
diff --git a/completions/sudo b/completions/sudo
index 1b8e508f..c9a806ba 100644
--- a/completions/sudo
+++ b/completions/sudo
@@ -9,48 +9,48 @@ _sudo()
[[ $1 == *sudoedit ]] && mode=edit
[[ $mode == normal ]] &&
- for (( i=1; i <= cword; i++ )); do
- if [[ ${words[i]} != -* ]]; then
- local PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin
- local root_command=${words[i]}
- _command_offset $i
- return
- fi
- if [[ ${words[i]} == -@(!(-*)e*|-edit) ]]; then
- mode=edit
- break
- fi
- [[ ${words[i]} == \
- -@(user|other-user|group|close-from|prompt|!(-*)[uUgCp]) ]] \
- && ((i++))
- done
+ for ((i = 1; i <= cword; i++)); do
+ if [[ ${words[i]} != -* ]]; then
+ local PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin
+ local root_command=${words[i]}
+ _command_offset $i
+ return
+ fi
+ if [[ ${words[i]} == -@(!(-*)e*|-edit) ]]; then
+ mode=edit
+ break
+ fi
+ [[ ${words[i]} == \
+ -@(user|other-user|group|close-from|prompt|!(-*)[uUgCp]) ]] &&
+ ((i++))
+ done
case "$prev" in
- --user|--other-user|-!(-*)[uU])
- COMPREPLY=( $(compgen -u -- "$cur") )
+ --user | --other-user | -!(-*)[uU])
+ COMPREPLY=($(compgen -u -- "$cur"))
return
;;
- --group|-!(-*)g)
- COMPREPLY=( $(compgen -g -- "$cur") )
+ --group | -!(-*)g)
+ COMPREPLY=($(compgen -g -- "$cur"))
return
;;
- --close-from|--prompt|-!(-*)[Cp])
+ --close-from | --prompt | -!(-*)[Cp])
return
;;
esac
$split && return
- if [[ "$cur" == -* ]]; then
+ if [[ $cur == -* ]]; then
local opts=$(_parse_help "$1")
- COMPREPLY=( $(compgen -W '${opts:-$(_parse_usage "$1")}' -- "$cur") )
- [[ $COMPREPLY == *= ]] && compopt -o nospace
+ COMPREPLY=($(compgen -W '${opts:-$(_parse_usage "$1")}' -- "$cur"))
+ [[ ${COMPREPLY-} == *= ]] && compopt -o nospace
return
fi
if [[ $mode == edit ]]; then
_filedir
fi
} &&
-complete -F _sudo sudo sudoedit
+ complete -F _sudo sudo sudoedit
# ex: filetype=sh