aboutsummaryrefslogtreecommitdiff
path: root/completions/bash/sway
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2018-07-30 13:11:20 -0400
committerGitHub <noreply@github.com>2018-07-30 13:11:20 -0400
commit878d1ddd07b5ce452d3d7e1606f20f8560f2f11b (patch)
tree742714aeaff5118afabf0cb2179040655510e9df /completions/bash/sway
parent6c30b3fcc89c4965b950c8bab6fe0c45425e5a2c (diff)
parentb9d531b3181a0877ea3b94d5f9aa5877bbddeb1b (diff)
Merge pull request #2387 from 1ace/feature/bash-completion
bash completion
Diffstat (limited to 'completions/bash/sway')
-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