0.6.2 • Published 4 years ago
n_shell v0.6.2
n_shell
A node REPL with ShellJS loaded by default.
This was inspired by (and forked from) n_.
Like it?
Give it a star on Github
Installation:
$ npm install -g n_shellUsage:
Invoking n_shell starts a node REPL with ShellJS required globally, with
shell-like output:
bash $ n_shell
shelljs $ ls()
LICENSE
README.md
bin
node_modules
package.json
src
tmp
shelljs $ pwd()
/path/to/dirBut I don't want to use shelljs/global
No problem:
bash $ n_shell --no_global
shelljs $ typeof ls // not in the global namespace
'undefined'
shelljs $ shell.ls() // uses 'shell' prefix
LICENSE
README.md
bin
node_modules
package.json
src
tmp
shelljs $ shell.pwd()
/path/to/dirBut I want to use a different namespace
You're covered:
bash $ n_shell --no_global=$
shelljs $ $.ls() // now uses '$' as the prefix
LICENSE
README.md
bin
node_modules
package.json
src
tmp
shelljs $ $.pwd()
/path/to/dirBut I want to use a different version of ShellJS
Just install that version locally (npm install shelljs) and start up
n_shell with the --path option:
bash $ n_shell --path=node_modules/shelljs
shelljs $But I want plain JavaScript output
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
This supports any command that ShellJS supports. It also adds some extra commands, for convenience. So far, this adds:
shell.clear()(from shelljs-plugin-clear)shell.open()(from shelljs-plugin-open)shell.sleep()(from shelljs-plugin-sleep)
Options
--global: Start a node REPL with the equivalent ofrequire('shelljs/global'). This is the default behavior.--no_global [PREFIX],--local [PREFIX],-n [PREFIX]: Start a node REPL with the equivalent ofvar PREFIX = require('shelljs').PREFIXdefaults toshell, if not specified.--use_strict: enforce strict mode (default is false)--prompt <FORMAT>: use this format to generate the REPL prompt. Default is "shelljs %v%l $"%%: a literal%sign%v: show the current version (frompackage.json)%l: show[local]if this is using a local version of ShellJS- Want more format options? Let me know or send me a PR
--noinspect: disable the default--inspectbehavior. This provides 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 the output of each command. The return values are still ShellStrings, but appear more readable and shell-like. Also, commands with no arguments can be invoked without parentheses, such asshell.pwdandshell.ls. Recommended for ShellJS v0.7+. Credit for the idea goes to piranna.
History
Similarly to n_, n_shell stores REPL history under ~/.n_shell_history.
0.6.2
4 years ago
0.6.1
4 years ago
0.6.0
8 years ago
0.5.4
9 years ago
0.5.3
9 years ago
0.5.2
9 years ago
0.5.1
9 years ago
0.5.0
9 years ago
0.4.0
10 years ago
0.3.5
10 years ago
0.3.4
10 years ago
0.3.3
10 years ago
0.3.2
10 years ago
0.3.1
10 years ago
0.3.0
10 years ago
0.2.0
10 years ago
0.1.3
10 years ago
0.1.2
10 years ago
0.1.1
10 years ago
0.1.0
10 years ago