denisidoro/floki

I uh kind of turned your project into a template

jaidetree opened this issue · 3 comments

First, I really want to say this is an amazing project. When I first saw your post on reddit my mind was completely blown. I had always wanted to write really rich terminal-user-interface apps but found the amount of state required really daunting. Seeing your combination of reagent, react, and blessed really lit a lightbulb in my mind 💡 This has to be made into a template!

After a few months of work I am nearing full release:

https://github.com/eccentric-j/cljs-tui-template

All that’s left is filling out the documentation.

Anyway, I wanted to make sure this is cool with you since it is very heavily based on your stack. I have credited you in both the README and the demo app it generates. I also made sure to gut all your application specific code so as not to duplicate what floki offers.

Features

  • Supports lein-figwheel, figwheel-main, or shadow-cljs
  • Provides a test runner and sample test
  • Supports nREPL ClojureScript REPL
  • All npm packages are managed directly through package.json

Please let me know if you feel this project impedes upon your work, we can discuss the next steps to make this right. Alternatively, I could setup some tests for floki having struggled to figure it out with this stack if it would be helpful to you.

Nice work! 👍
Thanks for the contribution!

You're welcome. Thanks again for getting it all started!

One last thing came to mind:

(defonce tty-fd
  (fs/openSync "/dev/tty" "r+"))

(defonce program
  (blessed/program #js {:input  (tty/ReadStream tty-fd)
                        :output (tty/WriteStream tty-fd)}))

(defonce screen
  (doto
    (blessed/screen #js {:program     program
                         :autoPadding true
                         :smartCSR    true
                         :title       "Floki"})
    keys/setup))

I noticed if you remove the program attribute from the screen it still works, but uses the current tty session. The advantage of this is that your program will automatically resize when the terminal is resized. Is there something I'm missing that would make creating the program worth it?

I think both of your work is based on my gist:
https://gist.github.com/polymeris/5e117676b79a505fe777df17f181ca2e

I think it's amazing what you have done with it -- but would you mind crediting me?