@@ -118,6 +118,45 @@ def clone(repo, context, repo_names, all_repos, install):
118118 click .echo (context .get_help ())
119119
120120
121+ @repo .command ()
122+ @click .argument ("repo_names" , nargs = - 1 )
123+ @click .option ("-a" , "--all-repos" , is_flag = True , help = "Install all repositories" )
124+ @click .pass_context
125+ @pass_repo
126+ def install (repo , context , repo_names , all_repos ):
127+ """Install repositories (like 'clone -i')."""
128+ repos , url_pattern , _ = get_repos ("pyproject.toml" )
129+ repo_name_map = get_repo_name_map (repos , url_pattern )
130+
131+ if all_repos and repo_names :
132+ click .echo ("Cannot specify both repo names and --all-repos" )
133+ return
134+
135+ # If -a/--all-repos is given
136+ if all_repos :
137+ click .echo (f"Updating { len (repo_name_map )} repositories..." )
138+ for repo_name , repo_url in repo_name_map .items ():
139+ clone_path = os .path .join (context .obj .home , repo_name )
140+ if os .path .exists (clone_path ):
141+ install_package (clone_path )
142+ return
143+
144+ # If specific repo names are given
145+ if repo_names :
146+ not_found = []
147+ for repo_name in repo_names :
148+ clone_path = os .path .join (context .obj .home , repo_name )
149+ if os .path .exists (clone_path ):
150+ install_package (clone_path )
151+ else :
152+ not_found .append (repo_name )
153+ for name in not_found :
154+ click .echo (f"Repository '{ name } ' not found." )
155+ return
156+
157+ click .echo (context .get_help ())
158+
159+
121160@repo .command (context_settings = {"ignore_unknown_options" : True })
122161@click .argument ("repo_name" , required = False )
123162@click .argument ("args" , nargs = - 1 )
0 commit comments