diff options
author | 2015-09-25 13:22:09 +0200 | |
---|---|---|
committer | 2015-09-25 13:37:39 +0200 | |
commit | d591cebf4463e42569400bbcbaba5e16dcad734b (patch) | |
tree | cf38559cdc498291b4b0d077462c62861c709e3b /share | |
parent | 8abb19aaca21f1a6b0d422f8f16ab11e38389f58 (diff) |
Introduce __fish_print_pacman_repos helper
This is used in at least 4 places, all of which have a bug in that they
print "options" as a valid repo. It seems better to fix it once,
especially given that there are tons of AUR helpers and pacman wrappers,
all of which might need this info.
Diffstat (limited to 'share')
-rw-r--r-- | share/completions/cower.fish | 2 | ||||
-rw-r--r-- | share/completions/meat.fish | 2 | ||||
-rw-r--r-- | share/completions/pacman.fish | 2 | ||||
-rw-r--r-- | share/completions/pkgfile.fish | 2 | ||||
-rw-r--r-- | share/functions/__fish_print_pacman_repos.fish | 3 |
5 files changed, 7 insertions, 4 deletions
diff --git a/share/completions/cower.fish b/share/completions/cower.fish index 97817e86..743b4445 100644 --- a/share/completions/cower.fish +++ b/share/completions/cower.fish @@ -10,7 +10,7 @@ complete -c cower -f -s f -l 'force' -d 'Overwrite existing files whe complete -c cower -f -l 'format' -d 'Print formatted' complete -c cower -f -s h -l 'help' -d 'Display help and quit' complete -c cower -f -l 'ignore' -xa "(pacman -Qq)" -d 'Ignore a package upgrade' -complete -c cower -f -l 'ignorerepo' -xa "(cat /etc/pacman.conf | grep '^\[.\+\]' | sed 's/[]\[]//g')" -d 'Ignore a binary repo when checking for updates' +complete -c cower -f -l 'ignorerepo' -xa "(__fish_print_pacman_repos)" -d 'Ignore a binary repo when checking for updates' complete -c cower -f -l 'listdelim' -d 'Specify a delimiter for list formatters' complete -c cower -f -s q -l 'quiet' -d 'Output less' complete -c cower -f -s t -l 'target' -d 'Download targets to DIR' diff --git a/share/completions/meat.fish b/share/completions/meat.fish index 8e33c3c3..4af7f7a5 100644 --- a/share/completions/meat.fish +++ b/share/completions/meat.fish @@ -2,7 +2,7 @@ set -l listinstalled "(pacman -Qm | tr ' ' \t)" set -l listall "(pacman -Sl | cut --delim ' ' --fields 2- | tr ' ' \t)" -set -l listrepos "(cat /etc/pacman.conf | grep '^\[.\+\]' | sed 's/[]\[]//g')" +set -l listrepos "(__fish_print_pacman_repos)" set -l listgroups "(pacman -Sg | sed 's/\(.*\)/\1\tPackage group/g')" diff --git a/share/completions/pacman.fish b/share/completions/pacman.fish index f96cdcbf..30453cf6 100644 --- a/share/completions/pacman.fish +++ b/share/completions/pacman.fish @@ -7,7 +7,7 @@ set -l progname pacman set -l listinstalled "(pacman -Q | tr ' ' \t)" # This might be an issue if another package manager is also installed (e.g. for containers) set -l listall "(__fish_print_packages)" -set -l listrepos "(grep '^\[.\+\]' /etc/pacman.conf | sed 's/[]\[]//g')" +set -l listrepos "(__fish_print_pacman_repos)" set -l listgroups "(pacman -Sg | sed 's/\(.*\)/\1\tPackage group/g')" set -l noopt 'not __fish_contains_opt -s S -s D -s Q -s R -s U -s T database query sync remove upgrade deptest' diff --git a/share/completions/pkgfile.fish b/share/completions/pkgfile.fish index e8af0b0f..dae11771 100644 --- a/share/completions/pkgfile.fish +++ b/share/completions/pkgfile.fish @@ -4,7 +4,7 @@ complete -c pkgfile -s b -l binaries -d 'only show files in a {s}bin/ director complete -c pkgfile -s c -l case-sensitive -d 'make searches case sensitive' complete -c pkgfile -s g -l glob -d 'allow the use of * and ? as wildcards' complete -c pkgfile -s r -l regex -d 'allow the use of regex in searches' -complete -c pkgfile -s R -l repo -d 'search only in the specified repository' -xa '(cat /etc/pacman.conf|grep "^\[" | sed "s/\[\|]//g")' +complete -c pkgfile -s R -l repo -d 'search only in the specified repository' -xa '(__fish_print_pacman_repos)' complete -c pkgfile -s v -l verbose -d 'enable verbose output' complete -c pkgfile -s i -l info -d 'provides information about the package owning a file' -r complete -c pkgfile -s l -l list -d 'list files of a given package; similar to "pacman -Ql"' -xa "(pacman -Sl | cut --delim ' ' --fields 2- | tr ' ' \t | sort)" diff --git a/share/functions/__fish_print_pacman_repos.fish b/share/functions/__fish_print_pacman_repos.fish new file mode 100644 index 00000000..81fe3de5 --- /dev/null +++ b/share/functions/__fish_print_pacman_repos.fish @@ -0,0 +1,3 @@ +function __fish_print_pacman_repos --description "Print the repositories configured for arch's pacman package manager" + sed -n -e 's/\[\(.\+\)\]/\1/p' /etc/pacman.conf | grep -v "#\|options" +end |