mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-29 01:10:04 +02:00
yay command option parsing makes more sense
This commit is contained in:
parent
6d58c928ae
commit
1ba46f7705
3 changed files with 19 additions and 19 deletions
|
@ -187,16 +187,14 @@ CommandOptionParser.prototype.explodeAndSet = function() {
|
|||
});
|
||||
}
|
||||
|
||||
// go through and include all the next args until we hit another option or the end
|
||||
var next = exploded[i + 1];
|
||||
var optionArgs = [];
|
||||
var next = i + 1;
|
||||
while (next < exploded.length && exploded[next].slice(0,1) != '-') {
|
||||
optionArgs.push(exploded[next]);
|
||||
next += 1;
|
||||
if (next && next.slice(0,1) !== '-') {
|
||||
// only store the next argument as this
|
||||
// option value if its not another option
|
||||
i++;
|
||||
optionArgs = [next];
|
||||
}
|
||||
i = next - 1;
|
||||
|
||||
// **phew** we are done grabbing those. theseArgs is truthy even with an empty array
|
||||
this.supportedMap[part] = optionArgs;
|
||||
} else {
|
||||
// must be a general arg
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue