code: func (o *SecretDockerRegistryOpts) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string) error {
  	name, err := NameFromCommandArgs(cmd, args)
  	if err != nil {
  		return err
  	}
  
  	fromFileFlag := cmdutil.GetFlagStringSlice(cmd, "from-file")
  	if len(fromFileFlag) == 0 {
  		requiredFlags := []string{"docker-username", "docker-password", "docker-server"}
  		for _, requiredFlag := range requiredFlags {
  			if value := cmdutil.GetFlagString(cmd, requiredFlag); len(value) == 0 {
  				return cmdutil.UsageErrorf(cmd, "flag %s is required", requiredFlag)
  			}
  		}
  	}
  
  	var generator generate.StructuredGenerator
  	switch generatorName := cmdutil.GetFlagString(cmd, "generator"); generatorName {
  	case generateversioned.SecretForDockerRegistryV1GeneratorName:
  		generator = &generateversioned.SecretForDockerRegistryGeneratorV1{
  			Name:        name,
  			Username:    cmdutil.GetFlagString(cmd, "docker-username"),
  			Email:       cmdutil.GetFlagString(cmd, "docker-email"),
  			Password:    cmdutil.GetFlagString(cmd, "docker-password"),
  			Server:      cmdutil.GetFlagString(cmd, "docker-server"),
  			AppendHash:  cmdutil.GetFlagBool(cmd, "append-hash"),
  			FileSources: cmdutil.GetFlagStringSlice(cmd, "from-file"),
  		}
  	default:
  		return errUnsupportedGenerator(cmd, generatorName)
  	}
  
  	return o.CreateSubcommandOptions.Complete(f, cmd, args, generator)
  }
docs: // Complete completes all the required options