From 3b6d8756eaad427743bf1830a37dbdc7dab9f2d0 Mon Sep 17 00:00:00 2001 From: axel Date: Thu, 2 Mar 2006 21:28:08 +1000 Subject: [PATCH] Fix various uses of the GNUism of allowing backslash escapes in the second half of a sed regexp substitution darcs-hash:20060302112808-ac50b-46cdf8e99f8f6e8cab0d54f32cf4e4d309775aa1.gz --- share/completions/apropos.fish | 2 +- share/completions/gpg.fish | 4 ++-- share/completions/mplayer.fish | 8 ++++---- share/completions/screen.fish | 2 +- share/completions/set.fish | 2 +- share/completions/vared.fish | 2 +- share/functions/__fish_complete_man.fish | 2 +- share/functions/__fish_complete_pids.fish | 4 ++-- share/functions/__fish_print_packages.fish | 4 ++-- 9 files changed, 15 insertions(+), 15 deletions(-) diff --git a/share/completions/apropos.fish b/share/completions/apropos.fish index f638fa6af..7bd398d67 100644 --- a/share/completions/apropos.fish +++ b/share/completions/apropos.fish @@ -2,7 +2,7 @@ function __fish_complete_apropos if test (commandline -ct) set str (commandline -ct) - apropos $str|sed -e "s/^\(.*$str\([^ ]*\).*\)$/$str\2\t\1/" + apropos $str|sed -e "s/^\(.*$str\([^ ]*\).*\)$/$str\2"\t"\1/" end end diff --git a/share/completions/gpg.fish b/share/completions/gpg.fish index e847c4dfb..41d48e96f 100644 --- a/share/completions/gpg.fish +++ b/share/completions/gpg.fish @@ -23,12 +23,12 @@ function __fish_complete_gpg_user_id -d "Complete using gpg user ids" # gpg doesn't seem to like it when you use the whole key name as a # completion, so we skip the part and use it a s a # description. - gpg --list-keys --with-colon|cut -d : -f 10|sed -ne 's/\(.*\) <\(.*\)>/\1\t\2/p' + gpg --list-keys --with-colon|cut -d : -f 10|sed -ne 's/\(.*\) <\(.*\)>/\1'\t'\2/p' end function __fish_complete_gpg_key_id -d 'Complete using gpg key ids' # Use user_id as the description - gpg --list-keys --with-colons|cut -d : -f 5,10|sed -ne "s/\(.*\):\(.*\)/\1\t\2/p" + gpg --list-keys --with-colons|cut -d : -f 5,10|sed -ne "s/\(.*\):\(.*\)/\1'\t'\2/p" end function __fish_print_gpg_algo -d "Complete using all algorithms of the type specified in argv[1] supported by gpg. argv[1] is a regexp" diff --git a/share/completions/mplayer.fish b/share/completions/mplayer.fish index dd0325157..c2fbf252a 100644 --- a/share/completions/mplayer.fish +++ b/share/completions/mplayer.fish @@ -57,25 +57,25 @@ complete -c mplayer -o utf8 -d (N_ "Handle subtitlefile as utf8") complete -c mplayer -o vo -x -d (N_ "Video output") -a " ( - mplayer -vo help|grep \t.\*\t'\|^ *[a-zA-Z0-9][a-zA-Z0-9]* '|sed -e 's/[\t ]*\([a-zA-Z0-9]*\)[\t ]*\(.*\)/\1\t\2/' + mplayer -vo help|grep \t.\*\t'\|^ *[a-zA-Z0-9][a-zA-Z0-9]* '|sed -e 's/[\t ]*\([a-zA-Z0-9]*\)[\t ]*\(.*\)/\1'\t'\2/' ) " complete -c mplayer -o ao -x -d (N_ "Audio output") -a " ( - mplayer -ao help|grep \t.\*\t'\|^ *[a-zA-Z0-9][a-zA-Z0-9]* '|sed -e 's/[\t ]*\([a-zA-Z0-9]*\)[\t ]*\(.*\)/\1\t\2/' + mplayer -ao help|grep \t.\*\t'\|^ *[a-zA-Z0-9][a-zA-Z0-9]* '|sed -e 's/[\t ]*\([a-zA-Z0-9]*\)[\t ]*\(.*\)/\1'\t'\2/' ) " complete -c mplayer -o afm -x -d (N_ "Audio output") -a " ( - __fish_append ',' (mplayer -afm help|grep \t.\*\t'\|^ *[a-zA-Z0-9][a-zA-Z0-9]* '|sed -e 's/[\t ]*\([a-zA-Z0-9]*\)[\t ]*\(.*\)/\1\t\2/') + __fish_append ',' (mplayer -afm help|grep \t.\*\t'\|^ *[a-zA-Z0-9][a-zA-Z0-9]* '|sed -e 's/[\t ]*\([a-zA-Z0-9]*\)[\t ]*\(.*\)/\1'\t'\2/') ) " complete -c mplayer -o vfm -x -d (N_ "Video output") -a " ( - __fish_append ',' (mplayer -vfm help|grep \t.\*\t'\|^ *[a-zA-Z0-9][a-zA-Z0-9]* '|sed -e 's/[\t ]*\([a-zA-Z0-9]*\)[\t ]*\(.*\)/\1\t\2/') + __fish_append ',' (mplayer -vfm help|grep \t.\*\t'\|^ *[a-zA-Z0-9][a-zA-Z0-9]* '|sed -e 's/[\t ]*\([a-zA-Z0-9]*\)[\t ]*\(.*\)/\1'\t'\2/') ) " diff --git a/share/completions/screen.fish b/share/completions/screen.fish index e98ca51d8..32c28a06a 100644 --- a/share/completions/screen.fish +++ b/share/completions/screen.fish @@ -1,5 +1,5 @@ function __fish_complete_screen -d (N_ "Print a list of running screen sessions") - screen -list |grep \^\t.\*\(.\*\)|sed -e 's/\t\(.*\)\t(\(.*\))/\1\tScreen: \2/' + screen -list |grep \^\t.\*\(.\*\)|sed -e 's/\t\(.*\)\t(\(.*\))/\1'\t'Screen: \2/' end complete -c screen -x diff --git a/share/completions/set.fish b/share/completions/set.fish index d341bebb5..1510fbc7e 100644 --- a/share/completions/set.fish +++ b/share/completions/set.fish @@ -65,7 +65,7 @@ complete -c set -n '__fish_is_first_token' -s q -l query -d (N_ "Test if variabl complete -c set -n '__fish_is_first_token' -s h -l help -d (N_ "Display help and exit") # Complete using preexisting variable names -complete -c set -n '__fish_is_first_token' -x -a "(set|sed -e 's/ /\tVariable: /')" +complete -c set -n '__fish_is_first_token' -x -a "(set|sed -e 's/ /'\t'Variable: /')" # Color completions complete -c set -n '__fish_set_is_color' -x -a '(set_color --print-colors)' -d (N_ Color) diff --git a/share/completions/vared.fish b/share/completions/vared.fish index 2c1d86342..76b92abef 100644 --- a/share/completions/vared.fish +++ b/share/completions/vared.fish @@ -1,3 +1,3 @@ -complete -c vared -x -a "(set|sed -e 's/ /\tVariable: /')" +complete -c vared -x -a "(set|sed -e 's/ /'\t'Variable: /')" complete -c vared -s h -l help -d (N_ "Display help and exit") diff --git a/share/functions/__fish_complete_man.fish b/share/functions/__fish_complete_man.fish index fa116956e..7eb69f061 100644 --- a/share/functions/__fish_complete_man.fish +++ b/share/functions/__fish_complete_man.fish @@ -21,7 +21,7 @@ function __fish_complete_man set section $section"[^)]*" # Do the actual search - apropos (commandline -ct) | grep \^(commandline -ct) | sed -n -e 's/\([^ ]*\).*(\('$section'\)) *- */\1\t\2: /p' + apropos (commandline -ct) | grep \^(commandline -ct) | sed -n -e 's/\([^ ]*\).*(\('$section'\)) *- */\1'\t'\2: /p' end end diff --git a/share/functions/__fish_complete_pids.fish b/share/functions/__fish_complete_pids.fish index 42fcc5715..996f995fd 100644 --- a/share/functions/__fish_complete_pids.fish +++ b/share/functions/__fish_complete_pids.fish @@ -1,8 +1,8 @@ function __fish_complete_pids -d "Print a list of process identifiers along with brief descriptions" # This may be a bit slower, but it's nice - having the tty displayed is really handy - ps --no-heading -o pid,comm,tty --ppid %self -N | sed -r 's/ *([0-9]+) +([^ ].*[^ ]|[^ ]) +([^ ]+)$/\1\t\2 [\3]/' ^/dev/null + ps --no-heading -o pid,comm,tty --ppid %self -N | sed -r 's/ *([0-9]+) +([^ ].*[^ ]|[^ ]) +([^ ]+)$/\1'\t'\2 [\3]/' ^/dev/null # If the above is too slow, this is faster but a little less useful - # pgrep -l -v -P %self | sed 's/ /\t/' + # pgrep -l -v -P %self | sed 's/ /'\t'/' end diff --git a/share/functions/__fish_print_packages.fish b/share/functions/__fish_print_packages.fish index 03e523140..5c56a223f 100644 --- a/share/functions/__fish_print_packages.fish +++ b/share/functions/__fish_print_packages.fish @@ -18,7 +18,7 @@ function __fish_print_packages # 2) Remove package names that are .so files, since these seem to not correspond to actual packages as reported by rpm # 3) Remove path information such as /usr/bin/, as rpm packages do not have paths - apt-cache --no-generate pkgnames (commandline -tc)|grep -v \( |grep -v '\.so\(\.[0-9]\)*$'|sed -e 's/\/.*\///'|sed -e 's/$/\t'$package'/' + apt-cache --no-generate pkgnames (commandline -tc)|grep -v \( |grep -v '\.so\(\.[0-9]\)*$'|sed -e 's/\/.*\///'|sed -e 's/$/'\t$package'/' return end @@ -40,7 +40,7 @@ function __fish_print_packages end # Remove package version information from output and pipe into cache file - rpm -qa >$cache_file |sed -e 's/-[^-]*-[^-]*$//' | sed -e 's/$/\t'$package'/' & + rpm -qa >$cache_file |sed -e 's/-[^-]*-[^-]*$//' | sed -e 's/$/'\t$package'/' & end # This completes the package name from the portage tree.