Comparing version 0.4.0 to 0.5.0
@@ -14,7 +14,8 @@ #!/usr/bin/env node | ||
try { | ||
var localShellJS = path.resolve('./node_modules/shelljs'); | ||
if (argv.path[0] === '~') | ||
argv.path = argv.path.replace('~', osHomedir()); | ||
var localShellJS = path.resolve(argv.path); | ||
shell = require('require-relative')(localShellJS, process.cwd()); | ||
json = require(path.join(localShellJS, 'package.json')); | ||
isLocal = true; | ||
console.warn('Warning: using shelljs found at ' + localShellJS); | ||
} catch (e) { | ||
@@ -83,3 +84,5 @@ shell = require('shelljs'); | ||
for (var key in shell) { | ||
shell[key] = wrap(shell[key], key); | ||
try { | ||
shell[key] = wrap(shell[key], key); | ||
} catch (e) {} | ||
} | ||
@@ -86,0 +89,0 @@ } |
{ | ||
"name": "n_shell", | ||
"version": "0.4.0", | ||
"version": "0.5.0", | ||
"description": "A node REPL with ShellJS loaded by default", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -21,16 +21,17 @@ # n\_shell | ||
Invoking `n_shell` starts a node REPL with ShellJS required globally: | ||
Invoking `n_shell` starts a node REPL with ShellJS required globally, with | ||
shell-like output: | ||
```javascript | ||
```Bash | ||
bash $ n_shell | ||
shelljs $ ls() | ||
[ 'LICENSE', | ||
'README.md', | ||
'bin', | ||
'node_modules', | ||
'package.json', | ||
'src', | ||
'tmp' ] | ||
LICENSE | ||
README.md | ||
bin | ||
node_modules | ||
package.json | ||
src | ||
tmp | ||
shelljs $ pwd() | ||
'/path/to/dir' | ||
/path/to/dir | ||
``` | ||
@@ -42,3 +43,3 @@ | ||
```javascript | ||
``` | ||
bash $ n_shell --no_global | ||
@@ -48,11 +49,11 @@ shelljs $ typeof ls // not in the global namespace | ||
shelljs $ shell.ls() // uses 'shell' prefix | ||
[ 'LICENSE', | ||
'README.md', | ||
'bin', | ||
'node_modules', | ||
'package.json', | ||
'src', | ||
'tmp' ] | ||
LICENSE | ||
README.md | ||
bin | ||
node_modules | ||
package.json | ||
src | ||
tmp | ||
shelljs $ shell.pwd() | ||
'/path/to/dir' | ||
/path/to/dir | ||
``` | ||
@@ -64,14 +65,14 @@ | ||
```javascript | ||
``` | ||
bash $ n_shell --no_global=$ | ||
shelljs $ $.ls() // now uses '$' as the prefix | ||
[ 'LICENSE', | ||
'README.md', | ||
'bin', | ||
'node_modules', | ||
'package.json', | ||
'src', | ||
'tmp' ] | ||
LICENSE | ||
README.md | ||
bin | ||
node_modules | ||
package.json | ||
src | ||
tmp | ||
shelljs $ $.pwd() | ||
'/path/to/dir' | ||
/path/to/dir | ||
``` | ||
@@ -82,10 +83,33 @@ | ||
Just install that version locally (`npm install shelljs`) and start up | ||
`n_shell`. You should see a warning message like this: | ||
`n_shell` with the `--path` option: | ||
``` | ||
bash $ n_shell | ||
Warning: using shelljs found at /path/to/dir/node_modules/shelljs | ||
bash $ n_shell --path=node_modules/shelljs | ||
shelljs $ | ||
``` | ||
### But I want plain JavaScript output | ||
```javascript | ||
bash $ n_shell --noinspect | ||
shelljs $ ls() | ||
[ 'LICENSE', | ||
'README.md', | ||
'index.js', | ||
'node_modules', | ||
'package.json', | ||
stdout: 'LICENSE\nREADME.md\nindex.js\nnode_modules\npackage.json\n', | ||
stderr: null, | ||
code: 0, | ||
to: [Function], | ||
toEnd: [Function], | ||
cat: [Function], | ||
head: [Function], | ||
sed: [Function], | ||
sort: [Function], | ||
tail: [Function], | ||
grep: [Function], | ||
exec: [Function] ] | ||
``` | ||
## Available commands | ||
@@ -117,2 +141,4 @@ | ||
less-readable REPL output, but behaves just as a standard Node REPL would. | ||
- `--path=path/to/shelljs/`: the argument should be a path to a folder | ||
containing a ShellJS package. | ||
- `--inspect` (default): an experimental switch to add a `.inspect()` method to | ||
@@ -119,0 +145,0 @@ the output of each command. The return values are still ShellStrings, but |
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
8245
88
148