AndyObtiva / glimmer

DSL Framework consisting of a DSL Engine and a Data-Binding Library used in Glimmer DSL for SWT (JRuby Desktop Development GUI Framework), Glimmer DSL for Opal (Pure Ruby Web GUI), Glimmer DSL for LibUI (Prerequisite-Free Ruby Desktop Development GUI Library), Glimmer DSL for Tk (Ruby Tk Desktop Development GUI Library), Glimmer DSL for GTK (Ruby-GNOME Desktop Development GUI Library), Glimmer DSL for XML (& HTML), and Glimmer DSL for CSS
MIT License
550 stars 17 forks source link

[Idea/Suggestion - please feel free to ignore/close at any moment in time] Glimmer for the terminal? #23

Open rubyFeedback opened 2 years ago

rubyFeedback commented 2 years ago

Heya Andy,

Recently there was a question on the ruby reddit site:

https://old.reddit.com/r/ruby/comments/vylge0/what_library_can_i_use_to_create_a_tui/

The shortish question asked by the threadstarter was:

"[What library can I use to create a TUI"

Some links given were:

https://ttytoolkit.org/ https://github.com/Shopify/cli-ui

The shopify UI is quite interesting, you can select the entries and have them appear in different colours.

Here is that example: https://user-images.githubusercontent.com/3074765/33797984-0ebb5e64-dcdf-11e7-9e7e-7204f279cece.gif

Anyway. I am not suggesting you use ncurses - I myself hate the ncurses API so I don't recommend to people use it when I dislike it. :P But some projects created with it are quite nice. For instance, the linux distribution GoboLinux had AbsTK (abstract toolkit) and it combined a terminal interface as well as a GUI, for installing gobolinux).

So my idea - and it is really just an idea, don't worry about investing time here - is ...

What if we can do "write once, run eveywhere" via glimmer? That is we write glimmer libui application but it could also work on the commandline as-is. May be hard, and we have to abstract a way lot of things, but could be doable.

Or, perhaps that may be more logical, to START with a commandline basis, for quick stuff prototyping; and at a later point when a library works well and the user wants to give it to other people too, to use it, a better GUI is done from that commandline base. So we can start with the commandline, and at a later time "upgrade" it to a full GUI. E. g. from TUI to GUI or something like that.

Anyway, this is really just meant as an idea. I think you played around with some terminal user interface, but most work you do in regards to glimmer probably goes into SWT and libui and ruby-tk and so forth I think. Would be kind of intereresting to have games such as snake or tetris or tic-tac-toe all work on every glimmer "platform", including the commandline.

AndyObtiva commented 2 years ago

I just did a quick glance of your message. Before I read in detail and answer every question, I'd like to mention that I already use a TUI in Glimmer DSL for SWT's glimmer command (via TTY toolkit, which does the same thing you mentioned about the Shopify tool, but with friendlier syntax in my opinion).

glimmer-dsl-swt-glimmer-command-tui

AndyObtiva commented 2 years ago

What you suggest is a good idea. I'd be happy to support a Glimmer DSL for TUI that could enable building TUIs or automatically converting desktop apps built with Glimmer DSL for SWT or Glimmer DSL for LibUI into TUI apps just like how Glimmer DSL for Opal does that for the web (convering desktop apps into web frontend apps).

I'll keep this issue open until I've implemented such a DSL. It is low priority though as I need to finish adding more advanced features to Glimmer DSL for LibUI (like custom shapes, declarative area graphics drag and drop, and scaffolding) in the meantime.