mirror of
https://github.com/swaywm/sway.git
synced 2024-12-28 07:56:31 +01:00
b7fe5097e9
This new option forces pretty (non-raw/non-JSON) output. By default, when not using a tty, swaymsg outputs using the "raw" format. This makes it impossible to, for example, pipe the pretty output to a pager such as `less` since piping does not use a tty. The new -p/--pretty option gives the user explicit control over the output format while retaining the default tty-dependent behavior. Signed-off-by: Peter Grayson <pete@jpgrayson.net>
61 lines
874 B
Text
61 lines
874 B
Text
# 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_binding_modes'
|
|
'get_config'
|
|
'send_tick'
|
|
)
|
|
|
|
short=(
|
|
-h
|
|
-p
|
|
-q
|
|
-r
|
|
-s
|
|
-t
|
|
-v
|
|
)
|
|
|
|
long=(
|
|
--help
|
|
--pretty
|
|
--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
|