diff options
author | Mike Frysinger <vapier@google.com> | 2021-02-18 15:20:15 -0500 |
---|---|---|
committer | Mike Frysinger <vapier@google.com> | 2021-02-18 20:38:47 +0000 |
commit | 401c6f072564966437a74dc2f33280a85d79dc84 (patch) | |
tree | 0b90116d29056d8cd6e1d492cbe37b516e633b6c /repo | |
parent | 8c1e9e62a3214a7ab5feeb7ce194ca153cc8afb1 (diff) | |
download | git-repo-401c6f072564966437a74dc2f33280a85d79dc84.tar.gz |
init: make --manifest-url flag optional
Since the --manifest-url flag is always required when creating a new
checkout, allow the url to be specified via a positional argument.
This brings it a little closer to the `git clone` UI.
Change-Id: Iaf18e794ae2fa38b20579243d067205cae5fae2f
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/297322
Tested-by: Mike Frysinger <vapier@google.com>
Reviewed-by: Jonathan Nieder <jrn@google.com>
Diffstat (limited to 'repo')
-rwxr-xr-x | repo | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -270,9 +270,9 @@ gpg_dir = os.path.join(home_dot_repo, 'gnupg') | |||
270 | def GetParser(gitc_init=False): | 270 | def GetParser(gitc_init=False): |
271 | """Setup the CLI parser.""" | 271 | """Setup the CLI parser.""" |
272 | if gitc_init: | 272 | if gitc_init: |
273 | usage = 'repo gitc-init -u url -c client [options]' | 273 | usage = 'repo gitc-init -c client [options] [-u] url' |
274 | else: | 274 | else: |
275 | usage = 'repo init -u url [options]' | 275 | usage = 'repo init [options] [-u] url' |
276 | 276 | ||
277 | parser = optparse.OptionParser(usage=usage) | 277 | parser = optparse.OptionParser(usage=usage) |
278 | 278 | ||
@@ -522,8 +522,11 @@ def _Init(args, gitc_init=False): | |||
522 | parser = GetParser(gitc_init=gitc_init) | 522 | parser = GetParser(gitc_init=gitc_init) |
523 | opt, args = parser.parse_args(args) | 523 | opt, args = parser.parse_args(args) |
524 | if args: | 524 | if args: |
525 | parser.print_usage() | 525 | if not opt.manifest_url: |
526 | sys.exit(1) | 526 | opt.manifest_url = args.pop(0) |
527 | if args: | ||
528 | parser.print_usage() | ||
529 | sys.exit(1) | ||
527 | opt.quiet = opt.output_mode is False | 530 | opt.quiet = opt.output_mode is False |
528 | opt.verbose = opt.output_mode is True | 531 | opt.verbose = opt.output_mode is True |
529 | 532 | ||