mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-22 05:37:36 +08: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
|
@ -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 New Issue
Block a user