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

Is possible to execute js code in the shell? #38

Open
teone opened this issue Aug 11, 2016 · 1 comment
Open

Is possible to execute js code in the shell? #38

teone opened this issue Aug 11, 2016 · 1 comment

Comments

@teone
Copy link
Contributor

teone commented Aug 11, 2016

Hey,
I'd like to use this shell to create a tutorial on basic js command, is somehow possible to execute js code in the console?

Thanks

@ghost
Copy link

ghost commented Nov 13, 2016

You can create a command that executes a JavaScript code string using eval().

Example:

shell.setCommandHandler("eval", {
    exec: function(cmd, args, callback) {
        callback(eval(args.join(" ")));
    }
});

// Shell
[1] $ eval "Hello, world!"
Hello, world!

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

1 participant