add bash completion thx guillomovitch
authorgc <gc>
Mon, 1 Aug 2005 21:36:52 +0000 (21:36 +0000)
committergc <gc>
Mon, 1 Aug 2005 21:36:52 +0000 (21:36 +0000)
AUTHORS
booh.bash-completion [new file with mode: 0644]

diff --git a/AUTHORS b/AUTHORS
index 5766d07..c2133be 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -7,4 +7,7 @@ i18n:
 Japanese: Masao Mutoh <mutoh foo highway bar ne bar jp>
 French: Guillaume Cottenceau
 
+bash-completion:
+guillomovitch at zarb.org
+
 some icons come from gimp
diff --git a/booh.bash-completion b/booh.bash-completion
new file mode 100644 (file)
index 0000000..1588a27
--- /dev/null
@@ -0,0 +1,39 @@
+# bash completion for booh
+
+_booh-backend()
+{
+       local cur prev
+
+       COMPREPLY=()
+       cur=${COMP_WORDS[COMP_CWORD]}
+       prev=${COMP_WORDS[COMP_CWORD-1]}
+
+       case $prev in
+               -@(s|d|-source|-destination))
+                       _filedir -d
+                       return 0
+                       ;;
+               -@(C|M|N|u|-config|-merge-config|-merge-config-newdirs|-use-config))
+                       _filedir
+                       return 0
+                       ;;
+               -@(t|-theme))
+                       COMPREPLY=( $( command ls /usr/share/booh/themes | grep "^$cur" ) )
+                       return 0
+                       ;;
+               -@(m|-mproc))
+                       COMPREPLY=( $( grep -c 'processor' /proc/cpuinfo | grep "^$cur" ) )
+                       return 0
+                       ;;
+       esac
+
+       if [[ "$cur" == -* ]]; then
+               COMPREPLY=( $( compgen -W '-h --help -V --version -n \
+                       --no-check -s --source -d --destination -t \
+                       --theme -C --config -k --config-skel -M \
+                       --merge-config -N --merge-config-newdirs -u \
+                       --use-config -S --sizes -m --mproc -g \
+                       --for-gui -v --verbose-level' -- $cur ) )
+       fi
+}
+complete -F _booh-backend booh-backend