4 ms·
As someone who is working on modernizing the command line, I think it is entirely possible to strike a balance. - the command line is just byte streams Shells
by hnlmorg 2y ago
As someone who is working on modernizing the command line, I think it is entirely possible to strike a balance.
- 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".
- aragilar 2y agoBut how many of these new tools are robust when there's high latency? The advantage of good old POSIX shell is it works on cheap routers, the latest HPC systems, the system next to me and the system of the literal other side of the world, and everything in between.
- maccard 2y agoBeing realistic - how often is that a problem?For some people working on specific domains yes. But why are a large number of developers who _dont_ have those restrictions held back by ensuring that your terminal works properly over 9600 baud
- quotemstr 2y ago> Being realistic - how often is that a problem? 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.
- maccard 2y agoHow much time do you spend coding on airplanes on remote systems?
- RhysU 2y agoAs a thought experiment: send your next email 1 character at a time by regular post. One doesn't have to do something often for it to be an awful experience. We choose tools, in part, because of the worst case experience not only the average case.
- maccard 2y agoWe shouldn’t optimise for the least frequent use case at the expense of the most common use case. Reversing a car is awkward, but we don’t reverse the steering wheel so that you get to turn the right direction while reversing.
- RhysU 2y agoCorrecting reversed steering only while backing up is entirely possible. Drive by wire allows it. Car designers realize the user base knows the older UI and uses the older UI without issue. The "install base" of existing user skills is a compelling reason to not change.
- quotemstr 2y ago> - readline is dated 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.
- hnlmorg 2y ago> 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.
- nemoniac 2y agoYou can use rlwrap to wrap many command-line commands with readline. It is my single de-facto standard line editing system.
- pjmlp 2y ago> Shells like Elvish, Nushell, Powershell and my own shell, Murex...... 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.
- hnlmorg 2y agoYou’re calling them “new”, not me. 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.
- pjmlp 2y agoI clearly pointed out these are 1970-80's ideas outside Bell Labs, one just needs to check the dates of those listed systems. Those that call them new, only know UNIX and Windows.
- Zababa 2y ago> rendered text is static 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.
- hnlmorg 2y agoIt’s not dynamic though. Take my tree holding example and compare the speed of collapsing a tree in a GUI like Firefox vs doing the same with iteratively updating jq queries. 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.
- Zababa 2y agoThe issue is that you can't use the other tools of the terminal like grepping and friends on a TUI. You can get semi-dynamic behavior with stuff like piping into fzf, maybe there's something like this for JSON collapsing too?