diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2019-02-19 21:49:14 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2019-02-19 21:57:54 +0300 |
commit | 3f23bb852c348ca6a676a950fb976db27dc7170b (patch) | |
tree | 58e43facbe43376afe5397ec2861ed4bb899b25a /pull | |
parent | refactor to make for proper code (diff) | |
download | cgitize-3f23bb852c348ca6a676a950fb976db27dc7170b.tar.gz cgitize-3f23bb852c348ca6a676a950fb976db27dc7170b.zip |
add option to pull individual repos
Diffstat (limited to '')
-rwxr-xr-x | pull.sh | 2 | ||||
-rw-r--r-- | pull/pull.py | 21 |
2 files changed, 15 insertions, 8 deletions
@@ -35,4 +35,4 @@ if [ -z "${SSH_AUTH_SOCK+x}" ]; then exit 1 fi add_ssh_key -python3 -m pull.pull +python3 -m pull.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 |