func (o *PruneImagesOptions) Complete(f kcmdutil.Factory, cmd *cobra.Command, args []string, out io.Writer) error {
	if len(args) > 0 {
		return kcmdutil.UsageErrorf(cmd, "no arguments are allowed to this command")
	}

	if !cmd.Flags().Lookup("prune-over-size-limit").Changed {
		o.PruneOverSizeLimit = nil
	} else {
		if !cmd.Flags().Lookup("keep-younger-than").Changed {
			o.KeepYoungerThan = nil
		}
		if !cmd.Flags().Lookup("keep-tag-revisions").Changed {
			o.KeepTagRevisions = nil
		}
	}

	o.Namespace = metav1.NamespaceAll
	if cmd.Flags().Lookup("namespace").Changed {
		var err error
		o.Namespace, _, err = f.ToRawKubeConfigLoader().Namespace()
		if err != nil {
			return err
		}
	}
	o.Out = out
	o.ErrOut = os.Stderr

	var err error
	o.ClientConfig, err = f.ToRESTConfig()
	if err != nil {
		return err
	}
	if len(o.ClientConfig.BearerToken) == 0 {
		return errNoToken
	}
	o.KubeClient, err = kubernetes.NewForConfig(o.ClientConfig)
	if err != nil {
		return err
	}
	o.AppsClient, err = appsv1client.NewForConfig(o.ClientConfig)
	if err != nil {
		return err
	}
	o.BuildClient, err = buildv1client.NewForConfig(o.ClientConfig)
	if err != nil {
		return err
	}
	o.ImageClient, err = imagev1client.NewForConfig(o.ClientConfig)
	if err != nil {
		return err
	}
	o.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(o.ClientConfig)
	if err != nil {
		return err
	}

	o.ImageClientFactory = getImageClientFactory(f)

	o.Timeout = o.ClientConfig.Timeout
	if o.Timeout == 0 {
		o.Timeout = time.Duration(10 * time.Second)
	}

	return nil
}
// Complete turns a partially defined PruneImagesOptions into a solvent structure
// which can be validated and used for pruning images.
Complete turns a partially defined PruneImagesOptions into a solvent structure
which can be validated and used for pruning images.
// Complete turns a partially defined PruneImagesOptions into a solvent structure // which can be validated and used for pruning images .
func (o *PruneImagesOptions) Complete(f kcmdutil.Factory, cmd *cobra.Command, args []string, out io.Writer) error {
	if len(args) > 0 {
		return kcmdutil.UsageErrorf(cmd, "no arguments are allowed to this command")
	}
	if !cmd.Flags().Lookup("prune-over-size-limit").Changed {
		o.PruneOverSizeLimit = nil
	} else {
		if !cmd.Flags().Lookup("keep-younger-than").Changed {
			o.KeepYoungerThan = nil
		}
		if !cmd.Flags().Lookup("keep-tag-revisions").Changed {
			o.KeepTagRevisions = nil
		}
	}
	o.Namespace = metav1.NamespaceAll
	if cmd.Flags().Lookup("namespace").Changed {
		var err error
		o.Namespace, _, err = f.ToRawKubeConfigLoader().Namespace()
		if err != nil {
			return err
		}
	}
	o.Out = out
	o.ErrOut = os.Stderr
	var err error
	o.ClientConfig, err = f.ToRESTConfig()
	if err != nil {
		return err
	}
	if len(o.ClientConfig.BearerToken) == 0 {
		return errNoToken
	}
	o.KubeClient, err = kubernetes.NewForConfig(o.ClientConfig)
	if err != nil {
		return err
	}
	o.AppsClient, err = appsv1client.NewForConfig(o.ClientConfig)
	if err != nil {
		return err
	}
	o.BuildClient, err = buildv1client.NewForConfig(o.ClientConfig)
	if err != nil {
		return err
	}
	o.ImageClient, err = imagev1client.NewForConfig(o.ClientConfig)
	if err != nil {
		return err
	}
	o.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(o.ClientConfig)
	if err != nil {
		return err
	}
	o.ImageClientFactory = getImageClientFactory(f)
	o.Timeout = o.ClientConfig.Timeout
	if o.Timeout == 0 {
		o.Timeout = time.Duration(10 * time.Second)
	}
	return nil
}
func ( o * PruneImagesOptions ) Complete ( f kcmdutil . Factory , cmd * cobra . Command , args [ ] string , out io . Writer ) error { if len ( args ) > 0 { return kcmdutil . UsageErrorf ( cmd , " " ) } if ! cmd . Flags ( ) . Lookup ( " " ) . Changed { o . PruneOverSizeLimit = nil } else { if ! cmd . Flags ( ) . Lookup ( " " ) . Changed { o . KeepYoungerThan = nil } if ! cmd . Flags ( ) . Lookup ( " " ) . Changed { o . KeepTagRevisions = nil } } o . Namespace = metav1 . NamespaceAll if cmd . Flags ( ) . Lookup ( " " ) . Changed { var err error o . Namespace , _ , err = f . ToRawKubeConfigLoader ( ) . Namespace ( ) if err != nil { return err } } o . Out = out o . ErrOut = os . Stderr var err error o . ClientConfig , err = f . ToRESTConfig ( ) if err != nil { return err } if len ( o . ClientConfig . BearerToken ) == 0 { return errNoToken } o . KubeClient , err = kubernetes . NewForConfig ( o . ClientConfig ) if err != nil { return err } o . AppsClient , err = appsv1client . NewForConfig ( o . ClientConfig ) if err != nil { return err } o . BuildClient , err = buildv1client . NewForConfig ( o . ClientConfig ) if err != nil { return err } o . ImageClient , err = imagev1client . NewForConfig ( o . ClientConfig ) if err != nil { return err } o . DiscoveryClient , err = discovery . NewDiscoveryClientForConfig ( o . ClientConfig ) if err != nil { return err } o . ImageClientFactory = getImageClientFactory ( f ) o . Timeout = o . ClientConfig . Timeout if o . Timeout == 0 { o . Timeout = time . Duration ( 10 * time . Second ) } return nil }
Complete turns a partially defined PruneImagesOptions into a solvent structure
which can be validated and used for pruning images.
Complete turns a partially defined PruneImagesOptions into a solvent structure which can be validated and used for pruning images .