Added create command
This commit is contained in:
3
main.py
3
main.py
@@ -179,7 +179,7 @@ For detailed help on each command, use:
|
||||
args = parser.parse_args()
|
||||
|
||||
# All
|
||||
if args.command and not args.command in ["config","list"]:
|
||||
if args.command and not args.command in ["config","list","create"]:
|
||||
selected = get_selected_repos(args.all,all_repos_list,args.identifiers)
|
||||
# Dispatch commands.
|
||||
if args.command == "install":
|
||||
@@ -192,6 +192,7 @@ For detailed help on each command, use:
|
||||
print("No identifiers provided. Please specify at least one identifier in the format provider/account/repository.")
|
||||
sys.exit(1)
|
||||
else:
|
||||
selected = get_selected_repos(True,all_repos_list,None)
|
||||
for identifier in args.identifiers:
|
||||
create_repo(identifier, config_merged, USER_CONFIG_PATH, BIN_DIR, remote=args.remote, preview=args.preview)
|
||||
elif args.command in GIT_DEFAULT_COMMANDS:
|
||||
|
||||
@@ -133,20 +133,12 @@ def create_repo(identifier, config_merged, user_config_path, bin_dir, remote=Fal
|
||||
subprocess.run(cmd_remote, cwd=repo_dir, shell=True, check=True)
|
||||
print(f"Remote 'origin' added: {remote_url}")
|
||||
except subprocess.CalledProcessError:
|
||||
print(f"Failed to add remote using URL: {remote_url}. Exiting.")
|
||||
sys.exit(2)
|
||||
|
||||
cmd_remote = f"git remote add origin {remote_url}"
|
||||
if preview:
|
||||
print(f"[Preview] Would execute: '{cmd_remote}' in {repo_dir}")
|
||||
else:
|
||||
subprocess.run(cmd_remote, cwd=repo_dir, shell=True, check=True)
|
||||
print(f"Remote 'origin' added: {remote_url}")
|
||||
print(f"Failed to add remote using URL: {remote_url}.")
|
||||
|
||||
# Push the initial commit to the remote repository
|
||||
cmd_push = "git push -u origin master"
|
||||
if preview:
|
||||
print(f"[Preview] Would execute: '{cmd_push}' in {repo_dir}")
|
||||
else:
|
||||
subprocess.run(cmd_push, cwd=repo_dir, shell=True, check=True)
|
||||
print("Initial push to the remote repository completed.")
|
||||
exit(7)
|
||||
print("Initial push to the remote repository completed.")
|
||||
Reference in New Issue
Block a user