by llm_trw · 2y ago · 0 comments
In this very thread we're seeing people say "Well sure, but why not add ...".
The reason why the CLI is good is because it _can't_ do most things people want it to do. Which means you have to think when making an application.
Please, if you're one of the people 'modernizing' the terminal stop and think why the terminal is valuable. Don't make it into another of the long line of UIs which have been destroyed by modern developers.
It's reminiscent of scroll-jacking, excessive animation, and other web GUI bloat, just translated to TUIs.
I don't know what the issue is on your computer, but it definitely doesn't take my computer 500ms to register a key press in VisiData in the general case. That would be an issue I'd have to take seriously. I've spent way too much time optimizing VisiData's startup time to be under 300ms to let something like that slide. It's a point of pride for me that VisiData doesn't incorporate that "web GUI bloat" as you mention.
If you're willing to help out, please contact me so we can file an informative issue and see if we can figure out what's going on in your setup. I have a hunch it's generalized computer/OS bloat that we (VisiData) can't do anything about, but at least we can try to understand it so that hand-crafted software like VisiData isn't unnecessarily maligned.
example: flatpak. Last I tried - tab-outcompleting to install a package makes a network request for the application list. This ofcourse means you don't have to maintain a cache like `apt` and certainly makes things easier. I'm sure this makes sense if you're on your macbook pro in a cafe in Cupertino. But it was nearly unusable (whole CLI locks up and hangs) from my Core m3 computer tethered to a shitty network in a 2nd tier city in China.
I think in the context of the ongoing 'CLI renaissance', what this misses is that many of the most recognizable tools which emerge from (or perhaps kicked off) the contemporary 'CLI renaissance' are very carefully engineered with performance in mind. Ripgrep is, to me, the most vital of all the 'next-gen' CLI programs. GNU grep is already incredibly fast, and ripgrep manages to be faster, to take common-sense shortcuts, to add in a few extra conveniences (like --replace, so you don't always need to pipe to sed or awk or whatever when you want to do a very simple transformation) without going nuts and losing focus. Its author, burntsushi, has written here on HN about their implementation as well as GNU grep's and other regex implementations, and it's clear that the predecessors have been studied with great care and respect.
I love many newer CLI tools, and this pattern holds for all of them. Consider, for instance, `jq`, which has become a 21st-century complement to vital staples like awk. This is even the case for many tools whose purposes are largely 'cosmetic', like `bat`, which more or less exists to be a more performant replacement for older colorizers like `ccat`. As cringey as the buzzword 'blazing fast' has become, Rust CLI tools are typically in tune with the general cultural emphasis of speed in the Rust community. And many Go CLI tools today are rewrites or clones of Python or Ruby tools, which were written expressly to achieve improved performance.
This also seems to hold for next-gen CLI environments: one of the main advancements most next-gen shells (e.g., Elvish, Nushell, Oil) offer over PowerShell (which introduced structured pipelines to the shell world) is performance!
This doesn't mean that every single new CLI tool is well thought-out, or (if it has direct antecedents) better than its predecessors. But I don't think the idea that new CLI tools are generally written without care for performance or consideration of the past is borne out when you look at what's out there.
-1. You’ve lost me here. The reason why CLI is good because it solves problems that even modern GUIs can’t, not because of some artificial limitations or lack of convenient defaults.
> Which means you have to think when making an application.
“Think” and “remember obscure syntax that greyheads keep on a paper under their mattress” are two different things. I agree with the author that sensible defaults are severely lacking from some of the tools.
edit: i’ll add that continuousness of guis is actually its limitation. a terminal interface is indexable, a gui is not. so what looks like freedom is actually a different structure. a gui is more general, as real numbers are more general than whole numbers. but to get to whole numbers, you have to re-constrain real numbers. this is left up to the developer to create a constraining framework. and it’s a path of less resistance to not do this. most data we deal with is discrete. so a continuous representation of it is a mismatch of structures. terminals force you to stay in that same discrete space. so your solutions are from the getgo closer in fit to your data.
it’s important to match up the structure of your interactive surface with the structure of your domain. it’s a common principle we talk about too little.
You can lay things out in a grid, but the same can be said of GUIs. You can consider each character a cell in a grid, but I think that's so small that at that point it's not conceptually sufficiently different from being continuous. The computational paradigm that's a grid at its core is spreadsheets.
Now with AI and better design, nothing in theory would prevent us to "script UI apps" like we do with terminal, you could say
"take a screenshot of my webpage with Chrome | set it in isometric with nice shadow using Photoshop | send it on my iPhone Twitter app"
and you would get the same pipeline
of course "UI apps" just have too many input / output possibilities, and you wouldn't want to have "--flags" everywhere for every possibility
But that's where "natural language as a universal API" applies, or perhaps just a better design for interaction with UI apps
This is basically Apple Shortcuts. It would be nice to have a CLI interface for Shortcut "actions".
I know this is just (probably) a figure of speech, but I really don't like this way of writing. This has strong "us vs them" vibes. There is no team of people actively working on ruining GUI, HTML and now terminals, over the last 30 years. There are just people who have different tastes than you and I. I find this approach more productive.
I don't think calling for a stop of experimentation is the way. Nobody is going to take away your vi and bash any time soon.
A TUI is not a CLI, either.
> The reason why the CLI is good is because it _can't_ do most things people want it to do. Which means you have to think when making an application.
I don't think this is true at all. If I had to say why the CLI is good, I would mention:
- speed
- composability, as in I can grep for something and then do other operations
- ease of development, it's very easy to make a small tool for my usage
- the command line is just byte streams
Shells like Elvish, Nushell, Powershell and my own shell, Murex, support typed pipelines and that brings a great number of enhancements. Like native support for JSON, CSV and other data formats. Thus meaning you can have a unified syntax for handling different files rather than remembering a dozen different tools and their specific idiosyncrasies, eg `jq`, `awk`, etc
- readline is dated
We can do better than the typical shell interface. The popularity of tools like `fzf` and `starship` show that people do actually find modern TUIs useful
- rendered text is static
Lets say you view a JSON file in Firefox, you can expand and collapse specific branches of that JSON file. I'd love to be able to do that with JSON in the terminal. And not just JSON, tools like `tree` could benefit from that too.
Collapsible trees is a feature I'm working on implementing in my terminal emulator and it's completely optional. ie by default the tree renders the same way any other terminal would render that clump of text. Except you can then optionally collapse branches just like you can with code in an IDE or comments in HN.
---
I love the command line. I've been using it for 30+ years and written so many tools for fellow CLI enthusasts. But even I think an ideal world would be us moving away from grid based virtual teletype interfaces pushing communicating via raw bytes and with in-band control codes, and instead switch to something more robust. But that's never going to happen. Heck, even things like job control (ie when you hit ^z) is non-trivial to implement at a shell level. It requires multiple signals (each originating from a different sender), and 3 different hierarchies of process ID registration. Frankly, it's amazing any of this stuff still works. And that's before we touch on the plethora of competing standards to test what client (ie terminal emulator) is connected to that "virtual typewriter".
I have 800ms RTTs on airplanes. Character-by-character editing is painful. Old-fashioned line-buffering makes the experience much better. It'd be nice not to give up this capability.
More seriously, unless you're doing stuff locally (in which case, go ham doing cool things on your system), the tools you use need to work for others, with their requirements and restrictions (some of which can be changed, but others which are inherent).
If Bash works then these should work too. And if Bash doesn’t work then you’ll need something that supports local echo like Mosh instead of SSH.
I would say vim is excellent over high latency connections, as you can slow down your typing and plan movements and queue up commands. Readline's ability to pop open an editor makes running complex shell commands so much nicer.
But at least it was --- pre-GPLv3, pre-prompt_toolkit, etc. --- a standard. It would be nice to again have a single de-facto standard line editing system that I could
1) customize once, for all my programs, and
2) compose with other programs (e.g. shells embedding in other programs).
It'd also be nice for it to be friendly to high-latency connections.
But alas, we're heading towards a world in which the terminal is just a GUI with Minecraft pixels.
This has been the case for decades already. Some TUIs use ncurses, some don’t. Some use 7bit escape sequences for switching to drawing characters, others use 8bit control codes. Neither fish nor (and correct me if I’m wrong on this one) zsh use readline.
There never was a standard way. Some de facto standards exist but even these were ignored as often as they were used. And the reason for this is because there never was a standard VT in the hardware days (DEC, Tektonix, etc all did things slightly differently) let alone in the xterm, VTE, et all days. And all of these different terminals have been driven by different operating systems. For example ‘ps’ on macOS uses different escape sequences to GNU ‘ps’ yet they mostly achieve the same output. So imagine how inconsistent things were when you had fundamentally different time sharing systems.
The way I see it is that you're making it dynamic by entering other commands. This doesn't really feel dynamic when you don't know what to enter, but the more fluency you achieve, the more dynamic/in the flow it feels.
Much as I prefer command line tools for most tasks, it’s silly to say that they’re always just as dynamic as GUIs.
You can already recreate my tree folding example as a TUI using block characters and terminal mouse input. There’s nothing exotic about that. So all I’m suggesting is that this convenience should be built in as standard.
Except nothing of this is really new, this is how REPLs in Xerox PARC worstations, ETHZ and Genera used to work.
The novelty of these shells is a side effect of UNIX wiping out the alternatives.
Besides, if you want to go down that line of thinking then nothing in technology is truly original. We all stand of the shoulders of giants.
Those that call them new, only know UNIX and Windows.
"take a screenshot of my webpage with Chrome | set it in isometric with nice shadow using Photoshop | send it on my iPhone Twitter app"
and you would get the same pipeline
of course "UI apps" just have too many input / output possibilities, and you wouldn't want to have "--flags" everywhere for every possibility
But that's where "natural language as a universal API" applies, or perhaps just a better design for interaction with UI apps
Ditto with Haiku OS (and Be) with the 'Hey' tool:
https://www.haiku-os.org/blog/humdinger/2017-11-05_scripting...
On pure CLI tools, that's trivial with some of them sending commands to Chromium, piping the output to ImageMagick and using something like ttytter (now it wouldn't work with the API changes). Replace Twitter with Mastodon and I'm sure you could do that with 'toot'.
Eg. each "UI app" would just become a big API of all input/output possibilities, and "interactive mouse / keyboard / visual interaction" would just be one possibility among others
Your computer would know how to pipe between each app, optimize it if possible, and give you what you want
Then to top that, we had TUIs up to the mid-1990's because we couldn't afford anything else, it was the best many of us could have, given the bugdet and the astronomical cost of anything with a graphics display attached to the computer.
I really don't get the coolness of reproducing this experience, I was more than happy to move away from this as soon as I could afford to.