From f5effec0e53c3746f81421c833ef3efff874af39 Mon Sep 17 00:00:00 2001 From: caine Date: Mon, 13 Jun 2011 18:53:16 -0400 Subject: [PATCH] clients/python: Make ignore patterns into a command-line flag. Change-Id: I51f65aee97a8187df303a854d53270da12c4aa7c --- clients/python/camliclient.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/clients/python/camliclient.py b/clients/python/camliclient.py index 08ce728e4..f70aebd8c 100755 --- a/clients/python/camliclient.py +++ b/clients/python/camliclient.py @@ -62,7 +62,6 @@ def upload_dir(op, root_path, recursive=True, ignore_patterns=[r'^\..*']): Returns: Exit code. """ - # TODO: Make ignore patterns into a command-line flag. def should_ignore(dirname): for pattern in ignore_patterns: if re.match(pattern, dirname): @@ -143,6 +142,9 @@ Commands: parser.add_option('-d', '--debug', dest='debug', action='store_true', help='print debug logging') + parser.add_option('-i', '--ignore_patterns', dest="ignore_patterns", + default="", + help='regexp patterns to ignore') def error_and_exit(message): print >>sys.stderr, message, '\n' @@ -161,9 +163,9 @@ Commands: command = args[0].lower() if command == 'putdir': - if len(args) != 2: - error_and_exit('Must supply directory to put') - return upload_dir(op, args[1]) + if len(args) < 2: + error_and_exit('Must supply at least a directory to put') + return upload_dir(op, args[1], opts.ignore_patterns) elif command == 'put': if len(args) < 2: error_and_exit('Must supply one or more file paths to upload')