completions: use POSIX character classes with sed

\s and \S are not supported BSD sed.

Fixes #10163

(cherry picked from commit 81c8cd1b61)
This commit is contained in:
Johannes Altmanninger 2023-12-27 17:08:06 +01:00 committed by David Adam
parent bfe47e5979
commit dc90093f8b
5 changed files with 6 additions and 6 deletions

View File

@ -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')"

View File

@ -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"

View File

@ -88,7 +88,7 @@ function __fish_mvn_profiles
end
function __fish_mvn_projects
grep "<module>" pom.xml 2>/dev/null | sed 's/\s*<[^<]*>\(.*\)<[^<]*>/\1/'
grep "<module>" 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"

View File

@ -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)"

View File

@ -27,7 +27,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.