Comparing version 0.1.0 to 0.1.1
{ | ||
"name": "n_shell", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "A node REPL with ShellJS loaded by default", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -90,2 +90,10 @@ # n_shell | ||
- `--use_strict`: enforce strict mode (default is false) | ||
- `--prompt <FORMAT>`: use this format to generate the REPL prompt. Default is | ||
"`shelljs %v%l $ `" | ||
- `%v`: show the current version (from `package.json`) | ||
- `%l`: show ` [local]` if this is installed from a local module (whenever | ||
the warning message above would be printed) | ||
- Warn more formats options? [Let me | ||
know](https://github.com/nfischer/n_shell/issues/new) or [send me a | ||
PR](https://github.com/nfischer/n_shell/compare) | ||
@@ -92,0 +100,0 @@ ## History |
@@ -10,12 +10,30 @@ 'use strict'; | ||
var shell; | ||
var json; | ||
var isLocal; | ||
try { | ||
var localShellJS = path.resolve('./node_modules/shelljs'); | ||
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) { | ||
shell = require('shelljs'); | ||
json = require('shelljs/package.json') | ||
isLocal = false; | ||
} | ||
// Create the prompt | ||
var myprompt = argv.prompt || 'shelljs %v%l $ '; | ||
myprompt = myprompt.replace(/%./g, (function() { | ||
var option = { | ||
'%v': json.version, | ||
'%l': (isLocal ? ' [local]' : '') | ||
}; | ||
return function(match) { | ||
return option[match]; | ||
} | ||
})()); | ||
var replServer = repl.start({ | ||
prompt: "shelljs $ ", | ||
prompt: myprompt, | ||
replMode: process.env.NODE_REPL_MODE === 'strict' || argv['use_strict'] ? repl.REPL_MODE_STRICT : repl.REPL_MODE_MAGIC | ||
@@ -22,0 +40,0 @@ }); |
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
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
5737
54
102
6
6