Exemplo n.º 1
0
func (o *createAuthInfoOptions) complete(cmd *cobra.Command, out io.Writer) bool {
	args := cmd.Flags().Args()
	if len(args) != 1 {
		return false
	}

	authProviderArgs, err := cmd.Flags().GetStringSlice(flagAuthProviderArg)
	if err != nil {
		fmt.Fprintf(out, "Error: %s\n", err)
		return false
	}

	if len(authProviderArgs) > 0 {
		newPairs, removePairs, err := cmdutil.ParsePairs(authProviderArgs, flagAuthProviderArg, true)
		if err != nil {
			fmt.Fprintf(out, "Error: %s\n", err)
			return false
		}
		o.authProviderArgs = newPairs
		o.authProviderArgsToRemove = removePairs
	}

	o.name = args[0]
	return true
}
Exemplo n.º 2
0
// getResourcesAndImages retrieves resources and container name:images pair from given args
func getResourcesAndImages(args []string) (resources []string, containerImages map[string]string, err error) {
	pairType := "image"
	resources, imageArgs, err := cmdutil.GetResourcesAndPairs(args, pairType)
	if err != nil {
		return
	}
	containerImages, _, err = cmdutil.ParsePairs(imageArgs, pairType, false)
	return
}
Exemplo n.º 3
0
// parseAnnotations retrieves new and remove annotations from annotation args
func parseAnnotations(annotationArgs []string) (map[string]string, []string, error) {
	return cmdutil.ParsePairs(annotationArgs, "annotation", true)
}