mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-04 15:51:15 -03: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:
@@ -100,7 +100,9 @@ function abbr --description "Manage abbreviations"
|
||||
|
||||
case 'show'
|
||||
for i in $fish_user_abbreviations
|
||||
echo abbr -a \'$i\'
|
||||
# Disable newline splitting
|
||||
set -lx IFS ''
|
||||
echo abbr -a \'(__fish_abbr_escape $i)\'
|
||||
end
|
||||
return 0
|
||||
|
||||
@@ -114,6 +116,10 @@ function abbr --description "Manage abbreviations"
|
||||
end
|
||||
end
|
||||
|
||||
function __fish_abbr_escape
|
||||
echo $argv | sed -e s,\\\\,\\\\\\\\,g -e s,\',\\\\\',g
|
||||
end
|
||||
|
||||
function __fish_abbr_get_by_key
|
||||
if not set -q argv[1]
|
||||
echo "__fish_abbr_get_by_key: expected one argument, got none" >&2
|
||||
|
||||
Reference in New Issue
Block a user