diff options
author | Eric Engestrom <eric.engestrom@intel.com> | 2018-07-27 16:31:18 +0100 |
---|---|---|
committer | Eric Engestrom <eric.engestrom@intel.com> | 2018-07-30 15:56:15 +0100 |
commit | 21609f8af26b51872ef045ec75cb543835961ead (patch) | |
tree | b6177cca19310ff6b50432f879392a023e7e05a6 | |
parent | 27e89cf61dab7b92edd905a50df3429d51c65e79 (diff) |
bash: add completion for swaymsg
-rw-r--r-- | completions/bash/swaymsg | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/completions/bash/swaymsg b/completions/bash/swaymsg new file mode 100644 index 00000000..8ec90b6f --- /dev/null +++ b/completions/bash/swaymsg @@ -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 |