summaryrefslogtreecommitdiff
path: root/bash-completion
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-10-30 03:24:40 -0500
committerJeff Carr <[email protected]>2024-10-30 03:24:40 -0500
commitb129e1b1de8c4a87cfdfad5ab1e9cf693eb298ab (patch)
tree11c7b8920033d89ed21b854b29da55e42ca49ca3 /bash-completion
parent910d3070f39ea9c1fa2d45204acef9c98c41dc81 (diff)
attempt bash completion, but it doesn't work
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'bash-completion')
-rw-r--r--bash-completion44
1 files changed, 44 insertions, 0 deletions
diff --git a/bash-completion b/bash-completion
new file mode 100644
index 0000000..4384694
--- /dev/null
+++ b/bash-completion
@@ -0,0 +1,44 @@
+#/usr/bin/env bash
+
+VIRTIGOCTL1="
+ git
+ uptime
+ dc
+"
+
+declare -A VIRTIGOCTL_COMP
+VIRTIGOCTL_COMP[git]="
+ push
+ log
+"
+VIRTIGOCTL_COMP[start]="foo.wit.com boo.wit.com"
+
+_git_cc() { COMPREPLY=(-a -b); }
+_git_wit() { COMPREPLY=(dump-droplets start filename); }
+
+# complete -F _wit_complete wit
+
+_virtigoctl_complete()
+{
+ local cur prev
+
+ COMPREPLY=()
+ cur=${COMP_WORDS[COMP_CWORD]}
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ if [ $COMP_CWORD -eq 1 ]; then
+ COMPREPLY=( $(compgen -W "$VIRTIGOCTL1" -- $cur) )
+ elif [ $COMP_CWORD -eq 2 ]; then
+ case "$prev" in
+ "screen")
+ COMPREPLY=( $(compgen -W "reattach" -- $cur) )
+ ;;
+ *)
+ COMPREPLY=( $(compgen -W "${VIRTIGOCTL_COMP[$prev]}" -- $cur) )
+ ;;
+ esac
+ fi
+
+ return 0
+}
+complete -F _virtigoctl_complete wit