[bash] fix doas completions
This commit is contained in:
parent
b3c0c6c97d
commit
81e9648bac
4
.bash/completions
Normal file
4
.bash/completions
Normal file
|
@ -0,0 +1,4 @@
|
|||
|
||||
for i in ~/.bash/completions.d/*; do
|
||||
. "$i"
|
||||
done
|
19
.bash/completions.d/doas
Normal file
19
.bash/completions.d/doas
Normal file
|
@ -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|C) ]] && ((i++))
|
||||
done
|
||||
} && complete -F _doas doas
|
||||
|
||||
# ex: filetype=sh
|
5
.bashrc
5
.bashrc
|
@ -26,10 +26,7 @@ export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND"
|
|||
|
||||
## Completions
|
||||
[ -f /etc/bash_completion ] && . /etc/bash_completion
|
||||
|
||||
# doas/sudo command completion
|
||||
complete -cf sudo
|
||||
complete -cf doas
|
||||
. ~/.bash/completions
|
||||
|
||||
# fzf
|
||||
if command -v fzf 2>&1 > /dev/null; then
|
||||
|
|
Loading…
Reference in a new issue