mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-22 10:30:28 +08:00
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
This commit is contained in:
parent
d1bb30afae
commit
3b6d8756ea
|
@ -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
|
||||
|
||||
|
|
|
@ -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 <EMAIL> 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"
|
||||
|
|
|
@ -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/')
|
||||
)
|
||||
"
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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")
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue
Block a user