forked from nholstein/OpenDoas
-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loosely based on bash-completion's sudo support
- Loading branch information
1 parent
9a25a6d
commit fe764f4
Showing
2 changed files
with
26 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# bash completion for doas(1) -*- shell-script -*- | ||
|
||
_doas() { | ||
local cur prev words cword split | ||
_init_completion -s || return | ||
|
||
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 | ||
|
||
[[ ${words[i]} == -u ]] || [[ ${words[i]} == -C ]] && ((i++)) | ||
done | ||
} && complete -F _doas doas | ||
|
||
# ex: filetype=sh |