diff options
author | David Paleino <dapal@debian.org> | 2011-04-10 11:47:12 +0200 |
---|---|---|
committer | David Paleino <dapal@debian.org> | 2011-04-10 11:55:07 +0200 |
commit | dfc80b9aff94d9f1e7f5dc09a854923414c8d99f (patch) | |
tree | 37a34932e81ab2bdfd2ee594691b9f502236991e /debian/extra | |
parent | 9116315b351ff2285abce3655fa23b011b8428d2 (diff) | |
download | bash-completion-dfc80b9aff94d9f1e7f5dc09a854923414c8d99f.tar.gz |
Remove get-completions, and improve the overall code. Now it *is* SPEEDY.
Diffstat (limited to 'debian/extra')
-rwxr-xr-x | debian/extra/get-completions | 16 | ||||
-rwxr-xr-x | debian/extra/update-bash-completion | 7 |
2 files changed, 5 insertions, 18 deletions
diff --git a/debian/extra/get-completions b/debian/extra/get-completions deleted file mode 100755 index 0fe21b4d..00000000 --- a/debian/extra/get-completions +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -commands=$(compgen -c) - -for c in $commands; do - line=$(grep -w -F $c $1) - if [ -n "$line" ]; then - comp=$(echo $line | cut -d: -f1) - val=$(echo -n $line | cut -d: -f2 | tr ' ' '|') - fixedval=$(printf "%s|\n" $val) - - if [ -n "$(echo $fixedval | grep "$c|")" ]; then - echo $comp - fi - fi -done diff --git a/debian/extra/update-bash-completion b/debian/extra/update-bash-completion index 0ca9e7c7..e6bb946c 100755 --- a/debian/extra/update-bash-completion +++ b/debian/extra/update-bash-completion @@ -1,6 +1,5 @@ #!/bin/bash -GET_COMP=/usr/share/bash-completion/get-completions COMPDICT=/usr/share/bash-completion/compdict COMPDIR=/usr/share/bash-completion RUNCOMPDIR=/etc/bash_completion.d/triggered @@ -19,9 +18,13 @@ elif [ "$1" == "clean" ]; then rm -rf $RUNCOMPDIR/* fi +commands=$(compgen -f /usr/bin/ ; compgen -f /usr/sbin/ ; compgen -f /usr/games/ ; compgen -f /bin/ ; compgen -f /sbin/) +commands=$(echo $commands | sed 's, /[^ ]*/,|\n,g;s,/[^ ]*/,,;s,$,|,') echo -n "bash-completion: updating completion symlinks... " -for c in $($GET_COMP $COMPDICT | sort -u); do +completions=$(grep -w -F "$commands" $COMPDICT | cut -d: -f1 | sort -u) + +for c in $completions; do [ -L "$RUNCOMPDIR/${c##*/}" ] || ln -s $COMPDIR/$c $RUNCOMPDIR/ done echo "done." |