Permalink
Browse files

Support mashed flags. -iH --> -i -H

  • Loading branch information...
1 parent 0f3c263 commit 48c974c2628e1db04e824b16b54fc74e3fd92458 @isaacs isaacs committed Dec 21, 2010
Showing with 11 additions and 1 deletion.
  1. +11 −1 lib/jsonCommand.js
View
@@ -84,6 +84,16 @@ JSON.Command.prototype.processArgs = function processArgs(args) {
// copy argv to chop it up
var a = args.slice(0);
+ // turn -iH into -i -H
+ // nb: don't cache length. it may change.
+ for (var i = 0; i < a.length; i ++) {
+ if (a[i].charAt(0) === "-" && a[i].length > 2) {
+ var arg = a[i].replace(/^-+/, "").split("").map(function (a) {
+ return "-" + a;
+ });
+ a.splice.apply(a, [i, 1].concat(arg));
+ }
+ }
while (a.length > 0) {
var arg = a.shift();
@@ -289,7 +299,7 @@ JSON.Command.prototype.processObjects = function(objects) {
this.printex(ex);
}
- try {
+ try {
for (var i = 0; (i < (objects.length)); i++) {
// if there's no object, there's nothing to do
// (null object is not the same as string null)

0 comments on commit 48c974c

Please sign in to comment.