diff docs/tutorial/testlib/arguments_printer.py @ 3376:aad37ffd7d58

doc: import the training support Import the training support which was stored in a private-repository before.
author Boris Feld <boris.feld@octobus.net>
date Mon, 08 Jan 2018 11:46:53 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/tutorial/testlib/arguments_printer.py	Mon Jan 08 11:46:53 2018 +0100
@@ -0,0 +1,22 @@
+import sys
+
+formatted_args = []
+
+UNSAFE_CHARACTERS = [" ", "!", "\"", "#", "$", "&", "'", "(", ")", "*", ",", ";", "<", ">", "?", "[", "\\", "]", "^", "`", "{", "|", "}", ":", "~", "/"]
+
+
+def find_unsafe(arg):
+    for unsafe in UNSAFE_CHARACTERS:
+        if unsafe in arg:
+            return True
+
+    return False
+
+
+for arg in sys.argv[1:]:
+    if find_unsafe(arg):
+        formatted_args.append('"%s"' % arg)
+    else:
+        formatted_args.append(arg)
+
+print("$ " + " ".join(formatted_args))