From 3f23bb852c348ca6a676a950fb976db27dc7170b Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Tue, 19 Feb 2019 21:49:14 +0300 Subject: add option to pull individual repos --- pull/pull.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'pull') diff --git a/pull/pull.py b/pull/pull.py index 5e123a9..97441fa 100644 --- a/pull/pull.py +++ b/pull/pull.py @@ -33,14 +33,20 @@ def parse_args(argv=None): if argv is None: argv = sys.argv[1:] parser = ArgumentParser() - parser.add_argument('--output', default=DEFAULT_OUTPUT_DIR, + parser.add_argument('--output', metavar='PATH', + default=DEFAULT_OUTPUT_DIR, help='output directory path') - parser.add_argument('--cgit-user', default=DEFAULT_CGIT_CLONE_USER, + parser.add_argument('--cgit-user', metavar='USERNAME', + default=DEFAULT_CGIT_CLONE_USER, help='cgit clone username') - parser.add_argument('--cgit-host', default=DEFAULT_CGIT_CLONE_HOST, + parser.add_argument('--cgit-host', metavar='HOST', + default=DEFAULT_CGIT_CLONE_HOST, help='cgit clone host') - parser.add_argument('--cgit-port', default=DEFAULT_CGIT_CLONE_PORT, - help='cgit clone port number', type=int) + parser.add_argument('--cgit-port', metavar='PORT', type=int, + default=DEFAULT_CGIT_CLONE_PORT, + help='cgit clone port number') + parser.add_argument('--repo', metavar='REPO_ID', nargs='*', dest='repos', + help='repos to pull') return parser.parse_args(argv) @@ -206,8 +212,9 @@ def main(args=None): output = Output(args.output, cgit) success = True for repo in MY_REPOS: - if not output.pull(repo): - success = False + if args.repos is None or repo.repo_id in args.repos: + if not output.pull(repo): + success = False if success: logging.info('All repositories were updated successfully') return 0 -- cgit v1.2.3