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
I love the nested [ . . . ] form that you've settled on, here. I'd totally be down for using that for tasks like this.
However, a pattern I've seen round 'n about, is something like this:
--beep boop --beep -a=3, with the argument following each invocation of the name being passed through.
Concerns: this adds at least one, if not two, new layers of complexity; these need their own, individual consideration:
subarg would need knowledge of the names of the coming ‘pieces of code’ at parse-time; instead of those being flexible, and simply dropping into an argument-structure. Not Very Minimist™. Maybe there's a way around that.
if the form --beep -a 3 were to be supported, then subarg would have to collaborate with subordinate minimist invocations (to find out if -a consumes the forthcoming 3, presumably), which comes damn close to defeating the point. Luckily, I feel like that's an edge case, and forcing the -a=3 or -a3 instead of -a 3 is an acceptable compromise.
Perhaps not something to attack just yet; instead, an observation.
var split = require('split-by');
var minimist = require('minimist');
var parts = split(process.argv.slice(2), [ '--beep' ]);
var beeps = parts.map(minimist);
console.log(beeps);
Er, that's not at all what I was suggesting (although a very similar approach to yours obviously makes this use-case pretty easy to simulate on the consumer's side):
https://web.archive.org/web/20201110211134/https://github.com/substack/subarg/issues/1
Filed by @ELLIOTTCABLE
Response by @substack:
Response by @ELLIOTTCABLE:
Response by @substack:
The text was updated successfully, but these errors were encountered: