mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-27 11:43:37 +08:00
parent
8e8549ef7a
commit
0abdf9eeff
|
@ -1,9 +1,10 @@
|
|||
function __fish_urlencode --description "URL-encode stdin"
|
||||
while read f
|
||||
set lines (echo "$f" | sed -E -e 's/./\n\\0/g;/^$/d;s/\n//')
|
||||
set -l IFS ''
|
||||
set -l output
|
||||
while read --array --local lines
|
||||
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
|
||||
echo
|
||||
echo -s $output
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user