From 401c6f072564966437a74dc2f33280a85d79dc84 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Thu, 18 Feb 2021 15:20:15 -0500 Subject: 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 Reviewed-by: Jonathan Nieder --- repo | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'repo') diff --git a/repo b/repo index 63cee031..1bc78b89 100755 --- a/repo +++ b/repo @@ -270,9 +270,9 @@ gpg_dir = os.path.join(home_dot_repo, 'gnupg') def GetParser(gitc_init=False): """Setup the CLI parser.""" if gitc_init: - usage = 'repo gitc-init -u url -c client [options]' + usage = 'repo gitc-init -c client [options] [-u] url' else: - usage = 'repo init -u url [options]' + usage = 'repo init [options] [-u] url' parser = optparse.OptionParser(usage=usage) @@ -522,8 +522,11 @@ def _Init(args, gitc_init=False): parser = GetParser(gitc_init=gitc_init) opt, args = parser.parse_args(args) if args: - parser.print_usage() - sys.exit(1) + if not opt.manifest_url: + opt.manifest_url = args.pop(0) + if args: + parser.print_usage() + sys.exit(1) opt.quiet = opt.output_mode is False opt.verbose = opt.output_mode is True -- cgit v1.2.3-54-g00ecf