install multiple packages at once with the install command

This commit is contained in:
2026-01-19 07:29:55 +11:00
parent dd7697fcc7
commit 4de2819109
2 changed files with 19 additions and 15 deletions

View File

@@ -12,19 +12,7 @@ from util import check_ground_libs_path, check_sudo
console = Console()
def install(args):
check_sudo()
check_ground_libs_path()
# figure out which version to install
package_name = args.name
version = "latest"
if "@" in args.name:
split = package_name.split("@")
package_name = split[0]
version = split[1]
def install_package(package_name, version, args):
retries_left = args.max_retries
with console.status("Downloading tarball...", spinner="bouncingBall", spinner_style="blue") as status:
@@ -83,3 +71,19 @@ def install(args):
os.symlink(os.path.join(extract_dir, package_name, "main.so"), symlink_path)
console.print("[:white_check_mark:] Done!")
def install(args):
check_sudo()
check_ground_libs_path()
for package in args.names:
# figure out which version to install
package_name = package
version = "latest"
if "@" in package:
split = package.split("@")
package_name = split[0]
version = split[1]
install_package(package_name, version, args)

View File

@@ -15,7 +15,7 @@ def parse_arguments():
# install command
install_command = sub_parsers.add_parser(name="install", description="install a mineral")
install_command.add_argument("name", help="name of the mineral to install")
install_command.add_argument("names", help="name of the minerals to install", nargs="+")
install_command.add_argument("--max-retries", help="max number of download retries before giving up", default=3, type=int)
# uninstall command