Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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

  • Loading branch information...
commit 48c974c2628e1db04e824b16b54fc74e3fd92458 1 parent 0f3c263
Isaac Z. Schlueter authored

Showing 1 changed file with 11 additions and 1 deletion. Show diff stats Hide diff stats

  1. 12  lib/jsonCommand.js
12  lib/jsonCommand.js
@@ -84,6 +84,16 @@ JSON.Command.prototype.processArgs = function processArgs(args) {
84 84
 
85 85
   // copy argv to chop it up
86 86
   var a = args.slice(0);
  87
+  // turn -iH into -i -H
  88
+  // nb: don't cache length.  it may change.
  89
+  for (var i = 0; i < a.length; i ++) {
  90
+    if (a[i].charAt(0) === "-" && a[i].length > 2) {
  91
+      var arg = a[i].replace(/^-+/, "").split("").map(function (a) {
  92
+        return "-" + a;
  93
+      });
  94
+      a.splice.apply(a, [i, 1].concat(arg));
  95
+    }
  96
+  }
87 97
 
88 98
   while (a.length > 0) {
89 99
     var arg = a.shift();
@@ -289,7 +299,7 @@ JSON.Command.prototype.processObjects = function(objects) {
289 299
     this.printex(ex);
290 300
   }
291 301
 
292  
-  try { 
  302
+  try {
293 303
     for (var i = 0; (i < (objects.length)); i++) {
294 304
       // if there's no object, there's nothing to do 
295 305
       //  (null object is not the same as string null)

0 notes on commit 48c974c

Please sign in to comment.
Something went wrong with that request. Please try again.