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

Adding commands in multiple places #25

Closed
czechboy0 opened this issue Feb 16, 2016 · 4 comments
Closed

Adding commands in multiple places #25

czechboy0 opened this issue Feb 16, 2016 · 4 comments

Comments

@czechboy0
Copy link

I'm struggling with using Curassow, because it's using Commander for input arguments. I'd like to add my own arguments and parse my app's specific ones only, and leave Curassow to parse its own as well. Unfortunately currently Commander errors out if any command is unused, making this usecase impossible.

Assuming I'm not missing anything, I'd like there to be an option to not error out when unrecognized arguments are passed, instead they'd be ignored, making multi-layer argument parsing possible.

@kylef
Copy link
Owner

kylef commented Feb 16, 2016

I think this is going to be problematic when the arguments clash, i-e, both tools offer a -b, --help etc, and makes it difficult to show intuitive help. It would also make it difficult to determine unhandled arguments and raise an error if a user tries to use an option or subcommand that does not exist.

I'd propose that Curassow provides an API that you can use to serve instead of using the command line interface, so you're free to add whatever handling you want. How does this sound?

@czechboy0
Copy link
Author

You're right, that's definitely a better way to do it. Let me know when there's an issue on Curassow that I can track, thanks!

@kylef
Copy link
Owner

kylef commented Feb 16, 2016

Perhaps it makes sense to go into kylef-archive/Curassow#12. That way, you can make an instance of the arbiter and run it.

let arbiter = Arbiter<SyncronousWorker>(workers: 3, addresses: [], timeout: 20, application: app)
try arbiter.run()

@czechboy0
Copy link
Author

Hmm that's fair, but I really like how I didn't have to worry about such details with serve(). Maybe just add another overloaded version of serve, which will take those three parameters, in addition to the application? And then make the current serve run Commander and pass the params into the new one? That way I can just use the non-CLI version of serve, and I still don't touch the implementation details (as much anyway) of Curassow.

@kylef kylef closed this as completed Mar 1, 2016
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