Anonymous avatar Anonymous committed f2c62e0

getting rid of sys module

Comments (0)

Files changed (8)

File contents unchanged.

File contents unchanged.

examples/example1.js

  *
  * Examples:
  *   $ node example1.js
- *   
+ *
  *   Example 1
  *   $ node example1.js -v
  *   > v1.0
  *         --help
  */
 
-var opts = require('./opts')
-  , puts = require('sys').puts;
+var opts = require('./../js/opts');
 
 var options = [
   { short       : 'v'
   , long        : 'version'
   , description : 'Show version and exit'
-  , callback    : function () { puts('v1.0'); process.exit(1); }
+  , callback    : function () { console.log('v1.0'); process.exit(1); }
   }
 ];
 
 opts.parse(options, true);
-puts('Example 1');
+console.log('Example 1');
 process.exit(0);
 
 

examples/example2.js

  * inconsistent. Choose the style that suits you best.
  */
 
-var opts = require('./opts')
-  , puts = require('sys').puts
+var opts = require('./../js/opts')
   , host = 'localhost'; // default host value
 
 var options = [
   { short       : 'v'
   , long        : 'version'
   , description : 'Show version and exit'
-  , callback    : function () { puts('v1.0'); process.exit(1); }
+  , callback    : function () { console.log('v1.0'); process.exit(1); }
   },
   { short       : 'l'
   , long        : 'list'
   , arg2 = opts.args()[1];
 
 
-if (list) puts('List arg was set');
-if (file) puts('File arg was set: ' + file);
-puts('Debug level is: ' + debug);
-puts('Host is: ' + host);
-puts('Port is: ' + port);
+if (list) console.log('List arg was set');
+if (file) console.log('File arg was set: ' + file);
+console.log('Debug level is: ' + debug);
+console.log('Host is: ' + host);
+console.log('Port is: ' + port);
 
-if (arg1) puts('Extra arg 1: ' + arg1);
-if (arg2) puts('Extra arg 2: ' + arg2);
+if (arg1) console.log('Extra arg 1: ' + arg1);
+if (arg2) console.log('Extra arg 2: ' + arg2);
 
 process.exit(0);
 

examples/example3.js

  *   > Conflicting flags: -v
  */
 
-var opts = require('./opts');
+var opts = require('./../js/opts');
 
 var options = [
   { short       : 'v'
 ];
 
 opts.parse(options);
-puts('Example 3');
+console.log('Example 3');
 process.exit(0);
 
 

examples/example4.js

  * and play with the options to see the behavior.
  */
 
-var opts = require('./opts')
-  , puts = require('sys').puts
+var opts = require('./../js/opts')
   , host = 'localhost'; // default host value
 
 // Example of using some library in the same app
   { short       : 'l'
   , long        : 'list'
   , description : 'Show the library list'
-  , callback    : function () { puts('mylib list!'); },
+  , callback    : function () { console.log('mylib list!'); },
   },
 ];
 opts.add(libOpts, 'mylib');
   , timeout = opts.arg('timeout') || 30;
 
 
-if (list) puts('List arg was set');
-puts('Debug level is: ' + debug);
-puts('Script is: ' + script);
-puts('Timeout is: ' + timeout);
+if (list) console.log('List arg was set');
+console.log('Debug level is: ' + debug);
+console.log('Script is: ' + script);
+console.log('Timeout is: ' + timeout);
 
 process.exit(0);
 
 either expressed or implied, of Joey Mazzarelli.
 ***************************************************************************/
 
-var puts        = require('sys').puts
+var puts        = console.log
   , values      = {}
   , args        = {}
   , argv        = []
 { "name" : "opts"
-, "version" : "1.2.0"
+, "version" : "1.2.1"
 , "description" : "Command line argument parser written in the style of commonjs. To be used with node.js"
 , "author" : "Joey Mazzarelli <mazzarelli@gmail.com> (http://joey.mazzarelli.com)"
 , "main" : "js/opts"
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.