xtermjs / xtermjs.org

The website for xterm.js
https://xtermjs.org
MIT License
28 stars 33 forks source link

Simple echo demo for web terminal? #96

Open billyzkid opened 7 years ago

billyzkid commented 7 years ago

The existing demos I've seen demonstrate socket/pty/node integration with the xterm Terminal control, but what if I have a much simpler use case. I'd like to see a simple client-side-only "echo" demo -- display a prompt, read the user's input and echo it back out.

I see the existing demo alludes to a "fake" terminal which displays a prompt and writes keyboard input, but this does not show me how to read the user's input (especially when it spans multiple lines), how to wire up a standard keyboard shortcut (e.g. ctrl-c), etc.

Also, copy/paste and backspacing across multi-line input does not seem to be working in this scenario out-of-the-box so that would be nice to see too.

vincentwoo commented 7 years ago

To piggyback off this, I also think that the latest release should have a simple demo as described above available at http://xtermjs.org/

Tyriar commented 7 years ago

Seems like it would be a good improvement to add an input listener to the quick start :+1:

parisk commented 7 years ago

Good idea. I'll open up a branch in https://github.com/xtermjs/xtermjs.org.

BenHall commented 7 years ago

Katacoda is available for you if it's useful? Would users to deploy the node sample app without having to configure anything...

parisk commented 7 years ago

Thanks @BenHall for offering! Can you get into a little bit more details about what would this Node app do?

What might be useful would be if each visitor could get an actual Bash terminal connected to the front-end, but this is quite the opposite of the current issue.

vincentwoo commented 7 years ago

We at CoderPad might be willing to sponsor this demo in the future! We run a shit-ton of containers constantly, anyhow.

InDieTasten commented 7 years ago

Is this completed? Where can I find it?

@parisk I cannot find a branch besides master publicly available on GitHub

DRSDavidSoft commented 6 years ago

Subscribed for updates regarding this

LucianBuzzo commented 6 years ago

We're using a simple client side javascript REPL to demo our Terminal component (which wraps xterm) in rendition, you can see it in action here https://resin-io-modules.github.io/rendition/?selectedKind=Terminal&selectedStory=Standard&full=0&addons=1&stories=1&panelRight=0&addonPanel=storybook%2Factions%2Factions-panel Some of the source code could be leveraged to build a simple demo

santosh0705 commented 6 years ago

@LucianBuzzo could you share some more information or some demonstration code.

LucianBuzzo commented 6 years ago

@santosh0705 Here is the source code for a simple JS repl tethered to an xterm.js instance https://github.com/resin-io-modules/rendition/blob/master/src/stories/Terminal.js#L44 In the Rendition library, we add a simple wrapper around the xterm.js instance and expose it as this.tty.

wavesoft commented 5 years ago

If you want a more elaborate local-echo controller, you could use this : https://github.com/wavesoft/local-echo

jerch commented 4 years ago

Suggestion: