bash: add completion for swaymsg

This commit is contained in:
Eric Engestrom 2018-07-27 16:31:18 +01:00
parent 27e89cf61d
commit 21609f8af2
1 changed files with 57 additions and 0 deletions

57
completions/bash/swaymsg Normal file
View File

@ -0,0 +1,57 @@
# swaymsg(1) completion
_swaymsg()
{
local cur prev
_get_comp_words_by_ref cur prev
types=(
'get_workspaces'
'get_seats'
'get_inputs'
'get_outputs'
'get_tree'
'get_marks'
'get_bar_config'
'get_version'
'get_clipboard'
)
short=(
-h
-q
-r
-s
-t
-v
)
long=(
--help
--quiet
--raw
--socket
--type
--verbose
)
case $prev in
-s|--socket)
_filedir
return
;;
-t|--type)
COMPREPLY=($(compgen -W "${types[*]}" -- "$cur"))
return
;;
esac
if [[ $cur == --* ]]; then
COMPREPLY=($(compgen -W "${long[*]}" -- "$cur"))
else
COMPREPLY=($(compgen -W "${short[*]}" -- "$cur"))
COMPREPLY+=($(compgen -W "${long[*]}" -- "$cur"))
fi
} &&
complete -F _swaymsg swaymsg