From 27e89cf61dab7b92edd905a50df3429d51c65e79 Mon Sep 17 00:00:00 2001
From: Eric Engestrom <eric.engestrom@intel.com>
Date: Fri, 27 Jul 2018 16:31:04 +0100
Subject: bash: add completion for sway

---
 completions/bash/sway | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)
 create mode 100644 completions/bash/sway

(limited to 'completions')

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
-- 
cgit v1.2.3