nfischer / n_shell Goto Github PK
View Code? Open in Web Editor NEWA NodeJS REPL with ShellJS loaded by default
Home Page: https://www.npmjs.com/package/n_shell
License: MIT License
A NodeJS REPL with ShellJS loaded by default
Home Page: https://www.npmjs.com/package/n_shell
License: MIT License
Let's add an option to modify the prompt to look like:
shelljs v0.6.0 $
Also, we can have an option to do a custom prompt (like Bash's PS1
variable). One of the options could be version number. So it would mean that the default prompt looks something like --prompt='shelljs $ '
and the version-number prompt like --prompt='shelljs %v $ '
It'd be nice to reuse some of the tests written for n_, which uses the mocha framework and jshint.
If anyone is interested in taking up a PR for this (which would be awesome!), please ping this thread to give me a heads up. This is pretty low on my priority list, but if you'd like to see unit tests to improve project stability, please let me know.
I noticed that n_shell --noinspect
appears to still load shelljs-plugin-inspect
even though the switch is documented as not doing that. This should probably be fixed.
The shelljs plugins are outdated, and they cause a conflict with newer shelljs versions.
Also, shelljs probably shouldn't be a *
dependency
This is a feature idea I have right now, for how to make this more usable. I'd like to see tab completion, not only for variables, but also for strings representing paths on the file system (similar to how Bash works by default).
$ ls()
foo.txt
bar.txt
baz.txt
$ cat('b➡️
$ cat('bar.txt'➡️
$ cat('baz.txt');
this is the context of baz.txt
The ➡️
denotes when I would press tab
. Tab completion would happen in-place, not on a new line, but it was easier to show my idea this way.
It'd be even better if tab completion worked on other paths, such as cat('~/.bas➡️
➡️ cat('~/.bashrc');
.
Looks like this was deprecated in v12 and removed in v16. https://nodejs.org/api/deprecations.html#DEP0124. I think this usage is coming from tmpvar/repl.history#15.
It looks like node v12's REPL will run javascript code as you type it into the console. This has some annoying interactions with shelljs commands though because:
shell.clear()
clears the console)n_shell
has a feature to execute commands without typing parentheses (ex. ls<CR>
is the same as ls()<CR>
)These combine to make for a really unpleasant user experience. Ex. typing touch
(without pressing enter) will cause touch()
to be eagerly executed by the REPL preview, which outputs an error (touch: no files given
).
Maybe we should just disable the feature referenced in (2) and require parentheses. For some reason the node REPL won't show the preview for ls()
, only for ls
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.