Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 10 for AllowMissingKeys (0.46 sec)

  1. staging/src/k8s.io/cli-runtime/pkg/genericclioptions/jsonpath_flags.go

    	if err != nil {
    		return nil, fmt.Errorf("error parsing jsonpath %s, %v", templateValue, err)
    	}
    
    	allowMissingKeys := true
    	if f.AllowMissingKeys != nil {
    		allowMissingKeys = *f.AllowMissingKeys
    	}
    
    	p.AllowMissingKeys(allowMissingKeys)
    
    	if templateFormat == "jsonpath-as-json" {
    		p.EnableJSONOutput(true)
    	}
    
    	return p, nil
    }
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Fri Jun 02 09:47:52 UTC 2023
    - 4.3K bytes
    - Viewed (0)
  2. staging/src/k8s.io/cli-runtime/pkg/genericclioptions/template_flags.go

    	if err != nil {
    		return nil, fmt.Errorf("error parsing template %s, %v", templateValue, err)
    	}
    
    	allowMissingKeys := true
    	if f.AllowMissingKeys != nil {
    		allowMissingKeys = *f.AllowMissingKeys
    	}
    
    	p.AllowMissingKeys(allowMissingKeys)
    	return p, nil
    }
    
    // AddFlags receives a *cobra.Command reference and binds
    // flags related to template printing to it
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Fri Jun 02 09:47:52 UTC 2023
    - 4.4K bytes
    - Viewed (0)
  3. staging/src/k8s.io/cli-runtime/pkg/genericclioptions/kube_template_flags.go

    		c.MarkFlagFilename("template")
    	}
    	if f.AllowMissingKeys != nil {
    		c.Flags().BoolVar(f.AllowMissingKeys, "allow-missing-template-keys", *f.AllowMissingKeys, "If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.")
    	}
    }
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Jan 13 10:28:09 UTC 2021
    - 3.3K bytes
    - Viewed (0)
  4. staging/src/k8s.io/cli-runtime/pkg/genericclioptions/template_flags_test.go

    			expectedOutput:   "foo",
    			allowMissingKeys: &allowMissingKeys,
    		},
    		{
    			name:             "missing field does not error and returns no value since missing keys are allowed by default",
    			templateArg:      "{{ .metadata.missing }}",
    			expectedOutput:   "<no value>",
    			allowMissingKeys: nil,
    		},
    		{
    			name:             "missing field returns expected error if field is missing and allowMissingKeys is explicitly set to false",
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Fri Jun 02 09:47:52 UTC 2023
    - 5.9K bytes
    - Viewed (0)
  5. staging/src/k8s.io/cli-runtime/pkg/genericclioptions/jsonpath_flags_test.go

    			expectedOutput:   "foo",
    			allowMissingKeys: &allowMissingKeys,
    		},
    		{
    			name:             "missing field does not error and returns an empty string since missing keys are allowed by default",
    			templateArg:      "{ .metadata.missing }",
    			expectedOutput:   "",
    			allowMissingKeys: nil,
    		},
    		{
    			name:             "missing field returns expected error if field is missing and allowMissingKeys is explicitly set to false",
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Fri Jun 02 09:47:52 UTC 2023
    - 6.7K bytes
    - Viewed (0)
  6. staging/src/k8s.io/cli-runtime/pkg/printers/template.go

    		Parse(string(tmpl))
    	if err != nil {
    		return nil, err
    	}
    	return &GoTemplatePrinter{
    		rawTemplate: string(tmpl),
    		template:    t,
    	}, nil
    }
    
    // AllowMissingKeys tells the template engine if missing keys are allowed.
    func (p *GoTemplatePrinter) AllowMissingKeys(allow bool) {
    	if allow {
    		p.template.Option("missingkey=default")
    	} else {
    		p.template.Option("missingkey=error")
    	}
    }
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu Mar 07 23:00:24 UTC 2019
    - 3.4K bytes
    - Viewed (0)
  7. staging/src/k8s.io/cli-runtime/pkg/printers/interface.go

    	Wide          bool
    	ShowLabels    bool
    	Kind          schema.GroupKind
    	ColumnLabels  []string
    
    	SortBy string
    
    	// indicates if it is OK to ignore missing keys for rendering an output template.
    	AllowMissingKeys bool
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Mar 30 00:36:07 UTC 2022
    - 1.5K bytes
    - Viewed (0)
  8. staging/src/k8s.io/apiextensions-apiserver/pkg/registry/customresource/tableconvertor/tableconvertor.go

    		path := jsonpath.New(col.Name)
    		if err := path.Parse(fmt.Sprintf("{%s}", col.JSONPath)); err != nil {
    			return c, fmt.Errorf("unrecognized column definition %q", col.JSONPath)
    		}
    		path.AllowMissingKeys(true)
    
    		desc := fmt.Sprintf("Custom resource definition column (in JSONPath format): %s", col.JSONPath)
    		if len(col.Description) > 0 {
    			desc = col.Description
    		}
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Mar 23 20:21:32 UTC 2022
    - 5.2K bytes
    - Viewed (0)
  9. pkg/test/util/structpath/instance.go

    		parser := jsonpath.New("path")
    		err := parser.Parse(i.fixPath(path))
    		if err != nil {
    			return fmt.Errorf("invalid path: %v - %v", path, err)
    		}
    		values, err := parser.AllowMissingKeys(true).FindResults(i.structure)
    		if err != nil {
    			return fmt.Errorf("err finding results for path: %v - %v", path, err)
    		}
    		if len(values) == 0 {
    			return nil
    		}
    		if len(values[0]) > 0 {
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Mon Jul 25 19:30:47 UTC 2022
    - 9.4K bytes
    - Viewed (0)
  10. staging/src/k8s.io/apiextensions-apiserver/pkg/registry/customresource/strategy.go

    	result := make([]selectableField, len(selectableFields))
    	for i, sf := range selectableFields {
    		name := strings.TrimPrefix(sf.JSONPath, ".")
    
    		parser := jsonpath.New("selectableField")
    		parser.AllowMissingKeys(true)
    		err := parser.Parse("{" + sf.JSONPath + "}")
    		if err == nil {
    			result[i] = selectableField{
    				name:      name,
    				fieldPath: parser,
    			}
    		} else {
    			result[i] = selectableField{
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Feb 28 21:22:34 UTC 2024
    - 14.9K bytes
    - Viewed (0)
Back to top