From 02ae926c8e29ed55ab0ff156a75aed9e0b7d26da Mon Sep 17 00:00:00 2001 From: Wilke Schwiedop Date: Sun, 15 Apr 2018 20:52:51 +0200 Subject: [PATCH] remove sed (and awk) from gentoo-portage completions --- share/functions/__fish_portage_print_repository_names.fish | 2 +- share/functions/__fish_portage_print_repository_paths.fish | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/share/functions/__fish_portage_print_repository_names.fish b/share/functions/__fish_portage_print_repository_names.fish index 47e204570..336567ff4 100644 --- a/share/functions/__fish_portage_print_repository_names.fish +++ b/share/functions/__fish_portage_print_repository_names.fish @@ -1,4 +1,4 @@ function __fish_portage_print_repository_names --description 'Print the names of all configured repositories' # repos.conf may be a file or a directory - find /etc/portage/repos.conf -type f -exec sed -ne '/^[[:blank:]]*\[[[:alnum:]_][[:alnum:]_-]*\]/{s!^.*\[\(.*\)\].*$!\1!; /DEFAULT/!p}' '{}' + + find /etc/portage/repos.conf -type f -exec cat '{}' + | string replace -r --filter '^\s*\[([[:alnum:]_][[:alnum:]_-]*)\]' '$1' | string match -v -e DEFAULT end diff --git a/share/functions/__fish_portage_print_repository_paths.fish b/share/functions/__fish_portage_print_repository_paths.fish index cfe23f715..48dd738a5 100644 --- a/share/functions/__fish_portage_print_repository_paths.fish +++ b/share/functions/__fish_portage_print_repository_paths.fish @@ -1,4 +1,4 @@ function __fish_portage_print_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 awk 'BEGIN { FS="[[:blank:]]*=[[:blank:]]*" } $1 == "location" { print $2 }' '{}' + + find /etc/portage/repos.conf -type f -exec cat '{}' + | string replace -r --filter '^\s*location\s*=\s*(\S+)' '$1' end