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

execParser with specified command-line arguments #101

Closed
jml opened this issue Aug 17, 2014 · 2 comments
Closed

execParser with specified command-line arguments #101

jml opened this issue Aug 17, 2014 · 2 comments

Comments

@jml
Copy link

jml commented Aug 17, 2014

Related to #100

I have a command-line tool which allows users to specify a default subcommand in their configuration file. To make this work I need to have a function that goes from Config -> CommandLineOptions -> Command

What I'd like to have in optparse-applicative is a helper that looks something like:

execParserWithArgs :: ParserInfo a -> [String] -> IO a
execParserWithArgs opts args =
  handleParseResult $ execParserPure (prefs idm) opts args

That lets me specify command-line options manually.

@pcapriotti
Copy link
Owner

What is the problem with defining execParserWithArgs within your program? I'm hesitant to add a convenience function to the API for every possible way of running a parser. I actually think there are too many already.

@jml
Copy link
Author

jml commented Aug 20, 2014

Nothing really. I thought that since there are so many, one more wouldn't hurt.

@jml jml closed this as completed Aug 20, 2014
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

No branches or pull requests

2 participants