diff --git a/icm/__main__.py b/icm/__main__.py index dbe1426..39e6d07 100644 --- a/icm/__main__.py +++ b/icm/__main__.py @@ -70,10 +70,11 @@ def ls(): @cli.command() @click.argument("collection", nargs=1) -def rm(collection): +@click.option("-y", "--yes", is_flag=True, help="Respond yes automatically") +def rm(collection, yes): """Remove colections""" - cmd_rm.main(collection) + cmd_rm.main(collection, yes) @cli.command() diff --git a/icm/commands/cmd_rm.py b/icm/commands/cmd_rm.py index 6ae2573..c17f46d 100644 --- a/icm/commands/cmd_rm.py +++ b/icm/commands/cmd_rm.py @@ -6,10 +6,11 @@ from icm.commons import commons -def main(coltag: str) -> None: +def main(coltag: str, yes: bool) -> None: """ENTRY POINT: Remove collections * coltag: Name+version of the collection to remove (Ex. iceK-0.1.4) + * yes: Respond "yes" automatically """ # -- Get context information @@ -63,7 +64,7 @@ def main(coltag: str) -> None: abs_collection = folders.collections / coltag # -- Ask for confirmation! - if click.confirm(f"{coltag}: Remove?"): + if yes or click.confirm(f"{coltag}: Remove?"): # -- Remove the collection! shutil.rmtree(abs_collection) return