mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 12:53:13 +00:00
abbr.fish: escape the output of abbr --show
Allows abbreviations containing embedded newlines, etc., to be displayed and exported properly. Work on #731.
This commit is contained in:
parent
206ea15b68
commit
14fa48864a
1 changed files with 7 additions and 1 deletions
|
@ -100,7 +100,9 @@ function abbr --description "Manage abbreviations"
|
||||||
|
|
||||||
case 'show'
|
case 'show'
|
||||||
for i in $fish_user_abbreviations
|
for i in $fish_user_abbreviations
|
||||||
echo abbr -a \'$i\'
|
# Disable newline splitting
|
||||||
|
set -lx IFS ''
|
||||||
|
echo abbr -a \'(__fish_abbr_escape $i)\'
|
||||||
end
|
end
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
@ -114,6 +116,10 @@ function abbr --description "Manage abbreviations"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function __fish_abbr_escape
|
||||||
|
echo $argv | sed -e s,\\\\,\\\\\\\\,g -e s,\',\\\\\',g
|
||||||
|
end
|
||||||
|
|
||||||
function __fish_abbr_get_by_key
|
function __fish_abbr_get_by_key
|
||||||
if not set -q argv[1]
|
if not set -q argv[1]
|
||||||
echo "__fish_abbr_get_by_key: expected one argument, got none" >&2
|
echo "__fish_abbr_get_by_key: expected one argument, got none" >&2
|
||||||
|
|
Loading…
Reference in a new issue