Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 42 lines (32 sloc) 1.447 kb
3be8515 @falconindy completion: rename to remove superfluous prefix
authored
1 #!/bin/bash
2
3 _cower() {
68b6cfb @falconindy fix more bash_completion issues
authored
4 local i cur prev opts ng
3be8515 @falconindy completion: rename to remove superfluous prefix
authored
5
390e503 @falconindy clean up completion file
authored
6 _get_comp_words_by_ref cur prev
3be8515 @falconindy completion: rename to remove superfluous prefix
authored
7
390e503 @falconindy clean up completion file
authored
8 # nullglob avoids problems when no results are found
9 [[ -o nullglob ]] || { shopt -s nullglob; ng=1; }
3be8515 @falconindy completion: rename to remove superfluous prefix
authored
10
33053a8 @falconindy bash_completion: cleanup, add missing options
authored
11 opts="-d --download -i --info -m --msearch -s --search -u --update
f636c8f @falconindy add --nossl option to avoid use of ssl connections
authored
12 -c --color -f --force -h --help --ignore --ignorerepo --nossl
13 -q --quiet -t --target --threads -v --verbose --debug"
3be8515 @falconindy completion: rename to remove superfluous prefix
authored
14
68b6cfb @falconindy fix more bash_completion issues
authored
15 n=${#COMP_WORDS[@]}
16
5225bbf @falconindy bash_completion: style cleanup
authored
17 if [[ "$cur" = -* ]]; then # options
390e503 @falconindy clean up completion file
authored
18 COMPREPLY=($(compgen -W "$opts" -- $cur))
5225bbf @falconindy bash_completion: style cleanup
authored
19 elif [[ "$prev" = @(-*t|--target) ]]; then # directories (taken from _cd)
862b8b2 @falconindy fix bash_completion issues
authored
20 compgen -f /non-existing-dir/ >/dev/null
21 _filedir -d
22 if (( ${#COMPREPLY[@]} == 1 )); then
23 i=${COMPREPLY[0]}
5225bbf @falconindy bash_completion: style cleanup
authored
24 [[ "$i" = $cur && "$i" != */ ]] && COMPREPLY[0]="${i}/"
862b8b2 @falconindy fix bash_completion issues
authored
25 fi
54fd3d4 @falconindy bash_completion: add completion for --ignore
authored
26 elif [[ "$prev" = --ignore ]]; then
27 COMPREPLY=($(compgen -W "$(pacman -Qq)" -- $cur))
5225bbf @falconindy bash_completion: style cleanup
authored
28 elif [[ "$prev" = --ignorerepo ]]; then
28f774c @falconindy bash_completion: add completion for --ignorerepo
authored
29 COMPREPLY=($(compgen -W "$(sed '/^\[\(.*\)\]$/!d;s//\1/;/options/d' /etc/pacman.conf)" -- $cur))
5225bbf @falconindy bash_completion: style cleanup
authored
30 elif [[ "${COMP_WORDS[@]:1:n-2}" = *-@(!(-*)@(u)*|-update)* ]]; then # local packages
8bd56b3 @falconindy fix bash_completion
authored
31 COMPREPLY=($(compgen -W "$(pacman -Qqm)" -- $cur))
5225bbf @falconindy bash_completion: style cleanup
authored
32 elif [[ "${COMP_WORDS[@]:1:n-2}" = *-@(!(-*)@(d|i)*|-download|-info)* ]]; then # aur packages
68b6cfb @falconindy fix more bash_completion issues
authored
33 COMPREPLY=($(compgen -W "$("${COMP_WORDS[0]}" -sq -- ^$cur 2>/dev/null)" -- $cur))
451d881 @falconindy bash_completion: complete package names anywhere as long as -d or -i is ...
authored
34 fi
3be8515 @falconindy completion: rename to remove superfluous prefix
authored
35
53b0fab @falconindy bash_completion: bugfix. dont let completion returns without resetting n...
authored
36 # restore nullglob setting
3be8515 @falconindy completion: rename to remove superfluous prefix
authored
37 [[ $ng ]] && shopt -u nullglob
38
39 }
40
862b8b2 @falconindy fix bash_completion issues
authored
41 complete -F _cower -o nospace cower
Something went wrong with that request. Please try again.