Mercurial > public > mercurial-scm > evolve
comparison 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 |
comparison
equal
deleted
inserted
replaced
3375:1cb549cd6236 | 3376:aad37ffd7d58 |
---|---|
1 import sys | |
2 | |
3 formatted_args = [] | |
4 | |
5 UNSAFE_CHARACTERS = [" ", "!", "\"", "#", "$", "&", "'", "(", ")", "*", ",", ";", "<", ">", "?", "[", "\\", "]", "^", "`", "{", "|", "}", ":", "~", "/"] | |
6 | |
7 | |
8 def find_unsafe(arg): | |
9 for unsafe in UNSAFE_CHARACTERS: | |
10 if unsafe in arg: | |
11 return True | |
12 | |
13 return False | |
14 | |
15 | |
16 for arg in sys.argv[1:]: | |
17 if find_unsafe(arg): | |
18 formatted_args.append('"%s"' % arg) | |
19 else: | |
20 formatted_args.append(arg) | |
21 | |
22 print("$ " + " ".join(formatted_args)) |