Skip to content
Snippets Groups Projects
Commit 302094e1 authored by nimrod's avatar nimrod
Browse files

Replace messy aliases of url encode/ decode with short scripts (which are...

Replace messy aliases of url encode/ decode with short scripts (which are checked by pre-commit), use fileinput for instead of messing with redirects.
parent 0a99de18
Branches
No related tags found
No related merge requests found
......@@ -100,36 +100,6 @@ alias screenshot-cleanup='find "$HOME/Pictures" -name "Screenshot from *.png" -d
alias bell="printf '\a'"
command -v notify-send > /dev/null || alias notify-send='bell'
urlencode () {
if [ -t 0 ]
then
echo "$@" | urlencode
else
python3 -c '
from sys import stdin
from urllib.parse import quote_plus
for line in stdin.readlines():
print(quote_plus(line.strip()))
'
fi
}
# shellcheck disable=SC2120
urldecode () {
if [ -t 0 ]
then
# shellcheck disable=SC2119
echo "$@" | urldecode
else
python3 -c '
from sys import stdin
from urllib.parse import unquote_plus
for line in stdin.readlines():
print(unquote_plus(line.strip()))
'
fi
}
monitor () {
if eval "$@"
then
......
#!/usr/bin/env python3
from fileinput import input
from urllib.parse import unquote_plus as unquote
if __name__ == '__main__':
for line in input():
print(unquote(line.strip()))
#!/usr/bin/env python3
from fileinput import input
from urllib.parse import quote_plus as quote
if __name__ == '__main__':
for line in input():
print(quote(line.strip()))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment