Mercurial > evolve
view docs/tutorial/testlib/arguments_printer.py @ 3545:6aff754c2457
evolve: make sure we consider all cases in if-else
The part of code which is touched decides on evolution of merge changeset. We
need proper handling of each case there, so before adding logic, let's add
conditional for each case so that upcoming patches are easy to understand.
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Sun, 18 Mar 2018 01:27:02 +0530 |
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))