-
Notifications
You must be signed in to change notification settings - Fork 4
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
INIT: Enable Extension to Extend Flag in Ignite Command Using Hook #118
Comments
I am not sure if this is very useful. What is the use case? |
If you want to parse the output of a flag from the command into the hooks, for instance, if you create a hook for the |
Alright, but how will an app use that? |
For instance, if you want to add a flag to the chain build command to run tests after the build: func (app) Manifest(context.Context) (*plugin.Manifest, error) {
return &plugin.Manifest{
Name: "hooks",
Hooks: []*plugin.Hook{
{
Name: "chain-build",
PlaceHookOn: "ignite chain build",
Flags: []*plugin.Flag{
{
Name: "run-test",
Usage: "Run tests after build",
DefaultValue: "false",
Type: plugin.FlagTypeString,
},
},
},
},
Commands: cmd.GetCommands(),
}, nil
}
func (app) ExecuteHookPost(_ context.Context, hook *plugin.ExecutedHook, _ plugin.ClientAPI) error {
var (
flags = hook.Hook.Flags
runTests = flags.GetBool("run-test")
)
if runTests != "" {
tests.Run()
}
return nil
} And now you can use |
Like that, I get it better now. Is it, however, really something we want to allow? Do we actually already need this feature for something? |
Discussed on Slack. I get it and it makes sense to add the feature. |
No description provided.
The text was updated successfully, but these errors were encountered: