Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions completions-core/sudo.bash
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ _comp_cmd_sudo()
local i mode=normal
[[ $1 == *sudoedit ]] && mode=edit

local noargopts='!(-*|*[CDghpRrTtUu]*)'
local noargopts='!(-*|*[CDghpRrtTUu]*)'
[[ $mode == normal ]] &&
for ((i = 1; i <= cword; i++)); do
if [[ ${words[i]} != -* ]]; then
Expand All @@ -23,7 +23,7 @@ _comp_cmd_sudo()
break
fi
# shellcheck disable=SC2254
[[ ${words[i]} == @(--@(close-from|chdir|group|host|prompt|chroot|role|command-timeout|type|other-user|user)|-${noargopts}[CDghpRrTtUu]) ]] &&
[[ ${words[i]} == @(--@(close-from|chdir|preserve-env|group|host|prompt|chroot|role|type|command-timeout|user|other-user)|-${noargopts}[CDghpRrtTUu]) ]] &&
((i++))
done

Expand All @@ -37,8 +37,9 @@ _comp_cmd_sudo()
_comp_compgen -- -g
return
;;
--close-from | --prompt | --role | --type | --command-timeout | \
-${noargopts}[CprTt])
--close-from | --preserve-env | --help | --prompt | --role | --type | \
--command-timeout | --version | \
-${noargopts}[CprTtV]) # no "h", sudo.ws treats it as host with arg
return
;;
--chdir | --chroot | -${noargopts}[DR])
Expand Down