denisidoro / floki

A JSON/EDN browser for the terminal
https://www.npmjs.com/package/floki
Apache License 2.0
317 stars 7 forks source link

I uh kind of turned your project into a template #41

Closed jaidetree closed 5 years ago

jaidetree commented 5 years ago

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

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.

denisidoro commented 5 years ago

Nice work! đź‘Ť Thanks for the contribution!

jaidetree commented 5 years ago

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?

polymeris commented 5 years ago

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?