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

Hook is not called when arg is empty #450

Open
b4nst opened this issue Aug 19, 2024 · 0 comments
Open

Hook is not called when arg is empty #450

b4nst opened this issue Aug 19, 2024 · 0 comments

Comments

@b4nst
Copy link

b4nst commented Aug 19, 2024

type tools []string

func (t *tools) BeforeResolve() error {
	fmt.Println("Hook")
	return nil
}

type Tool struct {
	Tools tools `arg:"" optional:"" help:"Filename of the tool to get information about. If empty, all tools from the toolbox are listed." type:"existingfile"` //nolint:lll // Struct tags are long.
}

BeforeResolve is only called if an arg is passed to the command. Is there a way to trigger it anyway (without adding a default value)?

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