Command: Event Handlers
OnXXX event handlers...
Event Handlers Associated With Command (*CmdS)
The standard event handlers are:
.PreAction(...OnPreInvokeHandler).PostAction(...OnPostInvokeHandler).OnAction(...OnInvokeHandler).OnMatch(...OnCommandMatchedHandler)
They all fits for the lifecycle of a subcmd will be Invoking (OnAction), Before Invoking (PreAction) and After Invoking (PostAction).
In addition, there are more event handlers for loading subcmds or flags at runtime:
.OnEvalSubcommands(...).OnEvalSubcommandsOnce(...).OnEvalFlags(...).OnEvalFlagsOnce(...)
Besides that, a similar feature is loading alias subcmds from alias section in a config file:
.OnEvaluateSubCommandsFromConfig("alias")
About these handlers and howto write with its, refer to the source code of jump/to subcommand, and godoc of cmdr.v2.
额外的话题
How is this guide?
Edit on GitHub
Last updated on