summaryrefslogtreecommitdiffstats
path: root/gita/__main__.py
diff options
context:
space:
mode:
Diffstat (limited to 'gita/__main__.py')
-rw-r--r--gita/__main__.py24
1 files changed, 18 insertions, 6 deletions
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:
@@ -497,12 +502,6 @@ def main(argv=None):
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",
dest="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(