func NewCmdPruneImages(f kcmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command {
	allImages := true
	opts := &PruneImagesOptions{
		Confirm:            false,
		KeepYoungerThan:    &defaultKeepYoungerThan,
		KeepTagRevisions:   &defaultKeepTagRevisions,
		PruneOverSizeLimit: &defaultPruneImageOverSizeLimit,
		PruneRegistry:      &defaultPruneRegistry,
		AllImages:          &allImages,
		NumWorkers:         &defaultNumWorkers,
	}

	cmd := &cobra.Command{
		Use:     "images",
		Short:   "Remove unreferenced images",
		Long:    fmt.Sprintf(imagesLongDesc, "system:image-pruner"),
		Example: imagesExample,
		Run: func(cmd *cobra.Command, args []string) {
			kcmdutil.CheckErr(opts.Complete(f, cmd, args, streams.Out))
			kcmdutil.CheckErr(opts.Validate())
			kcmdutil.CheckErr(opts.Run())
		},
	}

	cmd.Flags().BoolVar(&opts.Confirm, "confirm", opts.Confirm, "If true, specify that image pruning should proceed. Defaults to false, displaying what would be deleted but not actually deleting anything. Requires a valid route to the integrated container image registry (see --registry-url).")
	cmd.Flags().BoolVar(opts.AllImages, "all", *opts.AllImages, "Include images that were imported from external registries as candidates for pruning.  If pruned, all the mirrored objects associated with them will also be removed from the integrated registry.")
	cmd.Flags().DurationVar(opts.KeepYoungerThan, "keep-younger-than", *opts.KeepYoungerThan, "Specify the minimum age of an image and its referrers for it to be considered a candidate for pruning.")
	cmd.Flags().IntVar(opts.KeepTagRevisions, "keep-tag-revisions", *opts.KeepTagRevisions, "Specify the number of image revisions for a tag in an image stream that will be preserved.")
	cmd.Flags().BoolVar(opts.PruneOverSizeLimit, "prune-over-size-limit", *opts.PruneOverSizeLimit, "Specify if images which are exceeding LimitRanges (see 'openshift.io/Image'), specified in the same namespace, should be considered for pruning. This flag cannot be combined with --keep-younger-than nor --keep-tag-revisions.")
	cmd.Flags().StringVar(&opts.CABundle, "certificate-authority", opts.CABundle, "The path to a certificate authority bundle to use when communicating with the managed container image registries. Defaults to the certificate authority data from the current user's config file. It cannot be used together with --force-insecure.")
	cmd.Flags().StringVar(&opts.RegistryUrlOverride, "registry-url", opts.RegistryUrlOverride, "The address to use when contacting the registry, instead of using the default value. This is useful if you can't resolve or reach the registry (e.g.; the default is a cluster-internal URL) but you do have an alternative route that works. Particular transport protocol can be enforced using '<scheme>://' prefix.")
	cmd.Flags().BoolVar(&opts.ForceInsecure, "force-insecure", opts.ForceInsecure, "If true, allow an insecure connection to the container image registry that is hosted via HTTP or has an invalid HTTPS certificate. Whenever possible, use --certificate-authority instead of this dangerous option.")
	cmd.Flags().BoolVar(opts.PruneRegistry, "prune-registry", *opts.PruneRegistry, "If false, the prune operation will clean up image API objects, but the none of the associated content in the registry is removed.  Note, if only image API objects are cleaned up through use of this flag, the only means for subsequently cleaning up registry data corresponding to those image API objects is to employ the 'hard prune' administrative task.")
	cmd.Flags().BoolVar(&opts.IgnoreInvalidRefs, "ignore-invalid-refs", opts.IgnoreInvalidRefs, "If true, the pruning process will ignore all errors while parsing image references. This means that the pruning process will ignore the intended connection between the object and the referenced image. As a result an image may be incorrectly deleted as unused.")
	cmd.Flags().IntVar(opts.NumWorkers, "num-workers", *opts.NumWorkers, "Specify the number of parallel workers to use when running prune operations.")

	return cmd
}
// NewCmdPruneImages implements the OpenShift cli prune images command.
NewCmdPruneImages implements the OpenShift cli prune images command.
// NewCmdPruneImages implements the OpenShift cli prune images command .
func NewCmdPruneImages(f kcmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command {
	allImages := true
	opts := &PruneImagesOptions{
		Confirm:            false,
		KeepYoungerThan:    &defaultKeepYoungerThan,
		KeepTagRevisions:   &defaultKeepTagRevisions,
		PruneOverSizeLimit: &defaultPruneImageOverSizeLimit,
		PruneRegistry:      &defaultPruneRegistry,
		AllImages:          &allImages,
		NumWorkers:         &defaultNumWorkers,
	}
	cmd := &cobra.Command{
		Use:     "images",
		Short:   "Remove unreferenced images",
		Long:    fmt.Sprintf(imagesLongDesc, "system:image-pruner"),
		Example: imagesExample,
		Run: func(cmd *cobra.Command, args []string) {
			kcmdutil.CheckErr(opts.Complete(f, cmd, args, streams.Out))
			kcmdutil.CheckErr(opts.Validate())
			kcmdutil.CheckErr(opts.Run())
		},
	}
	cmd.Flags().BoolVar(&opts.Confirm, "confirm", opts.Confirm, "If true, specify that image pruning should proceed. Defaults to false, displaying what would be deleted but not actually deleting anything. Requires a valid route to the integrated container image registry (see --registry-url).")
	cmd.Flags().BoolVar(opts.AllImages, "all", *opts.AllImages, "Include images that were imported from external registries as candidates for pruning.  If pruned, all the mirrored objects associated with them will also be removed from the integrated registry.")
	cmd.Flags().DurationVar(opts.KeepYoungerThan, "keep-younger-than", *opts.KeepYoungerThan, "Specify the minimum age of an image and its referrers for it to be considered a candidate for pruning.")
	cmd.Flags().IntVar(opts.KeepTagRevisions, "keep-tag-revisions", *opts.KeepTagRevisions, "Specify the number of image revisions for a tag in an image stream that will be preserved.")
	cmd.Flags().BoolVar(opts.PruneOverSizeLimit, "prune-over-size-limit", *opts.PruneOverSizeLimit, "Specify if images which are exceeding LimitRanges (see 'openshift.io/Image'), specified in the same namespace, should be considered for pruning. This flag cannot be combined with --keep-younger-than nor --keep-tag-revisions.")
	cmd.Flags().StringVar(&opts.CABundle, "certificate-authority", opts.CABundle, "The path to a certificate authority bundle to use when communicating with the managed container image registries. Defaults to the certificate authority data from the current user's config file. It cannot be used together with --force-insecure.")
	cmd.Flags().StringVar(&opts.RegistryUrlOverride, "registry-url", opts.RegistryUrlOverride, "The address to use when contacting the registry, instead of using the default value. This is useful if you can't resolve or reach the registry (e.g.; the default is a cluster-internal URL) but you do have an alternative route that works. Particular transport protocol can be enforced using '<scheme>://' prefix.")
	cmd.Flags().BoolVar(&opts.ForceInsecure, "force-insecure", opts.ForceInsecure, "If true, allow an insecure connection to the container image registry that is hosted via HTTP or has an invalid HTTPS certificate. Whenever possible, use --certificate-authority instead of this dangerous option.")
	cmd.Flags().BoolVar(opts.PruneRegistry, "prune-registry", *opts.PruneRegistry, "If false, the prune operation will clean up image API objects, but the none of the associated content in the registry is removed.  Note, if only image API objects are cleaned up through use of this flag, the only means for subsequently cleaning up registry data corresponding to those image API objects is to employ the 'hard prune' administrative task.")
	cmd.Flags().BoolVar(&opts.IgnoreInvalidRefs, "ignore-invalid-refs", opts.IgnoreInvalidRefs, "If true, the pruning process will ignore all errors while parsing image references. This means that the pruning process will ignore the intended connection between the object and the referenced image. As a result an image may be incorrectly deleted as unused.")
	cmd.Flags().IntVar(opts.NumWorkers, "num-workers", *opts.NumWorkers, "Specify the number of parallel workers to use when running prune operations.")
	return cmd
}
func NewCmdPruneImages ( f kcmdutil . Factory , streams genericclioptions . IOStreams ) * cobra . Command { allImages := true opts := & PruneImagesOptions { Confirm : false , KeepYoungerThan : & defaultKeepYoungerThan , KeepTagRevisions : & defaultKeepTagRevisions , PruneOverSizeLimit : & defaultPruneImageOverSizeLimit , PruneRegistry : & defaultPruneRegistry , AllImages : & allImages , NumWorkers : & defaultNumWorkers , } cmd := & cobra . Command { Use : " " , Short : " " , Long : fmt . Sprintf ( imagesLongDesc , " " ) , Example : imagesExample , Run : func ( cmd * cobra . Command , args [ ] string ) { kcmdutil . CheckErr ( opts . Complete ( f , cmd , args , streams . Out ) ) kcmdutil . CheckErr ( opts . Validate ( ) ) kcmdutil . CheckErr ( opts . Run ( ) ) } , } cmd . Flags ( ) . BoolVar ( & opts . Confirm , " " , opts . Confirm , " " ) cmd . Flags ( ) . BoolVar ( opts . AllImages , " " , * opts . AllImages , " " ) cmd . Flags ( ) . DurationVar ( opts . KeepYoungerThan , " " , * opts . KeepYoungerThan , " " ) cmd . Flags ( ) . IntVar ( opts . KeepTagRevisions , " " , * opts . KeepTagRevisions , " " ) cmd . Flags ( ) . BoolVar ( opts . PruneOverSizeLimit , " " , * opts . PruneOverSizeLimit , " " ) cmd . Flags ( ) . StringVar ( & opts . CABundle , " " , opts . CABundle , " " ) cmd . Flags ( ) . StringVar ( & opts . RegistryUrlOverride , " " , opts . RegistryUrlOverride , " " ) cmd . Flags ( ) . BoolVar ( & opts . ForceInsecure , " " , opts . ForceInsecure , " " ) cmd . Flags ( ) . BoolVar ( opts . PruneRegistry , " " , * opts . PruneRegistry , " " ) cmd . Flags ( ) . BoolVar ( & opts . IgnoreInvalidRefs , " " , opts . IgnoreInvalidRefs , " " ) cmd . Flags ( ) . IntVar ( opts . NumWorkers , " " , * opts . NumWorkers , " " ) return cmd }
NewCmdPruneImages implements the OpenShift cli prune images command.
NewCmdPruneImages implements the OpenShift cli prune images command .