From b4ec84d8a13565cc5060e8c2a2b1f37daa9dc4ef Mon Sep 17 00:00:00 2001 From: pl3w5y <106965112+pl3w5y@users.noreply.github.com> Date: Wed, 15 Jun 2022 22:27:42 +0000 Subject: [PATCH] updated function __fish_print_portage_repository_paths.fish (#9012) * updated function __fish_print_portage_repository_paths.fish to support file, dir and modified defaults * Revised version of share/functions/__fish_print_portage_repository_paths.fish * improved syntax and regex as suggested --- .../__fish_print_portage_repository_paths.fish | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/share/functions/__fish_print_portage_repository_paths.fish b/share/functions/__fish_print_portage_repository_paths.fish index da65a6487..e2d76036a 100644 --- a/share/functions/__fish_print_portage_repository_paths.fish +++ b/share/functions/__fish_print_portage_repository_paths.fish @@ -1,4 +1,14 @@ function __fish_print_portage_repository_paths --description 'Print the paths of all configured repositories' - # repos.conf may be a file or a directory - find /etc/portage/repos.conf -type f -exec cat '{}' + | string replace -r --filter '^\s*location\s*=\s*(\S+)' '$1' + set -l a /etc/portage/repos.conf + set -l b + set -l c /usr/share/portage/config/repos.conf + test -d $a + and set b (find $a -type f ) + test -f $a + and set b $a + test -n "$b" + and string match -q "[gentoo]" -- (cat $b) + and set c $b + or set -a c $b + cat $c | string match -g -r '^location = (.*$)' end