News for hackers. Stuff that matters.
Re:Spectre.Console lets you make beautiful console apps with... by merricksb on Tuesday November 24, 2020 @07:05AM (#25197675)
Re:Spectre.Console lets you make beautiful console apps with... by timvisee on Tuesday November 24, 2020 @07:52AM (#25197979)
Though TUIs have its place, this totally destroys the ability for text processing used a lot on Unix platforms where a more simple output would suffice. For some applications like this it might be better to go for a non-terminal GUI anyway.
Re:Spectre.Console lets you make beautiful console apps with... by fratajcz on Tuesday November 24, 2020 @08:34AM (#25198264)
You can check if stdout is a tty: if it's not, you output raw text. GNU ls does this: by default it outputs in a multiple column layout, but when piped, it outputs one file per line.
Re:Spectre.Console lets you make beautiful console apps with... by piaste on Tuesday November 24, 2020 @08:13AM (#25198115)
Terminal (human) UI and scripting (machine) UI should be separate if the latter is a concern at all.

Think Debian's apt which is intended for human use, while apt-get is for scripts and sticks to a predictable console output.

Re:Spectre.Console lets you make beautiful console apps with... by sokoloff on Tuesday November 24, 2020 @08:18AM (#25198156)
TIL the difference between apt and apt-get; Thanks! (I was often a little bit curious, but never quite curious enough to go chase it down.)
Re:Spectre.Console lets you make beautiful console apps with... by flohofwoe on Tuesday November 24, 2020 @09:28AM (#25198693)
I think this should be selected with a command-line arg, show "human-friendly" output by default, and "pipe-friendly" output with a special argument.
Re:Spectre.Console lets you make beautiful console apps with... by nudpiedo on Tuesday November 24, 2020 @08:56AM (#25198413)
fun to mention that in the days that many commands provide a --json flag to stream output directly to a programming API.
Re:Spectre.Console lets you make beautiful console apps with... by nudpiedo on Tuesday November 24, 2020 @06:41AM (#25197559)
that can be interesting for F# and true cross platform applications. Can't wait to mess with it.
Re:Spectre.Console lets you make beautiful console apps with... by 0x445442 on Tuesday November 24, 2020 @08:59AM (#25198434)
I'm seeing more and more dancing around what I think is a desire to have a computing system much closer to the UI of emacs/lisp machine.

It seems the desire is to use the power of natural language to interact with the machine with commands but to not be limited by textual output.

Emacs can render pictures and PDFs but it can't render HTML well or videos at all.

Another UI that comes real close to what I think a lot of power users want are modern chat clients like Slack, Telegram, Discord and Mastadon because commands can be entered and the output is a stream of richer items than text.

Re:Spectre.Console lets you make beautiful console apps with... by flohofwoe on Tuesday November 24, 2020 @09:27AM (#25198675)
I would love a standardized way to render a simple pixel framebuffer in terminal windows that's fast enough to update at display refresh rate. The current solutions I tried (like Sixels, or iTerm2's imgcat) are good for rendering static images, but not for realtime updates.

This would allow me integrate actual graphics into my "C64 emulator for docker" instead of just a subset of the PETSCI character set :)

https://github.com/floooh/docker-c64

Re:Spectre.Console lets you make beautiful console apps with... by 0x445442 on Tuesday November 24, 2020 @09:51AM (#25198910)
This is crazy. I've been mulling these UI ideas around in my head for years and I've always had this vision in my mind of something very close to the C64.
Re:Spectre.Console lets you make beautiful console apps with... by tenaciousDaniel on Tuesday November 24, 2020 @09:02AM (#25198460)
I agree. I'm actually working on a couple of projects around non-technical textual interfaces, trying to make "code" applicable to more than just "building software".
Re:Spectre.Console lets you make beautiful console apps with... by 0x445442 on Tuesday November 24, 2020 @09:49AM (#25198886)
I've actually been thinking about this type of interface for years and have never really got the opportunity to implement my ideas.

Are you familiar with the Raskins' work?

https://en.wikipedia.org/wiki/Canon_Cat https://humane.computer/in-conversation-with-aza-raskin/ https://www.youtube.com/watch?v=EuELwq2ThJE

Re:Spectre.Console lets you make beautiful console apps with... by tenaciousDaniel on Tuesday November 24, 2020 @10:17AM (#25199187)
I'm not familiar but I'll check it out, thanks!
Re:Spectre.Console lets you make beautiful console apps with... by Jaruzel on Tuesday November 24, 2020 @07:33AM (#25197849)
I've been playing with the console improvements in Windows 10. I've hacked up a Win32 compiled version of the venerable VTTEST[1] and run it in the Windows 10 (Build 2004) standard console, and 90%+ of the ANSI escape sequences now work exactly as they should.

As such, I'm not sure what a framework like this adds, other than abstracting away the ESC sequences?

---

[1] https://invisible-island.net/vttest/

Re:Spectre.Console lets you make beautiful console apps with... by happypatrik on Tuesday November 24, 2020 @09:06AM (#25198495)
I'm the author of this lib. Yes, abstracting away ANSI escape sequences is one purpose of the lib, but first and foremost the purpose is to make it easier to render complex things as tables, panels, grids etc.
Re:Spectre.Console lets you make beautiful console apps with... by happypatrik on Tuesday November 24, 2020 @09:13AM (#25198557)
The library can also detect whether or not ANSI escape sequences are available in the terminal and fallback to something else. It can also downgrade colors depending on the color bitness support of the terminal.
Re:Spectre.Console lets you make beautiful console apps with... by Jaruzel on Tuesday November 24, 2020 @09:08AM (#25198516)
Ah ok - then yeah I can kinda see the value in that.
Re:Spectre.Console lets you make beautiful console apps with... by qwerty456127 on Tuesday November 24, 2020 @06:49AM (#25197593)
Does it support input anyway? Can a user choose a table row with arrow keys and press a button to do something or input a value?
Re:Spectre.Console lets you make beautiful console apps with... by happypatrik on Tuesday November 24, 2020 @09:08AM (#25198512)
It's not a TUI library in that sense. You should check out Gui.cs if you want to build more interactive applications in C#: https://github.com/migueldeicaza/gui.cs
Re:Spectre.Console lets you make beautiful console apps with... by qwerty456127 on Tuesday November 24, 2020 @09:36AM (#25198749)
Thank you. I don't even care much about the language. I can code C#, Python, many others and don't mind to learn some new.

What I need is a library to give me high-level TUI widgets (kind of like VisualBasic for DOS, not necessarily WYSIWG - code-first is OK) which would look good.

The one you have linked seems the best I have seen (among all the languages) so far but Spectre.Console looks (literally, I mean the aesthetic aspect) even better.

Re:Spectre.Console lets you make beautiful console apps with... by djeiasbsbo on Tuesday November 24, 2020 @04:34PM (#25203224)
Check out https://github.com/rivo/tview (golang), https://github.com/prompt-toolkit/python-prompt-toolkit (python) and https://github.com/fdehau/tui-rs (rust).

Personally I went with prompt toolkit for a work project I had to do in python and it is great!

Re:Spectre.Console lets you make beautiful console apps with... by nullsense on Tuesday November 24, 2020 @06:25AM (#25197475)
Damn. That's neat.
Re:Spectre.Console lets you make beautiful console apps with... by MaxBarraclough on Tuesday November 24, 2020 @07:54AM (#25197995)
It doesn't mention which platforms are supported, but from a quick search of the repo, it seems to support both Windows and Unix consoles. Nice.
Re:Spectre.Console lets you make beautiful console apps with... by happypatrik on Tuesday November 24, 2020 @09:11AM (#25198544)
Yes, I run integration and unit tests on Windows, Linux and MacOS as part of the CI for Spectre.Console, so everything should be fully functional cross platform. The only thing required is a platform that supports C# and (optionally) a terminal that support ANSI escape sequences.
Re:Spectre.Console lets you make beautiful console apps with... by MaxBarraclough on Tuesday November 24, 2020 @09:49AM (#25198888)
Excellent. I suggest making this clear, initially I assumed it was for Windows only.
Re:Spectre.Console lets you make beautiful console apps with... by happypatrik on Tuesday November 24, 2020 @10:04AM (#25199057)
Excellent suggestion!
Re:Spectre.Console lets you make beautiful console apps with... by qwerty456127 on Tuesday November 24, 2020 @06:47AM (#25197583)
Wow. I wish there was something like this for other languages (like Python, Nim or Go).
Re:Spectre.Console lets you make beautiful console apps with... by pridkett on Tuesday November 24, 2020 @06:53AM (#25197615)
For Python check out the “rich” module[1]. It even uses a table of Star Wars movies as an example. It gives you access to colors and other niceties, like outputting syntax highlighted elements and colorful exceptions with little effort.

[1]: https://github.com/willmcgugan/rich

Re:Spectre.Console lets you make beautiful console apps with... by happypatrik on Tuesday November 24, 2020 @09:08AM (#25198523)
Yes, Spectre.Console is heavily inspired by Rich, and this is stated in the first paragraph of the repository and documentation :)
Re:Spectre.Console lets you make beautiful console apps with... by eb0la on Tuesday November 24, 2020 @07:55AM (#25198004)
Thanks! great adition to the toolbelt :-)
Re:Spectre.Console lets you make beautiful console apps with... by eliaspro on Tuesday November 24, 2020 @07:24AM (#25197796)
For Go check out bubbletea: https://github.com/charmbracelet/bubbletea
Re:Spectre.Console lets you make beautiful console apps with... by voltagex_ on Tuesday November 24, 2020 @06:50AM (#25197602)
Look for "curses" or "ncurses" libraries in other languages.