Mercurial > evolve
view docs/tutorial/testlib/arguments_printer.py @ 4298:a98fa6c0d4f3
split: only accept explicit revision through the `-r` option
We are about to introduce new non-optionnal arguments to defines files
patterns. To avoid confusion and to be closer to the standard options, only
accepts revisions with the `-r` option.
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Wed, 21 Feb 2018 12:39:17 +0100 |
parents | aad37ffd7d58 |
children |
line wrap: on
line source
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))