Repository navigation
pass flags to subcommands - #98
Conversation
|
This is really really great. Thanks @codyzu |
|
Glad to help! I could probably add tests for this module by mocking cross-spawn (I'm a fan of simple-mock)... would this be interesting to you guys? The other bin scripts seem harder to test because the flag validation is mixed in with the business logic, but maybe that could be improved later... What do you think? @rauchg? |
|
@codyzu that actually would be really awesome. One clever way to avoid mocking could be to test for the
A simple test for which help is reported (right now it incorrectly shows the Let me know what you think |
|
@rauchg ok, this would involve some tests that spawn the now script and capture stdout to verify the correct help message is outputted... that seems possible. I can add that to verify everything works together (more like an integration test). If you're not opposed, I'll give the mocking a stab (I've done this a lot during my day job) and see if the tests aren't too ugly. That way we can unit test all the flag combinations... Let me know if that's not direction you want to go. btw, I tested this pull request manually, so if you're feeling pressed to get the issue resolved and released, you can merge it and I'll create a new one for the tests. Otherwise I'll keep working on this one. |
|
ah yeah, @rauchg, it gets messy with mocks... maybe you saw that coming... trying to spawn a child process with mocks :-( no no... I'll stick with your test idea :-) |
7844cdd to
b3bcbf0
Compare
b3bcbf0 to
8316035
Compare
|
@rauchg I added the tests. I was forced to add compile as a This is ready to merge. Let me know what you think. |
|
@codyzu Thanks a lot! |
* Implement base generators API * Status updates * Update readme and events * Consistent lint and code cleanup * Improve error handling
Instead of assuming the subcommand is the first argument, this enhancement searches for the first valid subcommand in all of the process arguments. The result being the arguments are more or less "re-ordered" to push all the flags after the subcommand. Processing of the the help command was then refactored to work with the new parsing.
@leo @rauchg this fixes #3. Let me know if there is something I can improve. cheers!