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

Too verbose error message when using Validate #332

Closed
mitar opened this issue Sep 14, 2022 · 7 comments · Fixed by #368
Closed

Too verbose error message when using Validate #332

mitar opened this issue Sep 14, 2022 · 7 comments · Fixed by #368

Comments

@mitar
Copy link
Contributor

mitar commented Sep 14, 2022

This might be nitpicking, but a simple program:

package main

import (
	"errors"

	"github.com/alecthomas/kong"
)

type Config struct{}

func (c Config) Validate() error {
	return errors.New("foobar")
}

func main() {
	var config Config
	kong.Parse(&config)
}

Outputs:

play: error: play: foobar

I find that double play in there ugly and unnecessary. Could it be removed?

@alecthomas
Copy link
Owner

For sure 👍

@mitar
Copy link
Contributor Author

mitar commented Sep 15, 2022

Any hint where would this be coming from? I tried to figure it out, but couldn't find it (yet).

@alecthomas
Copy link
Owner

I suspect that somewhere is using "FullCommand()" rather than "Command()"

@mitar
Copy link
Contributor Author

mitar commented Sep 15, 2022

So the issue comes from here. When node is application, it uses its name and prepends it. I would suggest that for application node nothing is prepended.

@mitar
Copy link
Contributor Author

mitar commented Oct 5, 2022

Can I do PR doing this?

@alecthomas
Copy link
Owner

Of course :)

@mitar
Copy link
Contributor Author

mitar commented Jul 21, 2023

I made a PR #368 to fix this.

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

Successfully merging a pull request may close this issue.

2 participants