josh.js icon indicating copy to clipboard operation
josh.js copied to clipboard

Allow for all entered text to be handled by client

Open sknick opened this issue 11 years ago • 4 comments

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.

sknick avatar Jun 16 '14 13:06 sknick

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

stevenseeley avatar Jun 26 '14 18:06 stevenseeley

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 ;-)

stevenseeley avatar Jun 26 '14 18:06 stevenseeley

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

sdether avatar Jun 27 '14 06:06 sdether

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

sknick avatar Jun 27 '14 09:06 sknick