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, and Command 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.
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, andParsefunctions, but some things are missing. To customize and execute already parsedInvocation, one need to have 2 additional missing bits:Invocation, andCommandpair.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
Invocationstruct after parsing. For example, I want to contain mage in abuildsubdirectory, with its owngo.modfile. To accomplish that, I like to set the following values onInvocation:Of course, people could like to customize the execution in some other way as well.