mirror of
https://github.com/swaywm/sway.git
synced 2024-11-21 15:31:28 +00:00
bash: add completion for sway
This commit is contained in:
parent
a0dc8032e1
commit
27e89cf61d
46
completions/bash/sway
Normal file
46
completions/bash/sway
Normal file
|
@ -0,0 +1,46 @@
|
|||
# sway(1) completion
|
||||
|
||||
_sway()
|
||||
{
|
||||
local cur prev
|
||||
_get_comp_words_by_ref cur prev
|
||||
|
||||
short=(
|
||||
-h
|
||||
-c
|
||||
-C
|
||||
-d
|
||||
-v
|
||||
-V
|
||||
)
|
||||
|
||||
long=(
|
||||
--help
|
||||
--config
|
||||
--validate
|
||||
--debug
|
||||
--version
|
||||
--verbose
|
||||
--get-socketpath
|
||||
)
|
||||
|
||||
case $prev in
|
||||
-c|--config)
|
||||
_filedir
|
||||
return
|
||||
;;
|
||||
esac
|
||||
|
||||
if [[ $cur == --* ]]; then
|
||||
COMPREPLY=($(compgen -W "${long[*]}" -- "$cur"))
|
||||
elif [[ $cur == -* ]]; then
|
||||
COMPREPLY=($(compgen -W "${short[*]}" -- "$cur"))
|
||||
COMPREPLY+=($(compgen -W "${long[*]}" -- "$cur"))
|
||||
else
|
||||
COMPREPLY=($(compgen -W "${short[*]}" -- "$cur"))
|
||||
COMPREPLY+=($(compgen -W "${long[*]}" -- "$cur"))
|
||||
COMPREPLY+=($(compgen -c -- "$cur"))
|
||||
fi
|
||||
|
||||
} &&
|
||||
complete -F _sway sway
|
Loading…
Reference in a new issue