aboutsummaryrefslogtreecommitdiff
path: root/completions
diff options
context:
space:
mode:
authorEric Engestrom <eric.engestrom@intel.com>2018-07-27 16:31:04 +0100
committerEric Engestrom <eric.engestrom@intel.com>2018-07-30 15:56:15 +0100
commit27e89cf61dab7b92edd905a50df3429d51c65e79 (patch)
tree175ff53a8de2f3a0201eb8da953b16ec1fc9f10a /completions
parenta0dc8032e1b6bcdbe9b4056ecf30c616a42145ed (diff)
bash: add completion for sway
Diffstat (limited to 'completions')
-rw-r--r--completions/bash/sway46
1 files changed, 46 insertions, 0 deletions
diff --git a/completions/bash/sway b/completions/bash/sway
new file mode 100644
index 00000000..edd752cd
--- /dev/null
+++ b/completions/bash/sway
@@ -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