Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show errors on pgm startup #24

Open
giuliohome opened this issue Dec 9, 2022 · 1 comment
Open

Show errors on pgm startup #24

giuliohome opened this issue Dec 9, 2022 · 1 comment

Comments

@giuliohome
Copy link

Describe the bug
Show the errors and not the command help if the arguments are missing or correct and the runtime throws.

To Reproduce
Steps to reproduce the behavior:

  1. Stop your minikube (or whatever k8s you use)
  2. Start murre
  3. See the command help instead of the actual error

Expected behavior
The actual exception should be reported to the output: showing the command arguments help is misleading when there is no usage error in the command line itself!

@giuliohome
Copy link
Author

giuliohome commented Dec 9, 2022

At first sight, I'd guess the bug is here,

func Execute() error {
	return RootCmd.Execute()
}

and the correct way to do that is explained here:

if err := myCommand.Execute(); err != nil {
        // There was an error! Print the error message and exit. Or do whatever you'd like!
        // This includes errors like "invalid argument" etc.
	fmt.Println(err)
	os.Exit(1)
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant