picocli
picocli copied to clipboard
picoli terminal embeeded in webpage
Can picoli terminal be used in a webbrowser like https://beryx.org/blog/2017-01-09-/java-console-applications-for-the-web/ (https://github.com/beryx/text-io)?
Looking at the example of https://picocli.info/quick-guide.html#_asciiart_execution_try_it, there seems to be possible as there is a terminal embeeded within a webpage, but I cannot find how this is done. Maybe, a new packaging in https://picocli.info/#_packaging_your_application is required? Something like packaging the picoli app with a index.html which embeeds the picoli terminal?
Looking at the example of https://picocli.info/quick-guide.html#_asciiart_execution_try_it, there seems to be possible as there is a terminal embeeded within a webpage, but I cannot find how this is done.
This was done by making use of the JDoodle platform which is completely indepent from Picocli. JDoodle offers a basic plan free of charge.
Embedding the terminal into the quick start page was basically a one-liner. This is the raw html I had to insert:
<div data-pym-src="https://www.jdoodle.com/embed/v0/2nfL?stdin=1&arg=1"></div>
There is a blog post that explains the details.
Note: I had loosse contact to the maintainers of JDoodle
and they very responsive and friendly, so you may give JDoodle a try.
An alternative to JDoodle could be repl.it. Having a look at this sample it looks like they allow you to embed a terminal into your web page, too. I don't have any experience with this platform, however.
Hope that helps!
Thank you @deining!
I think it would be nice if picoli provides some glue to use it with https://xtermjs.org/. With https://xtermjs.org/ (the terminal behind vscode), there seems to be no need to use jdoodle. Maybe picoli can use it also.
Sure. What do you have in mind? Will you be able to work on this and provide a pull request or something? I am a bit swamped with other commitments and won't be able to work on this myself.
I will look, first I have to learn more about picoli..I think about using quarkus with picoli with something like the following:
Provide a property: picoli.html = true
. When compiling, picoli generates a WebComponent (built by js/html) which uses xterm.js. The WebComponent can be included in any html-file. When opening the html.file, the terminal (backed by xterm.js) can be used with my picoli cli application. Picoli can use websocket under the hood to communicate to client terminal.