docs/tutorial/testlib/arguments_printer.py
author Gerald Squelart <gsquelart@mozilla.com>
Thu, 06 Sep 2018 23:24:26 -0400
branchstable
changeset 4089 ecd90548a10d
parent 3376 aad37ffd7d58
permissions -rw-r--r--
stablerange: only issue the message once There is a flag to prevent issuing the long load message multiple time. However, it was never set. This is now fixed

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))