aboutsummaryrefslogtreecommitdiffstats
path: root/harvester.bash-completion
diff options
context:
space:
mode:
Diffstat (limited to 'harvester.bash-completion')
-rw-r--r--harvester.bash-completion20
1 files changed, 20 insertions, 0 deletions
diff --git a/harvester.bash-completion b/harvester.bash-completion
new file mode 100644
index 0000000..b785a63
--- /dev/null
+++ b/harvester.bash-completion
@@ -0,0 +1,20 @@
+function _harvester () {
+ local cur
+ local previous
+ local hcl_aliases_file=~/.hcl/aliases
+ local projects=$(sed 's/@//g' "$hcl_aliases_file")
+
+ COMPREPLY=()
+ cur=${COMP_WORDS[COMP_CWORD]}
+ previous=${COMP_WORDS[COMP_CWORD - 1]}
+
+ if [ "$previous" = '-p' \
+ -o "$previous" = '--project' \
+ ]; then
+ COMPREPLY=( $(compgen -W "$projects" -- $cur) )
+ fi
+
+ return 0
+}
+
+complete -F _harvester harvester