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.456 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
7befbcc @falconindy Revert "bash_completion: enable/save/disable extglob setting"
authored
8 # nullglob avoids problems when no results are found
9204606 @lolilolicon [[ -o optname ]] is for `set' not `shopt'
lolilolicon authored
9 shopt -q nullglob || { shopt -s nullglob; ng=1; }
3be8515 @falconindy completion: rename to remove superfluous prefix
authored
10
3c1b7c5 @falconindy add --format option for custom output
authored
11 opts="-d --download -i --info -m --msearch -s --search -u --update -c --color
3d355d3 @falconindy add --format support for extended package info
authored
12 -f --force --format -h --help --ignore --ignorerepo --listdelim --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
7befbcc @falconindy Revert "bash_completion: enable/save/disable extglob setting"
authored
36 # restore nullglob setting
3be8515 @falconindy completion: rename to remove superfluous prefix
authored
37 [[ $ng ]] && shopt -u nullglob
38
39 }
40
688c423 @falconindy bash_completion: remove nospace option
authored
41 complete -F _cower cower
Something went wrong with that request. Please try again.