[irstlm] 67/146: Added a script for bash completion file generation.
Giulio Paci
giuliopaci-guest at moszumanska.debian.org
Tue May 17 07:37:09 UTC 2016
This is an automated email from the git hooks/post-receive script.
giuliopaci-guest pushed a commit to branch master
in repository irstlm.
commit dca98a80f7075bcd3cf9e582dce1f72968c9a7e8
Author: Giulio Paci <giuliopaci at gmail.com>
Date: Sun Jan 13 03:41:28 2013 +0100
Added a script for bash completion file generation.
---
debian/scripts/update_completion | 68 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 68 insertions(+)
diff --git a/debian/scripts/update_completion b/debian/scripts/update_completion
new file mode 100755
index 0000000..6bdbc91
--- /dev/null
+++ b/debian/scripts/update_completion
@@ -0,0 +1,68 @@
+#!/bin/bash
+
+
+BINNAMES=""
+BINNAMES=$(find debian/irstlm/usr/lib/irstlm/bin/ -type f | sed -e 's#^.*/##' -e 's/[.]\(sh\|pl\)$//g' | tr "\n" " ")
+
+cat<<EOF
+# Debian GNU/Linux irstlm completion
+# Copyright 2013 Giulio Paci <giuliopaci at gmail.com>
+# License LGPL-2.1+
+
+_irstlm_get_cmds()
+{
+ echo "help $BINNAMES";
+}
+
+_irstlm()
+{
+ local cur conns
+
+ [ -r /etc/ppp/peers/ ] || return 0
+
+ COMPREPLY=()
+ cur=\${COMP_WORDS[\$COMP_CWORD]}
+
+ if [ \$COMP_CWORD -eq 1 ]; then
+ conns="\$(_irstlm_get_cmds)"
+ COMPREPLY=( \$(compgen -o filenames -W "\$conns" -- \$cur) )
+ elif [ \$COMP_CWORD -eq 2 ] && [[ \${COMP_WORDS[1]} = "help" ]]; then
+ conns="\$(_irstlm_get_cmds)"
+ COMPREPLY=( \$(compgen -o filenames -W "\$conns" -- \$cur) )
+ elif [ \$COMP_CWORD -ge 2 ] ; then
+ case \${COMP_WORDS[1]} in
+EOF
+
+find debian/irstlm/usr/lib/irstlm/bin/ -type f | while read bin
+do
+ BINNAME=$(basename "$bin" | sed -e 's/[.]\(sh\|pl\)$//g')
+ LD_LIBRARY_PATH=debian/libirstlm0/usr/lib/ "$bin" -h 2>&1 | cat > tmp/"$BINNAME"
+ cat tmp/"$BINNAME" | grep "^[[:space:]]*-" | sed -e 's/[(].*//g' -e 's/\([>]\).*/\1/g' -e 's/^[[:space:]]*\|[[:space:]]*$//g' | grep -v '^-h\([[:space:]]\|[[:space:]]*,\)' > tmp/"$BINNAME".preprocess
+ cat tmp/"$BINNAME".preprocess | sed -e 's/[[:space:]]\+[^<\[[:space:]].*$//g' > tmp/"$BINNAME".preprocess2
+ # meld tmp/"$BINNAME".preprocess tmp/"$BINNAME".preprocess2
+ COMP_TEXT=$(cat tmp/"$BINNAME".preprocess2 | sed -e 's/[[:space:]]\+.*$//g' -e 's/=.*$/=/g' -e ':repeat; s/^\(-[^|]*\)[|]\([^=]*\)\(=\?\)$/\1\3\n\2\3/g; t repeat' | tr "\n" " "; echo)
+
+ if test x"$COMP_TEXT" != x
+ then
+cat<<EOF
+ "$BINNAME")
+ COMPREPLY=( \$(compgen -o filenames -W "$COMP_TEXT" -- \$cur) )
+ ;;
+EOF
+ fi
+done
+cat<<EOF
+
+ *)
+ ;;
+ esac
+ fi
+
+ return 0
+}
+
+complete -o bashdefault -o default -o nospace -F _irstlm irstlm
+
+
+# vim:ft=sh:
+EOF
\ No newline at end of file
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/irstlm.git
More information about the debian-science-commits
mailing list