Add JBang example to the README/docs?
quintesse opened this issue · 2 comments
It might be interesting for potential users of of Lanterna to be able to very easily be able to see some results, for example by running the tutorials. This is very easy to do with JBang, for example:
jbang --deps com.googlecode.lanterna:lanterna:3.1.1 https://github.com/mabe02/lanterna/blob/master/src/test/java/com/googlecode/lanterna/tutorial/Tutorial04.java
you can even do the following without having to install JBang first:
curl -Ls https://sh.jbang.dev | bash -s - --deps com.googlecode.lanterna:lanterna:3.1.1 https://github.com/mabe02/lanterna/blob/master/src/test/java/com/googlecode/lanterna/tutorial/Tutorial04.java
or for PowerShell on Windows:
iex "& { $(iwr https://ps.jbang.dev) } --deps com.googlecode.lanterna:lanterna:3.1.1 https://github.com/mabe02/lanterna/blob/master/src/test/java/com/googlecode/lanterna/tutorial/Tutorial04.java"
As you can see that's all very "copy-pastable".
But that's not all; to avoid having to add the --deps com.googlecode.lanterna:lanterna:3.1.1
option each time you could consider adding a //DEPS com.googlecode.lanterna:lanterna:3.1.1
line to the start of the tutorial files, at which point the command to run the code would be simplified to:
jbang https://github.com/mabe02/lanterna/blob/master/src/test/java/com/googlecode/lanterna/tutorial/Tutorial04.java
And finally, if you'd be willing to add a jbang-catalog.json
file to your project users could even do something like:
jbang Tutorial04@mabe02/lanterna
If you're interested, let me know and I can create a PR for this or help you out in any way.
Disclaimer: I'm a dev on the JBang project
JBang doesn't implement ANSI escape codes or Swing windows, not seeing any benefit here.
@mabe02 why are you saying jbang needs to implement ansi and swing? jbang works with any java code, just like maven. The suggestion here is just to add example with jbang so its easy to get started with lanterna.