diff --git a/pkg/cmd/run.go b/pkg/cmd/run.go index ae2be4f6..473d78de 100644 --- a/pkg/cmd/run.go +++ b/pkg/cmd/run.go @@ -53,17 +53,17 @@ type RunOptions struct { namespace string explicitNamespace bool - // Local to this command + // Flags local to this command container string eval string program string - resourceArg string - attach bool - isPod bool - podUID string serviceAccount string - nodeName string + resourceArg string + attach bool + isPod bool + podUID string + nodeName string clientConfig *rest.Config } diff --git a/pkg/cmd/trace.go b/pkg/cmd/trace.go index 255d4afa..7b4ed641 100644 --- a/pkg/cmd/trace.go +++ b/pkg/cmd/trace.go @@ -76,5 +76,18 @@ func NewTraceCommand(streams genericclioptions.IOStreams) *cobra.Command { cmd.AddCommand(NewVersionCommand(streams)) cmd.AddCommand(NewLogCommand(f, streams)) + // Override help on all the commands tree + walk(cmd, func(c *cobra.Command) { + c.Flags().BoolP("help", "h", false, fmt.Sprintf("Help for the %s command", c.Name())) + }) + return cmd } + +// walk calls f for c and all of its children. +func walk(c *cobra.Command, f func(*cobra.Command)) { + f(c) + for _, c := range c.Commands() { + walk(c, f) + } +}