docs/tutorial/testlib/arguments_printer.py
author Pulkit Goyal <7895pulkit@gmail.com>
Sun, 29 Apr 2018 17:54:01 +0530
changeset 3734 aae54e80c95c
parent 3376 aad37ffd7d58
permissions -rw-r--r--
evolve: store divergent nodes in evolvestate when resolving content-divergence We need to store the divergent nodes in evolvestate so that we can continue an interrupted phase divergence resolution.

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