Skip to content

Commit b5c1032

Browse files
committed
feat: enhance help output with detailed usage examples and descriptions
1 parent fb7b0cc commit b5c1032

File tree

1 file changed

+34
-5
lines changed

1 file changed

+34
-5
lines changed

cmd/kdiff/main.go

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,36 @@ var (
1818
var rootCmd = &cobra.Command{
1919
Use: "kdiff <namespace1> <resource1> <namespace2> <resource2>",
2020
Short: "Kubernetes resource differ",
21-
Long: `kdiff is a tool to compare Kubernetes resources between different namespaces.`,
21+
Long: `kdiff is a tool to compare Kubernetes resources between different namespaces.
22+
23+
Features:
24+
• Compare Kubernetes resources between any two namespaces
25+
• Colored diff output for better readability
26+
• Optional kubectl neat integration to clean output
27+
• Multiple output formats (unified, context, side-by-side)
28+
• Support for all Kubernetes resource types
29+
• Verbose logging for debugging
30+
31+
Examples:
32+
# Compare deployments between staging and production
33+
kdiff staging my-app production my-app
34+
35+
# Compare services with verbose output
36+
kdiff --verbose dev my-service prod my-service
37+
38+
# Compare without colored output
39+
kdiff --no-color namespace1 deployment/app namespace2 deployment/app
40+
41+
# Use context diff format
42+
kdiff --output context ns1 svc/api ns2 svc/api
43+
44+
# Compare with side-by-side format and skip kubectl neat
45+
kdiff --output side-by-side --no-neat ns1 pod/web ns2 pod/web
46+
47+
Prerequisites:
48+
• kubectl command-line tool
49+
• kubectl neat plugin (optional, for cleaner YAML output)
50+
• colordiff (optional, for colored output)`,
2251
Args: func(cmd *cobra.Command, args []string) error {
2352
// Allow version flag to bypass argument validation
2453
showVersion, _ := cmd.Flags().GetBool("version")
@@ -42,11 +71,11 @@ var rootCmd = &cobra.Command{
4271
}
4372

4473
func init() {
45-
rootCmd.Flags().BoolVar(&opts.NoColor, "no-color", false, "disable colored output")
46-
rootCmd.Flags().BoolVar(&opts.NoNeat, "no-neat", false, "skip kubectl neat processing")
74+
rootCmd.Flags().BoolVar(&opts.NoColor, "no-color", false, "disable colored output (useful for CI/CD pipelines)")
75+
rootCmd.Flags().BoolVar(&opts.NoNeat, "no-neat", false, "skip kubectl neat processing (show raw YAML)")
4776
rootCmd.Flags().StringVar(&opts.OutputFormat, "output", "unified", "output format: unified, context, side-by-side")
48-
rootCmd.Flags().BoolVar(&opts.Verbose, "verbose", false, "verbose logging")
49-
rootCmd.Flags().Bool("version", false, "print version")
77+
rootCmd.Flags().BoolVar(&opts.Verbose, "verbose", false, "enable verbose logging for debugging")
78+
rootCmd.Flags().Bool("version", false, "show version information")
5079
}
5180

5281
// Execute runs the root command - called from main.go

0 commit comments

Comments
 (0)