]> gitweb.pimeys.fr Git - scripts-20-100.git/commitdiff
[percent_decode] Pour colorer les PUT en rouge
authorVincent Le Gallic <legallic@crans.org>
Mon, 9 Dec 2013 00:49:19 +0000 (01:49 +0100)
committerVincent Le Gallic <legallic@crans.org>
Mon, 9 Dec 2013 00:49:19 +0000 (01:49 +0100)
percent_decode.py

index fd0e58302c7d7d78027bc7989fc356809895a747..8fc51c9ef58e1f2c6ec9c64656522e9f74fab931 100755 (executable)
@@ -12,10 +12,17 @@ import urllib
 import sys
 import time
 
+
+red="\e[1;31m"
+nocolor="\e[0m"
+
 try:
     while True:
         l = sys.stdin.readline()
         if l != "":
-            sys.stdout.write(urllib.unquote(l))
+            l = urllib.unquote(l)
+            if "--color" in sys.argv:
+                l = l.replace('"PUT ', '"%sPUT%s ' % (red, nocolor))
+            sys.stdout.write(l)
 except KeyboardInterrupt:
     pass