summaryrefslogtreecommitdiff
path: root/bin/bash-completion.in
diff options
context:
space:
mode:
authorPetr Mladek <pmladek@suse.cz>2011-07-08 12:01:56 +0200
committerPetr Mladek <pmladek@suse.cz>2011-07-11 20:30:31 +0200
commit8124bdf39b719c66e61355c0bc64f8235c4fbec0 (patch)
treea7a8f52492191bdea7e142358698fab5a2081817 /bin/bash-completion.in
parent19111fe556a28befac2bc364fd4d8b5ec5c8c348 (diff)
better support for distro packaging
This is port from the build repo. The main differences are: + splits package-ooo into several scripts (bin/distro-install-*) + renames many variables to avoid OOO prefix and to better fit the variables produced by the current bootstrap configure.in + uses OOO_VENDOR from bootstrap/configure.in to add distro specific hacks; the conditions have been updated only for "Novell, inc." + install most of the desktop integration from sysui using sysui/desktop/share/create_tree.sh + do not install two extra templates: $OOINSTBASE/basis$VERSION/share/template/en-US/forms/resume.ott $OOINSTBASE/basis$VERSION/share/template/en-US/officorr/project-proposal.ott should get merged with other templates + do not install pyunorc-update64; it is needed only when you want to run 32-bit LO on 64-bit system; is anyone using it? + do not call install-dictionaries: + do not call build-galleries: is anyone using them? + do not install ootool and ooconfig is anyone using them? are they still working? Signed-off-by: Michael Meeks <michael.meeks@novell.com> Signed-off-by: Miklos Vajna <vmiklos@frugalware.org> Signed-off-by: Bjoern Michaelsen <bjoern.michaelsen@gmail.com>
Diffstat (limited to 'bin/bash-completion.in')
-rw-r--r--bin/bash-completion.in90
1 files changed, 90 insertions, 0 deletions
diff --git a/bin/bash-completion.in b/bin/bash-completion.in
new file mode 100644
index 000000000000..77087c59316c
--- /dev/null
+++ b/bin/bash-completion.in
@@ -0,0 +1,90 @@
+# Programmable bash_completion file for the main office applications
+# It is based on /etc/profile.d/complete.bash from SUSE Linux 10.1
+
+_def=; _dir=; _file=; _nosp=
+if complete -o default _nullcommand &> /dev/null ; then
+ _def="-o default"
+ _dir="-o dirnames"
+ _file="-o filenames"
+fi
+_minusdd="-d ${_dir}"
+_minusdf="-d ${_file}"
+if complete -o nospace _nullcommand &> /dev/null ; then
+ _nosp="-o nospace"
+ _minusdd="${_nosp} ${_dir}"
+ _minusdf="${_nosp} ${_dir}"
+fi
+complete -r _nullcommand &> /dev/null
+
+# General expanding shell function
+@OFFICE_SHELL_FUNCTION@ ()
+{
+ # bash `complete' is broken because you can not combine
+ # -d, -f, and -X pattern without missing directories.
+ local c=${COMP_WORDS[COMP_CWORD]}
+ local a="${COMP_LINE}"
+ local e s g=0 cd dc t=""
+ local IFS
+
+ shopt -q extglob && g=1
+ test $g -eq 0 && shopt -s extglob
+ # Don't be fooled by the bash parser if extglob is off by default
+ cd='*-?(c)d*'
+ dc='*-d?(c)*'
+
+ case "${1##*/}" in
+@BASH_COMPLETION_SUFFIXES_CHECKS@
+ *) e='!*'
+ esac
+
+ case "$(complete -p ${1##*/} 2> /dev/null)" in
+ *-d*) ;;
+ *) s="-S/"
+ esac
+
+ IFS='
+'
+ case "$c" in
+ \$\(*\)) eval COMPREPLY=\(${c}\) ;;
+ \$\(*) COMPREPLY=($(compgen -c -P '$(' -S ')' -- ${c#??})) ;;
+ \`*\`) eval COMPREPLY=\(${c}\) ;;
+ \`*) COMPREPLY=($(compgen -c -P '\`' -S '\`' -- ${c#?})) ;;
+ \$\{*\}) eval COMPREPLY=\(${c}\) ;;
+ \$\{*) COMPREPLY=($(compgen -v -P '${' -S '}' -- ${c#??})) ;;
+ \$*) COMPREPLY=($(compgen -v -P '$' -- ${c#?})) ;;
+ \~*/*) COMPREPLY=($(compgen -f -X "$e" -- ${c})) ;;
+ \~*) COMPREPLY=($(compgen -u ${s} -- ${c})) ;;
+ *@*) COMPREPLY=($(compgen -A hostname -P '@' -S ':' -- ${c#*@})) ;;
+ *[*?[]*) COMPREPLY=($(compgen -G "${c}")) ;;
+ *[?*+\!@]\(*\)*)
+ if test $g -eq 0 ; then
+ COMPREPLY=($(compgen -f -X "$e" -- $c))
+ test $g -eq 0 && shopt -u extglob
+ return
+ fi
+ COMPREPLY=($(compgen -G "${c}")) ;;
+ *)
+ if test "$c" = ".." ; then
+ COMPREPLY=($(compgen -d -X "$e" -S / ${_nosp} -- $c))
+ else
+ for s in $(compgen -f -X "$e" -- $c) ; do
+ if test -d $s ; then
+ COMPREPLY=(${COMPREPLY[@]} $(compgen -f -X "$e" -S / -- $s))
+ elif test -z "$t" ; then
+ COMPREPLY=(${COMPREPLY[@]} $s)
+ else
+ case "$(file -b $s 2> /dev/null)" in
+ $t) COMPREPLY=(${COMPREPLY[@]} $s) ;;
+ esac
+ fi
+ done
+ fi ;;
+ esac
+ test $g -eq 0 && shopt -u extglob
+}
+
+
+complete -d -X '.[^./]*' -F @OFFICE_SHELL_FUNCTION@ ${_file} \
+@BASH_COMPLETION_OOO_APPS@
+
+unset _def _dir _file _nosp _minusdd _minusdf