Add a script that can be source by a shell to do bash completion.
Signed-off-by: David Howells <dhowells@redhat.com>
--- /dev/null
+# -*- sh -*-
+# bash completion script for AFS tools
+#
+# To use these routines:
+#
+# 1. Copy this file to somewhere (e.g. ~/.kafs-completion.bash).
+#
+# 2. Add the following line to your .bashrc:
+# . ~/.kafs-completion.bash
+
+_afs () {
+ COMPREPLY=($(kafs --complete $COMP_CWORD "${COMP_WORDS[@]}"))
+
+ case "${COMPREPLY[0]}" in
+ @HOSTNAME@)
+ COMPREPLY=($(compgen -A hostname -- "${COMP_WORDS[$COMP_CWORD]}"))
+ ;;
+ @VOLNAME@|@PARTID@|@FILE@|@OTHER@)
+ COMPREPLY=($(compgen -A file -- "${COMP_WORDS[$COMP_CWORD]}"))
+ ;;
+ esac
+}
+
+complete -o bashdefault -o default -F _afs afs bos pts vos