mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 04:43:10 +00:00
completions/portage: Fix errors with unreadable files
This could occur if a non-readable location was mentioned in one of the portage config files. Fixes #9495
This commit is contained in:
parent
cd17c1281d
commit
f9f29f0737
3 changed files with 10 additions and 5 deletions
|
@ -1,3 +1,6 @@
|
|||
function __fish_print_portage_available_pkgs --description 'Print all available packages'
|
||||
find (__fish_print_portage_repository_paths) -mindepth 2 -maxdepth 2 -type d ! '(' '(' -path '*/eclass/*' -o -path '*/metadata/*' -o -path '*/profiles/*' -o -path '*/.*/*' ')' -prune ')' -printf '%P\n'
|
||||
set -l paths (__fish_print_portage_repository_paths)
|
||||
set -q paths[1]
|
||||
or return
|
||||
find $paths -mindepth 2 -maxdepth 2 -type d ! '(' '(' -path '*/eclass/*' -o -path '*/metadata/*' -o -path '*/profiles/*' -o -path '*/.*/*' ')' -prune ')' -printf '%P\n' 2>/dev/null
|
||||
end
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
function __fish_print_portage_installed_pkgs --description 'Print all installed packages (non-deduplicated)'
|
||||
find /var/db/pkg -mindepth 2 -maxdepth 2 -type d -printf '%P\n' | string replace -r -- '-[0-9][0-9.]*.*$' ''
|
||||
find /var/db/pkg -mindepth 2 -maxdepth 2 -type d -printf '%P\n' 2>/dev/null | string replace -r -- '-[0-9][0-9.]*.*$' ''
|
||||
end
|
||||
|
|
|
@ -3,12 +3,14 @@ function __fish_print_portage_repository_paths --description 'Print the paths of
|
|||
set -l b
|
||||
set -l c /usr/share/portage/config/repos.conf
|
||||
test -d $a
|
||||
and set b (find $a -type f )
|
||||
and set b (find $a -type f 2>/dev/null)
|
||||
test -f $a
|
||||
and set b $a
|
||||
test -n "$b"
|
||||
and string match -q "[gentoo]" -- (cat $b)
|
||||
and string match -q "[gentoo]" -- (cat $b 2>/dev/null)
|
||||
and set c $b
|
||||
or set -a c $b
|
||||
cat $c | string match -g -r '^location = (.*$)'
|
||||
path is -r -- $c
|
||||
or return
|
||||
cat $c 2>/dev/null | string match -g -r '^location = (.*$)'
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue