aboutsummaryrefslogtreecommitdiffhomepage
path: root/share/functions/__fish_urlencode.fish
blob: ab13beaa68de9909806dc7b26b9deca60cdae824 (plain)
1
2
3
4
5
6
7
8
9
10
function __fish_urlencode --description "URL-encode stdin"
	set -l IFS ''
	set -l output
	while read --array --local lines
		if [ (count $lines) -gt 0 ]
			set output $output (printf '%%%02x' "'"$lines"'" | sed -e 's/%2[fF]/\//g')
		end
	end
	echo -s $output
end