1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2024-12-15 17:51:20 +00:00

Updated jp command flags and also added URL for help. (#4122)

Signed-off-by: viveksahu26 <vivekkumarsahu650@gmail.com>
This commit is contained in:
vivek kumar sahu 2022-06-16 14:59:47 +05:30 committed by GitHub
parent 65a812db4c
commit 0fe8dcb3b6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -15,6 +15,10 @@ import (
"sigs.k8s.io/yaml"
)
var applyHelp = `
For more information visit: https://kyverno.io/docs/writing-policies/jmespath/
`
// Command returns jp command
func Command() *cobra.Command {
var compact, unquoted, ast, listFunctions bool
@ -23,6 +27,7 @@ func Command() *cobra.Command {
Use: "jp",
Short: "Provides a command-line interface to JMESPath, enhanced with Kyverno specific custom functions",
SilenceUsage: true,
Example: applyHelp,
RunE: func(cmd *cobra.Command, args []string) error {
if listFunctions {
printFunctionList()
@ -111,7 +116,7 @@ func Command() *cobra.Command {
cmd.Flags().BoolVarP(&unquoted, "unquoted", "u", false, "If the final result is a string, it will be printed without quotes")
cmd.Flags().BoolVar(&ast, "ast", false, "Only print the AST of the parsed expression. Do not rely on this output, only useful for debugging purposes")
cmd.Flags().StringVarP(&exprFile, "expr-file", "e", "", "Read JMESPath expression from the specified file")
cmd.Flags().StringVarP(&filename, "filename", "f", "", "Read input JSON from a file instead of stdin")
cmd.Flags().StringVarP(&filename, "filename", "f", "", "Accepts input as JSON file or YAML file instead of stdin")
return cmd
}