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

Enhancement: Allow to customize mage's Main func #445

Open
cardil opened this issue Sep 19, 2022 · 0 comments · May be fixed by #442
Open

Enhancement: Allow to customize mage's Main func #445

cardil opened this issue Sep 19, 2022 · 0 comments · May be fixed by #442

Comments

@cardil
Copy link

cardil commented Sep 19, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant