def cli(subparser): # atomic images imagesp = subparser.add_parser("images", help=_("operate on images")) images_subparser = imagesp.add_subparsers(title='images subcommands', description="operate on images", help='additional help') # atomic images delete delete_parser = images_subparser.add_parser( "delete", help=_("mark image for deletion"), epilog="Marks image. registry garbage-collection " "when invoked will recover used disk space") delete_parser.set_defaults(_class=Delete, func='delete_image') deletegroup = delete_parser.add_mutually_exclusive_group() deletegroup.add_argument( "-f", "--force", default=False, dest="force", action="store_true", help= _("Force removal of local images, even if containers based on it exist. Default is False" )) deletegroup.add_argument("--remote", default=False, dest="remote", action="store_true", help=_("Delete image from remote repository")) delete_parser.add_argument( "--storage", default=storage, dest="storage", help=_("Specify the storage from which to delete the image from. " "If not specified and there are images with the same name in " "different storages, you will be prompted to specify.")) delete_parser.add_argument("delete_targets", nargs=argparse.ONE_OR_MORE, help=_("container image(s)")) if util.gomtree_available(): generate_parser = images_subparser.add_parser( "generate", help=_("generate image 'manifests' if missing")) generate_parser.set_defaults(_class=Images, func='generate_validation_manifest') Help.cli(images_subparser) info.cli(images_subparser) # atomic images list list_parser = images_subparser.add_parser( "list", help=_("list container images on your system"), epilog="atomic images by default will list all installed " "container images on your system.") list_parser.set_defaults(_class=Images, func='display_all_image_info') list_parser.add_argument( "-a", "--all", dest="all", default=False, action="store_true", help=_("Show all images, including intermediate images")) list_parser.add_argument( "-f", "--filter", dest="filter", metavar="FILTER", action="append", help=_("Filter output based on VARIABLE=VALUE format")) list_parser.add_argument( "-n", "--noheading", dest="heading", default=True, action="store_false", help=_("do not print heading when listing the images")) list_parser.add_argument("--no-trunc", dest="truncate", default=True, action="store_false", help=_("Don't truncate output")) list_parser.add_argument("-q", "--quiet", dest="quiet", default=False, action="store_true", help=_("Only display image IDs")) list_parser.add_argument("--json", action='store_true', dest="json", default=False, help=_("print in a machine parseable form")) prune_parser = images_subparser.add_parser( "prune", help=_("delete unused 'dangling' images"), epilog="Using the prune command, " "will free up disk space deleting unused " "'dangling' images") prune_parser.set_defaults(_class=Delete, func='prune_images') verify.cli(images_subparser) info.cli_version(images_subparser)
def cli(subparser): # atomic images imagesp = subparser.add_parser("images", help=_("operate on images")) images_subparser = imagesp.add_subparsers(title='images subcommands', description="operate on images", help='additional help') # atomic images delete delete_parser = images_subparser.add_parser("delete", help=_("mark image for deletion"), epilog="Marks image. registry garbage-collection " "when invoked will recover used disk space") deletegroup = delete_parser.add_mutually_exclusive_group() deletegroup.add_argument("-f", "--force", default=False, dest="force", action="store_true", help=_("Force removal of local images, even if containers based on it exist. Default is False")) deletegroup.add_argument("--remote", default=False, dest="remote", action="store_true", help=_("Delete image from remote repository")) delete_parser.add_argument("--storage", default=storage, dest="storage", help=_("Specify the storage from which to delete the image from. " "If not specified and there are images with the same name in " "different storages, you will be prompted to specify.")) delete_parser.add_argument("-a", "--all", action='store_true',dest="all", default=False, help=_("Delete all images")) delete_parser.add_argument("delete_targets", nargs='*', help=_("container image(s)")) delete_parser.set_defaults(_class=Delete, func='delete_image') if util.gomtree_available(): generate_parser = images_subparser.add_parser("generate", help=_("generate image 'manifests' if missing")) generate_parser.set_defaults(_class=Images, func='generate_validation_manifest') # Suppress storage flag: only docker images are supported for generate generate_parser.add_argument("--storage", default=storage, dest="storage", help=argparse.SUPPRESS) Help.cli(images_subparser) info.cli(images_subparser) # atomic images list list_parser = images_subparser.add_parser("list", help=_("list container images on your system"), epilog="atomic images by default will list all installed " "container images on your system.") list_parser.set_defaults(_class=Images, func='display_all_image_info') list_parser.add_argument("-a", "--all", dest="all", default=False, action="store_true", help=_("Show all images, including intermediate images")) list_parser.add_argument("-f", "--filter", dest="filter", metavar="FILTER", action="append", help=_("Filter output based on VARIABLE=VALUE format")) list_parser.add_argument("-n", "--noheading", dest="heading", default=True, action="store_false", help=_("do not print heading when listing the images")) list_parser.add_argument("--no-trunc", dest="truncate", default=True, action="store_false", help=_("Don't truncate output")) list_parser.add_argument("-q", "--quiet", dest="quiet", default=False, action="store_true", help=_("Only display image IDs")) list_parser.add_argument("--json", action='store_true',dest="json", default=False, help=_("print in a machine parseable form")) prune_parser = images_subparser.add_parser("prune", help=_("delete unused 'dangling' images"), epilog="Using the prune command, " "will free up disk space deleting unused " "'dangling' images") prune_parser.set_defaults(_class=Delete, func='prune_images') update.cli(images_subparser) verify.cli(images_subparser) info.cli_version(images_subparser)