sdether / josh.js

Toolkit for building a bash-like shell in the browser, including full readline support
http://sdether.github.com/josh.js/
Apache License 2.0
390 stars 76 forks source link

Allow for all entered text to be handled by client #22

Open sknick opened 10 years ago

sknick commented 10 years ago

I may be missing something, but it doesn't appear that the API for the shell allows you to simply apply a command handler to any text entered; rather, you must specify command handlers for each possible command the user can run. In my case, I'm trying to use the shell as a front-end to commands that are run via remote SSH on a real Linux system. As a result, I want the remote system to handle the command and simply use the shell to display the result. What would it take to do that? Is that feasible now without a code change? I haven't discovered a way yet.

stevenseeley commented 10 years ago

I with you on this, waiting on an answer...

stevenseeley commented 10 years ago

Duuuuuuuuude, I found the answer: overwrite the default handler itself with 'shell.setCommandHandler("_default" '...I found it in https://github.com/sdether/josh.js/blob/master/js/pathhandler.js#L58 ;-)

sdether commented 10 years ago

Sorry guys for being so tardy. I'm currently out of town but in cat @net-ninja's answwer isn't what you were looking for, i will get back to you with an answer next week

sknick commented 10 years ago

This is a great library, but I had some unique considerations that ultimately made me "roll my own" command shell, so to speak. I used this implementation as the basis for mine, but it's not a copy-and-paste reimplementation at all. If you happen to use the Echo 3 framework (and if you don't, I highly recommend it), you might find my implementation useful:

http://echo.nextapp.com/site/node/6843