Comparing version 0.4.0 to 0.5.0
19
make.js
@@ -6,5 +6,14 @@ require('./global'); | ||
var args = process.argv.slice(2), | ||
targetArgs, | ||
dashesLoc = args.indexOf('--'); | ||
// split args, everything after -- if only for targets | ||
if (dashesLoc > -1) { | ||
targetArgs = args.slice(dashesLoc + 1, args.length); | ||
args = args.slice(0, dashesLoc); | ||
} | ||
// This ensures we only execute the script targets after the entire script has | ||
// been evaluated | ||
var args = process.argv.slice(2); | ||
setTimeout(function() { | ||
@@ -25,4 +34,4 @@ var t; | ||
// Wrap it | ||
global.target[t] = function(force) { | ||
if (oldTarget.done && !force) | ||
global.target[t] = function() { | ||
if (oldTarget.done) | ||
return; | ||
@@ -40,3 +49,3 @@ oldTarget.done = true; | ||
if (arg in global.target) | ||
global.target[arg](); | ||
global.target[arg](targetArgs); | ||
else { | ||
@@ -47,5 +56,5 @@ console.log('no such target: ' + arg); | ||
} else if ('all' in global.target) { | ||
global.target.all(); | ||
global.target.all(targetArgs); | ||
} | ||
}, 0); |
{ | ||
"name": "shelljs", | ||
"version": "0.4.0", | ||
"author": "Artur Adib <aadib@mozilla.com>", | ||
"version": "0.5.0", | ||
"author": "Artur Adib <arturadib@gmail.com>", | ||
"description": "Portable Unix shell commands for Node.js", | ||
@@ -6,0 +6,0 @@ "keywords": [ |
@@ -135,6 +135,16 @@ # ShellJS - Unix shell commands for Node.js [![Build Status](https://secure.travis-ci.org/arturadib/shelljs.png)](http://travis-ci.org/arturadib/shelljs) | ||
To run the target `all`, call the above script without arguments: `$ node make`. To run the target `docs`: `$ node make docs`, and so on. | ||
To run the target `all`, call the above script without arguments: `$ node make`. To run the target `docs`: `$ node make docs`. | ||
You can also pass arguments to your targets by using the `--` separator. For example, to pass `arg1` and `arg2` to a target `bundle`, do `$ node make bundle -- arg1 arg2`: | ||
```javascript | ||
require('shelljs/make'); | ||
target.bundle = function(argsArray) { | ||
// argsArray = ['arg1', 'arg2'] | ||
/* ... */ | ||
} | ||
``` | ||
<!-- | ||
@@ -554,8 +564,7 @@ | ||
```javascript | ||
var config = require('shelljs').config; | ||
var silentState = config.silent; // save old silent state | ||
config.silent = true; | ||
var sh = require('shelljs'); | ||
var silentState = sh.config.silent; // save old silent state | ||
sh.config.silent = true; | ||
/* ... */ | ||
config.silent = silentState; // restore old silent state | ||
sh.config.silent = silentState; // restore old silent state | ||
``` | ||
@@ -570,2 +579,3 @@ | ||
```javascript | ||
require('shelljs/global'); | ||
config.fatal = true; | ||
@@ -572,0 +582,0 @@ cp('this_file_does_not_exist', '/dev/null'); // dies here |
@@ -138,6 +138,7 @@ // | ||
//@ ```javascript | ||
//@ var silentState = config.silent; // save old silent state | ||
//@ config.silent = true; | ||
//@ var sh = require('shelljs'); | ||
//@ var silentState = sh.config.silent; // save old silent state | ||
//@ sh.config.silent = true; | ||
//@ /* ... */ | ||
//@ config.silent = silentState; // restore old silent state | ||
//@ sh.config.silent = silentState; // restore old silent state | ||
//@ ``` | ||
@@ -153,2 +154,3 @@ //@ | ||
//@ ```javascript | ||
//@ require('shelljs/global'); | ||
//@ config.fatal = true; | ||
@@ -155,0 +157,0 @@ //@ cp('this_file_does_not_exist', '/dev/null'); // dies here |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
82106
1972
584