implement string escape --style=xxx

We need a way to encode arbitrary strings into valid fish variable
names. It would also be nice if we could convert strings to valid URLs
without using the slow and hard to understand `__fish_urlencode` function.
In particular, eliminating the need to manipulate the locale.

Fixes #4150
This commit is contained in:
Kurtis Rader
2017-06-20 21:55:16 -07:00
parent 30368d5526
commit 60bca14b37
8 changed files with 263 additions and 34 deletions

View File

@@ -5,7 +5,7 @@ string match: ^
# string invalidarg
string: Subcommand 'invalidarg' is not valid
Standard input (line 183):
Standard input (line 215):
string invalidarg; and echo "unexpected exit 0" >&2
^
@@ -29,6 +29,6 @@ string repeat: Expected argument
# string repeat -l fakearg 2>&1
string repeat: Unknown option '-l'
Standard input (line 284):
Standard input (line 316):
string repeat -l fakearg
^