2b6e7849cfce

Make urlendecode into real scripts
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Tue, 09 Oct 2018 10:02:46 -0700
parents 51b9c5b3b301
children fd3857844a99
branches/tags (none)
files bin/urldecode bin/urlencode fish/functions/urldecode.fish fish/functions/urlencode.fish

Changes

--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/urldecode	Tue Oct 09 10:02:46 2018 -0700
@@ -0,0 +1,7 @@
+#!/usr/bin/env python
+
+import sys, urllib
+
+input = sys.stdin.read() if len(sys.argv) == 1 or sys.argv[1] == "-" else sys.argv[1]
+
+print urllib.unquote_plus(input)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/urlencode	Tue Oct 09 10:02:46 2018 -0700
@@ -0,0 +1,7 @@
+#!/usr/bin/env python
+
+import sys, urllib
+
+input = sys.stdin.read() if len(sys.argv) == 1 or sys.argv[1] == "-" else sys.argv[1]
+
+print urllib.quote_plus(input)
--- a/fish/functions/urldecode.fish	Mon Oct 08 16:34:42 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-function urldecode -d "Urldecode the input into plaintext output"
-    python -c "import sys, urllib as ul; print ul.unquote_plus(sys.argv[1])" $argv
-end
--- a/fish/functions/urlencode.fish	Mon Oct 08 16:34:42 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,4 +0,0 @@
-function urlencode -d "Urlencode the plaintext input"
-    python -c "import sys, urllib as ul; print ul.quote_plus(sys.argv[1]);" $argv
-end
-