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

Decouple ParseAndRun to allow customization of Invocation #442

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cardil
Copy link

@cardil cardil commented Sep 16, 2022

Fixes #445

I'm introducing two functions Run and HandleParseError which allow users to customize the Invocation after it is parsed.

For example:

inv, cmd, err := Parse(stderr, stdout, args)
if retcode, doExit := HandleParseError(err, stderr); doExit {
  return retcode
}
inv.Stdin = stdin

# example customization
inv.WorkDir = ".." 
inv.Dir = "."

return Run(inv, cmd)

@cardil cardil force-pushed the feature/decouple-parse-run branch from 2744c9f to e864580 Compare September 18, 2022 20:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enhancement: Allow to customize mage's Main func
1 participant