mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-30 14:53:11 +00:00
10 lines
245 B
Fish
10 lines
245 B
Fish
|
function __fish_urlencode --description "URL-encode stdin"
|
||
|
while read f
|
||
|
set lines (echo "$f" | sed -E -e 's/./\n\\0/g;/^$/d;s/\n//')
|
||
|
if [ (count $lines) -gt 0 ]
|
||
|
printf '%%%02x' "'"$lines"'" | sed -e 's/%2[fF]/\//g';
|
||
|
end
|
||
|
end
|
||
|
echo
|
||
|
end
|