Hacker News new | past | comments | ask | show | jobs | submit login
Show HN: Promptui – Rich UI elements for cli prompts in Go (github.com/manifoldco)
196 points by MayBeColin on Nov 29, 2017 | hide | past | favorite | 44 comments



I've been dreaming with a sci-fi world where at some point the web get's so awful, that a small group splits to an alternate hypertext reality that is only text based.


I dunno. I have little problem with images etc. The problem i have is the attempts to "app-ify" by turning every site into a GUI via JS.

The initial idea of the web as a source of linked static documents were fine. Heck, even early CGI sites may have been fine. It was AJAX(?) that brought the madness.

And btw, late gen terminals from DEC could show images (and perhaps even videos by abusing the protocol).

https://en.wikipedia.org/wiki/Sixel

https://saitoha.github.io/libsixel/


Some people keep Gopher alive, apparently -- so maybe that's where survivors will take refuge after the JavaScript ad tracking apocalypse finally comes.


> Some people keep Gopher alive, apparently -- so maybe that's where survivors will take refuge...

Maybe just links[0]/elinks[1]/lynx[2]...

[0] https://en.wikipedia.org/wiki/Links_(web_browser)

[1] https://en.wikipedia.org/wiki/ELinks

[2] https://en.wikipedia.org/wiki/Lynx_(web_browser)



Not sure if gopher is the right fit.


In the post-JavaScript apocalyptic nightmare, the few remaining working terminals will be green-on-black CRTs with nuclear launch instructions burned in the screens. Gopher is a good fit.


> green-on-black CRTs

Any source for something like this that is usable on a modern computer? I did a bit of eBay-ing and everything was ancient/incompatible and megabucks.


Will we be able to install Node on those?


While I'm super happy with today's web technologies, I think there would be indeed room for an alternative, typography centered approach that would dare to try new paradigms.

The crucial thing is to avoid reinventing teletext :)


The tildeverse?


>alternate hypertext reality that is only text based

Except the text is aligned vertically and the terminal scrolls horizontally.

You've just logged into... the Twilight Zone.


Maybe in the same universe the overuse of VT control codes has led to command line to be actually line based.


I'd join that commune


The single screencast is pretty compelling, I'd suggest just screencasting everything from the examples and adding to your landing page.

Don't have an immediate use but I like it.


Truth be told we did actually screencap a bunch of scenarios for a blog post https://blog.manifold.co/promptui-get-user-input-in-your-cli...

But you're right, we should bring them to the readme or to the _examples folder.


The introductory screencast was a key part behind Rails' initial success back in the day :)


It's pretty great to see so many different takes on these visual prompts! Going through the source, it looks pretty similar to an early version of one of my projects - have you ran into any issues with chyzer/readline? I can't remember the exact reason I had to ditch it, but I think there were problems with its support for Windows

Here's the project for anyone interested: https://github.com/AlecAivazis/survey


Have you tried it in Linux ? Emojis are not available there.


That depends on your distro. Fedora 27 just shipped recently with colored emoji support thanks to the Google noto emoji font.


I shipped my distro (Happy Hacking Linux) with emoji fonts a year before Fedora. That font is useful only for GUI apps, won't work in CLI.


It absolutely works in gnome-terminal on GNOME 3.26.


I think of Emacs as a program with a great text interface. I think that something like this should be easily done in Emacs. However, I don't think this is the case today, as per some research I've done this summer. Anyone has ideas on what set of packages could be utilized with elisp in order to achieve rich UI elements for emacs?


Emacs has already some kind of buttons and search fields, check out M-x "customize" to see some of them.


> achieve rich UI elements for emacs

Are you saying emacs is not customizable enough?


I'd recommend people also check out ishell https://github.com/abiosoft/ishell I've used it in a project before and absolutely loved the API + autocomplete functionality.


https://github.com/AlecAivazis/survey is a little bit better. I haven't compared it with promptui, yet, however.


Another one I came across recently was termui: https://github.com/gizak/termui


Reminds me of another great project: https://github.com/alecaivazis/survey


I like this. Do similar projects exist for other languages?


Any language in particular? For JavaScript I'd recommend https://github.com/SBoudrias/Inquirer.js


I agree.

I've published a package that exposes a few convenience methods written using it, including a cool one for printing a table (which detects the width of the terminal window and hides extra columns automatically). Check it out https://github.com/fabiospampinato/inquirer-helpers


I feel the need to mention "newt" [0][1] here.

It's the C library behind whiptail, a reimplementation of dialog, which is a cli app for making menus. Incidentally, dialog is usually what you see when you get a semi-gui install with many Linux distributions.

Being C, you can use it with just about everything.

[0] https://en.wikipedia.org/wiki/Newt_%28programming_library%29

[1] https://pagure.io/newt


While not quite the same, the REPL of the Julia programming language supports modes as plugins. Out of the box there is the Julia mode for writing julia code, shell mode for shell commands and help mode for getting help on functions. But I've seen lots of interesting ways of extending this.

E.g. one of the debuggers for Julia, Gallium simply adds some new modes. So you can be in stepping-through-code-mode and then at any time switch back to Julia mode and inspect variables at that point in the execution stack.

Another mode is a package mode being developed for the new Julia package manager. So when adding, removing, updating, creating etc packages you can go into package mode and get behavior relevant to working with packages.

I had the idea of creating a mode for a board game, e.g. a Settlers of Catan mode, which is focused on issuing commands relevant to that game.



I'd be interested in something like this for python


prompt_toolkit is, IMO, the standard by which all of these types of libraries should be measured.

It's incredibly easy to get started with, and lets you build crazy wonderful things like pt_python and pgcli/mycli.


For REPL like things prompt_toolkit is great. For anything else (menus, forms) i find it difficult to use or at least discouraging.


Me too, I would definitely use a fancy python CLI library.


Suprised to not see ncurses mentioned anywhere yet. Not sure it's an exact match but it's well supported in the same ballpark.


Anything like this for a .NET command line application?


rich cli prompts is an oxymoron, but I'm glad you support vim movement: https://github.com/manifoldco/promptui/blob/master/select.go...


I so much agree. There's enough dancing baloney on the web, we don't need it infecting the command line. Just say no.


Yes. Your software is CLI only if you can use it with a teletyper interface.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: