From ee6fef8073a6710028b9940c9886e29bd7e0cb0a Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Thu, 13 Mar 2025 15:58:26 +0100 Subject: [PATCH] Added create command --- main.py | 3 ++- pkgmgr/create_repo.py | 14 +++----------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/main.py b/main.py index eb24591..c5cad77 100755 --- a/main.py +++ b/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: diff --git a/pkgmgr/create_repo.py b/pkgmgr/create_repo.py index eb6130b..62715fa 100644 --- a/pkgmgr/create_repo.py +++ b/pkgmgr/create_repo.py @@ -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) \ No newline at end of file + print("Initial push to the remote repository completed.") \ No newline at end of file