Rename debmany/debmany.bash_completion for easier use of dh_install
Axel Beckert
10 years ago
11 | 11 | (Closes: #658846) |
12 | 12 | - No more swallows all exceptions (Closes: #654458) |
13 | 13 | - Correctly handle alternative dependencies (Closes: #516904) |
14 | * [debmany] | |
15 | - Install bash completion file to /etc/bash_completion.d instead of | |
16 | as example. | |
14 | * [bash_completion] | |
15 | - Install debmany bash completion file to /etc/bash_completion.d | |
16 | instead of as example. Rename it for easier use of dh_install. | |
17 | 17 | * Thanks Jakub Wilk for many bugfix patches! |
18 | 18 | |
19 | 19 | -- |
0 | debmany/bash_completion/debmany etc/bash_completion.d |
32 | 32 | # Add here commands to install the package into debian/debian-goodies. |
33 | 33 | install -d $(CURDIR)/debian/debian-goodies/usr/bin |
34 | 34 | install -d $(CURDIR)/debian/debian-goodies/usr/sbin |
35 | install -d $(CURDIR)/debian/debian-goodies/etc/bash_completion.d | |
36 | 35 | install -m 755 dgrep dglob debget dpigs debman popbugs which-pkg-broke \ |
37 | 36 | dhomepage $(CURDIR)/debian/debian-goodies/usr/bin |
38 | 37 | install -m 755 checkrestart \ |
42 | 41 | done |
43 | 42 | install -m 755 debmany/debmany \ |
44 | 43 | $(CURDIR)/debian/debian-goodies/usr/bin |
45 | install -m 644 debmany/debmany.bash_completion \ | |
46 | $(CURDIR)/debian/debian-goodies/etc/bash_completion.d/debmany | |
47 | 44 | |
48 | 45 | # Build architecture-dependent files here. |
49 | 46 | # We have nothing to do by default. |
59 | 56 | debmany/man/debmany.1 debmany/man/debmany.de.1 |
60 | 57 | # dh_undocumented |
61 | 58 | dh_installchangelogs |
59 | dh_install | |
62 | 60 | dh_link |
63 | 61 | dh_compress |
64 | 62 | ln -s dgrep.1.gz debian/debian-goodies/usr/share/man/man1/degrep.1.gz |
0 | # debmany(1) completion | |
1 | # | |
2 | # Copy this file to ~/.bash_completion. | |
3 | # To activate bash completion for new logins configure ~/.bashrc | |
4 | # or simply source /etc/bash_completion to test it. | |
5 | # After a new login completion is done for | |
6 | # all parameters, | |
7 | # packages or filenames and folders. | |
8 | # | |
9 | have debmany && | |
10 | _debmany() | |
11 | { | |
12 | local cur prev setf | |
13 | ||
14 | COMPREPLY=() | |
15 | cur=${COMP_WORDS[COMP_CWORD]} | |
16 | prev=${COMP_WORDS[COMP_CWORD-1]} | |
17 | ||
18 | case "$prev" in | |
19 | -L) if echo "$cur" | grep -q ^"[0-9][0-9]*[KMGT]*"; then | |
20 | COMPREPLY=( $( compgen -W '`echo ${cur/[KMGT]/}{K,M,G,T}`' -- "$cur" ) ) | |
21 | else | |
22 | COMPREPLY=("100K" "50M" "5G" "1T") | |
23 | fi | |
24 | ;; | |
25 | -l) # show all possible languages from /usr/share/i18n/SUPPORTED | |
26 | setf=`echo $-` # remember switch f (shell filename completion) | |
27 | set -f | |
28 | COMPREPLY=( $( compgen -W '`sed -e "s/[@_. ].*//g" -e "s/$/*/" /usr/share/i18n/SUPPORTED|sort -u`' -- "$cur" ) ) | |
29 | echo "$setf"|grep -q f || set +f # switch back if needed | |
30 | ;; | |
31 | -m) case "${cur:0:1}" in | |
32 | \"|\') local manpageviewer="${cur:1}";; | |
33 | *) local manpageviewer="$cur";; | |
34 | esac | |
35 | COMP_WORDS=(COMP_WORDS[0] "$manpageviewer") | |
36 | COMP_CWORD=1 | |
37 | _command | |
38 | ;; | |
39 | -o) case "${cur:0:1}" in | |
40 | \"|\') local otherviewer="${cur:1}";; | |
41 | *) local otherviewer="$cur";; | |
42 | esac | |
43 | COMP_WORDS=(COMP_WORDS[0] "$otherviewer") | |
44 | COMP_CWORD=1 | |
45 | _command | |
46 | ;; | |
47 | *) if [[ "$cur" == -* ]]; then | |
48 | COMPREPLY=( $( compgen -W '-? -h --help -k -g -x -m -o -L -l -v -vv -z' -- "$cur" ) ) | |
49 | else | |
50 | COMPREPLY=( $( apt-cache pkgnames "$cur" 2> /dev/null; ) ) | |
51 | if [ ${#COMPREPLY[@]} -eq 0 ] | |
52 | then | |
53 | _filedir | |
54 | fi | |
55 | fi | |
56 | ;; | |
57 | esac | |
58 | ||
59 | return 0 | |
60 | } && | |
61 | complete -F _debmany $filenames debmany |
0 | # debmany(1) completion | |
1 | # | |
2 | # Copy this file to ~/.bash_completion. | |
3 | # To activate bash completion for new logins configure ~/.bashrc | |
4 | # or simply source /etc/bash_completion to test it. | |
5 | # After a new login completion is done for | |
6 | # all parameters, | |
7 | # packages or filenames and folders. | |
8 | # | |
9 | have debmany && | |
10 | _debmany() | |
11 | { | |
12 | local cur prev setf | |
13 | ||
14 | COMPREPLY=() | |
15 | cur=${COMP_WORDS[COMP_CWORD]} | |
16 | prev=${COMP_WORDS[COMP_CWORD-1]} | |
17 | ||
18 | case "$prev" in | |
19 | -L) if echo "$cur" | grep -q ^"[0-9][0-9]*[KMGT]*"; then | |
20 | COMPREPLY=( $( compgen -W '`echo ${cur/[KMGT]/}{K,M,G,T}`' -- "$cur" ) ) | |
21 | else | |
22 | COMPREPLY=("100K" "50M" "5G" "1T") | |
23 | fi | |
24 | ;; | |
25 | -l) # show all possible languages from /usr/share/i18n/SUPPORTED | |
26 | setf=`echo $-` # remember switch f (shell filename completion) | |
27 | set -f | |
28 | COMPREPLY=( $( compgen -W '`sed -e "s/[@_. ].*//g" -e "s/$/*/" /usr/share/i18n/SUPPORTED|sort -u`' -- "$cur" ) ) | |
29 | echo "$setf"|grep -q f || set +f # switch back if needed | |
30 | ;; | |
31 | -m) case "${cur:0:1}" in | |
32 | \"|\') local manpageviewer="${cur:1}";; | |
33 | *) local manpageviewer="$cur";; | |
34 | esac | |
35 | COMP_WORDS=(COMP_WORDS[0] "$manpageviewer") | |
36 | COMP_CWORD=1 | |
37 | _command | |
38 | ;; | |
39 | -o) case "${cur:0:1}" in | |
40 | \"|\') local otherviewer="${cur:1}";; | |
41 | *) local otherviewer="$cur";; | |
42 | esac | |
43 | COMP_WORDS=(COMP_WORDS[0] "$otherviewer") | |
44 | COMP_CWORD=1 | |
45 | _command | |
46 | ;; | |
47 | *) if [[ "$cur" == -* ]]; then | |
48 | COMPREPLY=( $( compgen -W '-? -h --help -k -g -x -m -o -L -l -v -vv -z' -- "$cur" ) ) | |
49 | else | |
50 | COMPREPLY=( $( apt-cache pkgnames "$cur" 2> /dev/null; ) ) | |
51 | if [ ${#COMPREPLY[@]} -eq 0 ] | |
52 | then | |
53 | _filedir | |
54 | fi | |
55 | fi | |
56 | ;; | |
57 | esac | |
58 | ||
59 | return 0 | |
60 | } && | |
61 | complete -F _debmany $filenames debmany |