krew: Inconsistent program name in --help message

See the end, it doesn’t say kubectl krew

$ kubectl krew
[...]
Flags:
  -h, --help      help for krew
  -v, --v Level   number for the log level verbosity

Use "krew [command] --help" for more information about a command.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 17 (17 by maintainers)

Commits related to this issue

Most upvoted comments

If the patch is trivial btw I might be able to get it merged. Just let me know.

Has anyone asked cobra yet?

I worked up a little example that I think illustrates the problem from cobra’s perspective:

main.go

package main

import (
	"github.com/spf13/cobra"
)

func main() {
	var rootCmd = &cobra.Command{
		Use: "kubectl myplugin",
	}

	rootCmd.AddCommand(&cobra.Command{
		Use: "dosomething",
		Run: func(cmd *cobra.Command, args []string) {
		},
	})

	_ = rootCmd.Execute()
}

Default help for root command when running without a command:

go run main.go
Usage:
  kubectl [command]

Available Commands:
  dosomething 
  help        Help about any command

Flags:
  -h, --help   help for kubectl

Use "kubectl [command] --help" for more information about a command.

Help for a specific command:

go run main.go dosomething --help
Usage:
  kubectl dosomething [flags]

Flags:
  -h, --help   help for dosomething