From 81c8cd1b6150c974b05d73f6a31beb7344f93984 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Wed, 27 Dec 2023 17:08:06 +0100 Subject: [PATCH] completions: use POSIX character classes with sed \s and \S are not supported BSD sed. Fixes #10163 --- share/completions/highlight.fish | 2 +- share/completions/lsblk.fish | 2 +- share/completions/mvn.fish | 2 +- share/completions/setxkbmap.fish | 4 ++-- share/completions/status.fish | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/share/completions/highlight.fish b/share/completions/highlight.fish index 5a34862b7..ef82025ad 100644 --- a/share/completions/highlight.fish +++ b/share/completions/highlight.fish @@ -4,5 +4,5 @@ complete -c highlight -s t -l tab -d 'Specify tab length' -x complete -c highlight -s i -l input -d 'Name of the input file' -r complete -c highlight -s o -l output -d 'Name of the output file' -r complete -c highlight -s d -l outdir -d 'Output directory' -r -complete -c highlight -s S -l syntax -d 'Set type of the source code' -xa "(highlight -p | sed -r 's/^(.*\S)\s+:\s*(\S+).*\$/\2\t\1/; /^\$/d')" +complete -c highlight -s S -l syntax -d 'Set type of the source code' -xa "(highlight -p | sed -r 's/^(.*[^[:space:]])[[:space:]]+:[[:space:]]*([^[:space:]]+).*\$/\2\t\1/; /^\$/d')" complete -c highlight -s s -l style -d 'Highlight style' -xa "(highlight --list-themes | sed '/^\$\| /d')" diff --git a/share/completions/lsblk.fish b/share/completions/lsblk.fish index 5be0a9d88..21fab0c0a 100644 --- a/share/completions/lsblk.fish +++ b/share/completions/lsblk.fish @@ -1,5 +1,5 @@ function __fish_print_lsblk_columns --description 'Print available lsblk columns' - LC_ALL=C lsblk --help | sed '1,/Available .*columns:/d; /^$/,$d; s/^\s\+//; s/\s/\t/' + LC_ALL=C lsblk --help | sed '1,/Available .*columns:/d; /^$/,$d; s/^[[:space:]]\+//; s/[[:space:]]/\t/' end complete -c lsblk -s a -l all -d "print all devices" diff --git a/share/completions/mvn.fish b/share/completions/mvn.fish index 5266c3fad..499337211 100644 --- a/share/completions/mvn.fish +++ b/share/completions/mvn.fish @@ -88,7 +88,7 @@ function __fish_mvn_profiles end function __fish_mvn_projects - grep "" pom.xml 2>/dev/null | sed 's/\s*<[^<]*>\(.*\)<[^<]*>/\1/' + grep "" pom.xml 2>/dev/null | sed 's/[[:space:]]*<[^<]*>\(.*\)<[^<]*>/\1/' end complete -c mvn -f -r -o P -l activate-profiles -a "(__fish_mvn_profiles)" -d "Comma-delimited list of profiles to activate" diff --git a/share/completions/setxkbmap.fish b/share/completions/setxkbmap.fish index 390354b39..96aeed77d 100644 --- a/share/completions/setxkbmap.fish +++ b/share/completions/setxkbmap.fish @@ -1,8 +1,8 @@ function __fish_complete_setxkbmap --description 'Complete setxkb options' --argument-names what - sed -e "1,/! $what/d" -e '/^\s*$/,$d' /usr/share/X11/xkb/rules/xorg.lst | sed -r 's/\s+(\S+)\s+(.+)/\1\t\2/' + sed -e "1,/! $what/d" -e '/^[[:space:]]*$/,$d' /usr/share/X11/xkb/rules/xorg.lst | sed -r 's/[[:space:]]+([^[:space:]]+)[[:space:]]+(.+)/\1\t\2/' end -set -l filter '"s/\S+\s\S+\s(.+)\((.+)\)/\1\t\2/;"' +set -l filter '"s/[^[:space:]]+[[:space:]][^[:space:]]+[[:space:]](.+)\((.+)\)/\1\t\2/;"' complete -c setxkbmap -o '?' -o help -d 'Print this message' complete -c setxkbmap -o compat -d 'Specifies compatibility map component name' -xa "(sed -r $filter /usr/share/X11/xkb/compat.dir)" diff --git a/share/completions/status.fish b/share/completions/status.fish index 8b415c80e..dc2464e43 100644 --- a/share/completions/status.fish +++ b/share/completions/status.fish @@ -29,7 +29,7 @@ complete -f -c status -n "not __fish_seen_subcommand_from $__fish_status_all_com complete -f -c status -n "not __fish_seen_subcommand_from $__fish_status_all_commands" -a stack-trace -d "Print a list of all function calls leading up to running the current command" complete -f -c status -n "not __fish_seen_subcommand_from $__fish_status_all_commands" -a features -d "List all feature flags" complete -f -c status -n "not __fish_seen_subcommand_from $__fish_status_all_commands" -a test-feature -d "Test if a feature flag is enabled" -complete -f -c status -n "__fish_seen_subcommand_from test-feature" -a '(status features | sed "s/\s\+\S*\s\+\S*/\t/")' +complete -f -c status -n "__fish_seen_subcommand_from test-feature" -a '(status features | sed "s/[[:space:]]\+[^[:space:]]*[[:space:]]\+[^[:space:]]*/\t/")' complete -f -c status -n "not __fish_seen_subcommand_from $__fish_status_all_commands" -a fish-path -d "Print the path to the current instance of fish" # The job-control command changes fish state.