aboutsummaryrefslogtreecommitdiffstats
path: root/completion/be.bash
diff options
context:
space:
mode:
authorW. Trevor King <wking@drexel.edu>2009-06-21 09:22:31 -0400
committerW. Trevor King <wking@drexel.edu>2009-06-21 09:22:31 -0400
commite362eb8e722ea6c63b2addc0d4550b4a7daa55db (patch)
tree623a737acbdd95889de805fd20eb423b6fda0a9b /completion/be.bash
parent8aa307584c1e35dfde114e04ace12b7862579014 (diff)
downloadbugseverywhere-e362eb8e722ea6c63b2addc0d4550b4a7daa55db.tar.gz
Restored completion/be.bash.
Oops. I seem to have removed it in my Thu 2008-11-27 19:35:55 -0500 commit. Luckily, the version I removed was still sitting right were it belongs as /etc/bash_completion.d/be Now it will be back in the tree.
Diffstat (limited to 'completion/be.bash')
-rw-r--r--completion/be.bash39
1 files changed, 39 insertions, 0 deletions
diff --git a/completion/be.bash b/completion/be.bash
new file mode 100644
index 0000000..834bf25
--- /dev/null
+++ b/completion/be.bash
@@ -0,0 +1,39 @@
+#!/bin/bash
+# Bash completion script for be (Bugs Everywhere)
+#
+# System wide installation:
+# Copy this file to /etc/bash_completion/be
+# Per-user installation:
+# Copy this file to ~/.be-completion.sh and source it in your .bashrc:
+# source ~/.be-completion.sh
+#
+# For a good intro to Bash completion, see Steve Kemp's article
+# "An introduction to bash completion: part 2"
+# http://www.debian-administration.org/articles/317
+
+# Requires:
+# be [X Y Z] --complete
+# to print a list of available completions at that point
+_be()
+{
+ local cur prev opts
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+
+ if [ $COMP_CWORD -eq 1 ]; then
+ # no command yet, show all commands
+ COMPREPLY=( $( compgen -W "$(be --complete)" -- $cur ) )
+ else
+ # remove the first word (should be "be") for security reasons
+ unset COMP_WORDS[0]
+ # remove the current word and all later words, because they
+ # are not needed for completion.
+ for i in `seq $COMP_CWORD ${#COMP_WORDS[@]}`; do
+ unset COMP_WORDS[$i];
+ done
+ COMPREPLY=( $( compgen -W "$(be "${COMP_WORDS[@]}" --complete $cur)" -- $cur ) )
+ fi
+}
+
+complete -F _be be