]> gitweb.pimeys.fr Git - scripts-20-100.git/commitdiff
percent_decode quitte sans hold + option pour --follow
authorVincent Le Gallic <legallic@crans.org>
Mon, 20 Nov 2017 15:39:36 +0000 (16:39 +0100)
committerVincent Le Gallic <legallic@crans.org>
Tue, 19 Dec 2017 14:26:39 +0000 (15:26 +0100)
ftp/percent_decode.py

index 8fc51c9ef58e1f2c6ec9c64656522e9f74fab931..5621e3f5ced533d2ea0e34d2429e67e8ce52431e 100755 (executable)
@@ -16,13 +16,20 @@ import time
 red="\e[1;31m"
 nocolor="\e[0m"
 
+FOLLOW = False
+if "-f" in sys.argv:
+    FOLLOW = True
+
+run = True
 try:
-    while True:
+    while run:
         l = sys.stdin.readline()
         if l != "":
             l = urllib.unquote(l)
             if "--color" in sys.argv:
                 l = l.replace('"PUT ', '"%sPUT%s ' % (red, nocolor))
             sys.stdout.write(l)
+        elif not FOLLOW:
+            run = False
 except KeyboardInterrupt:
     pass