Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add bash-completion support #84

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Fix indentation in bash completion
  • Loading branch information
FintasticMan committed Dec 23, 2021
commit 4cafc18047077c8bd4246081493d13fe8ecbb469
22 changes: 11 additions & 11 deletions doas.completion
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# bash completion for doas(1) -*- shell-script -*-

_doas() {
local cur prev words cword split
_init_completion -s || return
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
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
[[ ${words[i]} == -@(u|C) ]] && ((i++))
done
} && complete -F _doas doas

# ex: filetype=sh