mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-14 22:14:53 +00:00
parent
8e8549ef7a
commit
0abdf9eeff
1 changed files with 5 additions and 4 deletions
|
@ -1,9 +1,10 @@
|
||||||
function __fish_urlencode --description "URL-encode stdin"
|
function __fish_urlencode --description "URL-encode stdin"
|
||||||
while read f
|
set -l IFS ''
|
||||||
set lines (echo "$f" | sed -E -e 's/./\n\\0/g;/^$/d;s/\n//')
|
set -l output
|
||||||
|
while read --array --local lines
|
||||||
if [ (count $lines) -gt 0 ]
|
if [ (count $lines) -gt 0 ]
|
||||||
printf '%%%02x' "'"$lines"'" | sed -e 's/%2[fF]/\//g';
|
set output $output (printf '%%%02x' "'"$lines"'" | sed -e 's/%2[fF]/\//g')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
echo
|
echo -s $output
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue