From a2a738495ed1b8602c67efc28827d993b1b47150 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Tue, 18 Jul 2023 12:49:23 +0200 Subject: Merging upstream version 0.16.6.1. Signed-off-by: Daniel Baumann --- gita/__main__.py | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'gita/__main__.py') diff --git a/gita/__main__.py b/gita/__main__.py index 3d091c6..b2bc32b 100644 --- a/gita/__main__.py +++ b/gita/__main__.py @@ -165,6 +165,11 @@ def f_clone(args: argparse.Namespace): if not args.from_file: subprocess.run(["git", "clone", args.clonee], cwd=path) + # add the cloned repo to gita; group is also supported + cloned_path = os.path.join(path, args.clonee.split("/")[-1].split(".")[0]) + args.paths = [cloned_path] + args.recursive = args.auto_group = args.bare = args.skip_submodule = False + f_add(args) return if args.preserve_path: @@ -496,12 +501,6 @@ def main(argv=None): "--directory", help="Change to DIRECTORY before doing anything.", ) - p_clone.add_argument( - "-f", - "--from-file", - action="store_true", - help="If set, clone repos in a config file rendered from `gita freeze`", - ) p_clone.add_argument( "-p", "--preserve-path", @@ -515,6 +514,19 @@ def main(argv=None): action="store_true", help="If set, show command without execution", ) + xgroup = p_clone.add_mutually_exclusive_group() + xgroup.add_argument( + "-g", + "--group", + choices=utils.get_groups(), + help="If set, add repo to the specified group after cloning, otherwise add to gita without group.", + ) + xgroup.add_argument( + "-f", + "--from-file", + action="store_true", + help="If set, clone repos in a config file rendered from `gita freeze`", + ) p_clone.set_defaults(func=f_clone) p_rename = subparsers.add_parser( -- cgit v1.2.3