Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use REPL module #3

Open
piranna opened this issue Jun 15, 2014 · 1 comment
Open

Use REPL module #3

piranna opened this issue Jun 15, 2014 · 1 comment

Comments

@piranna
Copy link
Collaborator

piranna commented Jun 15, 2014

By using the Node.js REPL module we get by free and heavily tested the readline and history and all the functionality available on the Node.js console, just would only need to set a custom eval() function to allow to instantiate system commands, but also we get a Javascript interpreter so we can use Javascript scripts and functions on the shell. For example, with some hacks, it would be feasable to do something like:

> ls -a  # Shell-like command
['.', '..']
> var a = ls('a')  // Javascript instruction
undefined
> console.log(a)
['.', '..']
> echo $a  // Echo would be an alias of console.log()
['.', '..']

The semantics would need a review, but but you can see what's the idea ;-)

@groundwater
Copy link
Owner

I like this idea.

I think it's parallel to nsh but I really like the idea of a JavaScript system REPL. CoffeeScript is a bit more terse however, and as much as I generally avoid it, it might make a better REPL.

There are a few difficulties around doing job-control, tty-stuff, and signal handling. Just warning you that there may be some madness going forward. You have to make sure that keyboard commands are sent to child processes such as vim when those programs are in the foreground.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants