-
Notifications
You must be signed in to change notification settings - Fork 271
Description
Describe the feature
Allowing to customize the mage's main function would be beneficial in some situations. Current, code is half there to allow custom processing in main func. We have public ParseAndRun
, Invocation
, Command
, and Parse
functions, but some things are missing. To customize and execute already parsed Invocation
, one need to have 2 additional missing bits:
- function to handle parsing errors
- function that run
Invocation
, andCommand
pair.
Both of those are currently an internal implementation of ParseAndRun
. Splitting this function to separate public functions will allow for such customization.
What problem does this feature address?
Users might want to customize Invocation
struct after parsing. For example, I want to contain mage in a build
subdirectory, with its own go.mod
file. To accomplish that, I like to set the following values on Invocation
:
inv.WorkDir = ".."
inv.Dir = "."
Of course, people could like to customize the execution in some other way as well.