From 44593ecbfd11a6ed5fbc9cf9cc576a76362d94f9 Mon Sep 17 00:00:00 2001 From: Obijuan Date: Wed, 26 Jun 2024 22:05:01 +0200 Subject: [PATCH] icm rm: remove multiple packages --- icm/__main__.py | 2 +- icm/commands/cmd_rm.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/icm/__main__.py b/icm/__main__.py index 39e6d07..7910731 100644 --- a/icm/__main__.py +++ b/icm/__main__.py @@ -69,7 +69,7 @@ def ls(): @cli.command() -@click.argument("collection", nargs=1) +@click.argument("collection", nargs=-1) @click.option("-y", "--yes", is_flag=True, help="Respond yes automatically") def rm(collection, yes): """Remove colections""" diff --git a/icm/commands/cmd_rm.py b/icm/commands/cmd_rm.py index 3233eea..6b3c6df 100644 --- a/icm/commands/cmd_rm.py +++ b/icm/commands/cmd_rm.py @@ -6,7 +6,7 @@ from icm.commons import commons -def main(coltag: str, yes: bool) -> None: +def main(coltags: tuple, yes: bool) -> None: """ENTRY POINT: Remove collections * coltag: Name+version of the collection to remove (Ex. iceK-0.1.4) @@ -20,15 +20,15 @@ def main(coltag: str, yes: bool) -> None: print() # -- Remove the collection! - rm_collection(collection, folders, coltag, yes) - + for coltag in coltags: + rm_collection(collection, folders, coltag, yes) def rm_collection( collection: commons.Collection, folders: commons.Folders, coltag: str, - yes: bool = False + yes: bool = False, ) -> None: """Remove one collection * collection: Context information, @@ -38,7 +38,7 @@ def rm_collection( * yes: Respond "yes" automatically """ - # -- Build the Path to the collection + # -- Build the Path to the collection abs_collection = folders.collections / coltag # -- Check if the collection exists, as it was typed bye the user