Joey Mazzarelli avatar Joey Mazzarelli committed fb10e40

exit 0 on help, print -> puts

Comments (0)

Files changed (1)

 either expressed or implied, of Joey Mazzarelli.
 ***************************************************************************/
 
-var print       = require('sys').puts
+var puts        = require('sys').puts
   , values      = {}
   , args        = []
   , errors      = []
       if (!opts['-' + options[i].short]) {
         opts['-' + options[i].short] = options[i];
       } else {
-        print('Conflicting flags: -' + options[i].short);
+        puts('Conflicting flags: -' + options[i].short);
         process.exit(1);
       }
     }
       if (!opts['--' + options[i].long]) {
         opts['--' + options[i].long] = options[i];
       } else {
-        print('Conflicting flags: --' + options[i].long);
+        puts('Conflicting flags: --' + options[i].long);
         process.exit(1);
       }
     }
       // No match. If it starts with a dash, show an error. Otherwise
       // add it to the extra args.
       if (inp[0] == '-') {
-        print('Unknown option: ' + inp);
-        if (opts['--help']) print('Try --help');
+        puts('Unknown option: ' + inp);
+        if (opts['--help']) puts('Try --help');
         process.exit(1);
       } else {
         args.push(inp);
     }
   }
   if (errors.length) {
-    for (var i=0; i<errors.length; i++) print(errors[i]);
+    for (var i=0; i<errors.length; i++) puts(errors[i]);
     process.exit(1);
   }
 };
   for (var i=0; i<descriptors.length; i++) {
     var opt = descriptors[i];
     var line;
-    if (opt.description) print(opt.description);
+    if (opt.description) puts(opt.description);
     if (opt.short && !opt.long) line = '-' + opt.short;
     else if (opt.long && !opt.short) line = '--' + opt.long;
     else line = '-' + opt.short + ', --' + opt.long;
     if (opt.value) line += ' <value>';
     if (opt.required) line += ' (required)';
-    print('    ' + line);
+    puts('    ' + line);
   }
-  process.exit(1);
+  process.exit(0);
 };
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.