You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How do you guys feel about switching from minimist to commander for the options parsing?
I think this will help with #3, #8, and #9. I think we can have better "fail fast" functionality and more descriptive code by moving to commander. It should remove a lot of the manually verification of options.
I'm working on an idea for #3 with commander, but I wanted to see if there were any objections before I put together a pull request...
Commander might be the industry's most used package for this purpose, but it's actually full of old code and bloated with unnecessary stuff. Let's go with args (like now-serve and list)! 😊
Is anyone interested in switching the project to args? Because that would it make it a lot easier for me to merge now-serve into now. If not, I'll tacke it!
@leo I worked out a proof of concept locally for #3, but it's independent of the args parser. So I haven't looked yet migrating to args. I don't want to slow you down if you're ready to make that migration.
I had a question fail fast (this issue and #8) and args. What I saw with how we use minimist and args is that each command checks the flags when it needs them. I guess we can move all of those controls the start of each script to enforce the fail fast. However, the default behavior of commander is to throw an error on invalid args, which I thought might be interesting for these issues. Anyways, I'm not sure if this is open to discussion, but I thought it was worth making that point.
In any case, I'm wondering if it would be worth decoupling the args parsing from the actual scripts? In theory this would allow us to write tests for the command line parsing (while mocking the lib). IMO this would add a lot of quality and add separation of concerns to the design.
To answer you question, I would be happy to look at #3 and the fail fast issues. But it seems migrating the args parser needs to be done first. If your ready to do that, you should go for it because I won't have many hours in the next days. If you have higher priorities, I can start working on it when I find those hours. Let me know what works best for you. We can chat more about these points on slack too...
@leo I've been looking at this again. I'm looking at how it could work with args, but I don't see an obvious way to catch unknown flags. I see minimist has the unknown config param that is called for unknown params, but it's not (yet) propagated into args.
Am I missing something? Or is this something we would want to add to args?
We started using commander, but for example we didn't have the ability to override quitting to make it wait on the update checker. It's very opinionated and tends to be quite inflexible sometimes.
Activity
codyzu commentedon Oct 20, 2016
How do you guys feel about switching from minimist to commander for the options parsing?
I think this will help with #3, #8, and #9. I think we can have better "fail fast" functionality and more descriptive code by moving to commander. It should remove a lot of the manually verification of options.
I'm working on an idea for #3 with commander, but I wanted to see if there were any objections before I put together a pull request...
OlliV commentedon Oct 20, 2016
I have been playing around with commander and it feels pretty good and simple to use. @leo @rauchg what do you think?
leo commentedon Oct 20, 2016
Commander might be the industry's most used package for this purpose, but it's actually full of old code and bloated with unnecessary stuff. Let's go with args (like now-serve and list)! 😊
leo commentedon Oct 21, 2016
Is anyone interested in switching the project to args? Because that would it make it a lot easier for me to merge now-serve into now. If not, I'll tacke it!
codyzu commentedon Oct 21, 2016
@leo I worked out a proof of concept locally for #3, but it's independent of the args parser. So I haven't looked yet migrating to args. I don't want to slow you down if you're ready to make that migration.
I had a question fail fast (this issue and #8) and args. What I saw with how we use minimist and args is that each command checks the flags when it needs them. I guess we can move all of those controls the start of each script to enforce the fail fast. However, the default behavior of commander is to throw an error on invalid args, which I thought might be interesting for these issues. Anyways, I'm not sure if this is open to discussion, but I thought it was worth making that point.
In any case, I'm wondering if it would be worth decoupling the args parsing from the actual scripts? In theory this would allow us to write tests for the command line parsing (while mocking the lib). IMO this would add a lot of quality and add separation of concerns to the design.
To answer you question, I would be happy to look at #3 and the fail fast issues. But it seems migrating the args parser needs to be done first. If your ready to do that, you should go for it because I won't have many hours in the next days. If you have higher priorities, I can start working on it when I find those hours. Let me know what works best for you. We can chat more about these points on slack too...
codyzu commentedon Nov 30, 2016
@leo I've been looking at this again. I'm looking at how it could work with args, but I don't see an obvious way to catch unknown flags. I see minimist has the
unknownconfig param that is called for unknown params, but it's not (yet) propagated into args.Am I missing something? Or is this something we would want to add to args?
leo commentedon Nov 30, 2016
@codyzu Looks like a great addition to me! Also: leo/args#45
rauchg commentedon Nov 30, 2016
We started using commander, but for example we didn't have the ability to override quitting to make it wait on the update checker. It's very opinionated and tends to be quite inflexible sometimes.
rauchg commentedon Nov 30, 2016
tl;DR: I'd rather re-implement checking for unknown flags rather than trade off flexibility
codyzu commentedon Nov 30, 2016
I assumed there must be a back story behind not using commander. That makes sense.
Thanks @leo, looks like leo/args#45 is the way to go. I'll look at that first...
rauchg commentedon Mar 15, 2018
Replaced by #1171
JSON log the deployment body when debugging (#8)
Added support for Now 2.0 (#1636)
Added support for Now 2.0 (#1636)
ci: bump node to 16 (#8)