Image management commands: list and cleanup.
register(subparsers)
Register the image subcommand group.
Source code in src/terok/cli/commands/image.py
| def register(subparsers: argparse._SubParsersAction[argparse.ArgumentParser]) -> None:
"""Register the ``image`` subcommand group."""
p_image = subparsers.add_parser("image", help="Manage terok container images")
image_sub = p_image.add_subparsers(dest="image_cmd", required=True)
# image list
p_list = image_sub.add_parser("list", help="List terok images with sizes")
set_completer(
p_list.add_argument("project_id", nargs="?", default=None, help="Filter by project"),
_complete_project_ids,
)
# image cleanup
p_cleanup = image_sub.add_parser("cleanup", help="Remove orphaned and dangling terok images")
p_cleanup.add_argument(
"--dry-run",
action="store_true",
help="Show what would be removed without removing",
)
|
dispatch(args)
Handle image management commands. Returns True if handled.
Source code in src/terok/cli/commands/image.py
| def dispatch(args: argparse.Namespace) -> bool:
"""Handle image management commands. Returns True if handled."""
if args.cmd != "image":
return False
if args.image_cmd == "list":
_cmd_list(getattr(args, "project_id", None))
return True
if args.image_cmd == "cleanup":
_cmd_cleanup(dry_run=getattr(args, "dry_run", False))
return True
return False
|