MCPcopy Index your code
hub / github.com/databus23/helm-diff / revisionCmd

Function revisionCmd

cmd/revision.go:41–80  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

39`
40
41func revisionCmd() *cobra.Command {
42 diff := revision{}
43 revisionCmd := &cobra.Command{
44 Use: "revision [flags] RELEASE REVISION1 [REVISION2]",
45 Short: "Shows diff between revision's manifests",
46 Long: revisionCmdLongUsage,
47 RunE: func(cmd *cobra.Command, args []string) error {
48 // Suppress the command usage on error. See #77 for more info
49 cmd.SilenceUsage = true
50
51 if v, _ := cmd.Flags().GetBool("version"); v {
52 fmt.Println(Version)
53 return nil
54 }
55
56 switch {
57 case len(args) < 2:
58 return errors.New("Too few arguments to Command \"revision\".\nMinimum 2 arguments required: release name, revision")
59 case len(args) > 3:
60 return errors.New("Too many arguments to Command \"revision\".\nMaximum 3 arguments allowed: release name, revision1, revision2")
61 }
62
63 ProcessDiffOptions(cmd.Flags(), &diff.Options)
64
65 diff.release = args[0]
66 diff.revisions = args[1:]
67 return diff.differentiateHelm3()
68 },
69 }
70
71 revisionCmd.Flags().BoolVar(&diff.detailedExitCode, "detailed-exitcode", false, "return a non-zero exit code when there are changes")
72 revisionCmd.Flags().BoolVar(&diff.includeTests, "include-tests", false, "enable the diffing of the helm test hooks")
73 revisionCmd.Flags().BoolVar(&diff.normalizeManifests, "normalize-manifests", false, "normalize manifests before running diff to exclude style differences from the output")
74 revisionCmd.Flags().StringVar(&diff.kubeContext, "kube-context", "", "name of the kubeconfig context to use")
75 AddDiffOptions(revisionCmd.Flags(), &diff.Options)
76
77 revisionCmd.SuggestionsMinimumDistance = 1
78
79 return revisionCmd
80}
81
82func (d *revision) differentiateHelm3() error {
83 namespace := os.Getenv("HELM_NAMESPACE")

Callers 1

NewFunction · 0.85

Calls 3

differentiateHelm3Method · 0.95
ProcessDiffOptionsFunction · 0.85
AddDiffOptionsFunction · 0.85

Tested by

no test coverage detected