COULD THE UNIX SHELL BE IMPROVED? Of course!

Mondo Technology Updated on 2024-03-07

A glimpse into the world of alternative command-line environments or "opinionated prompt systems" such as liquid prompt and oh-my-posh.

Translated from can the unix shell be improved? hell yes!(Fosdem 24) by Joab Jackson. *Note from the February 3rd FOSDEM 2024 talk "Liquid prompt: yes, we can completely rethink the design of shell prompts". (AW1. in the fosdem index.)126) Nojhan (full name) is a visual designer and creator of the Liquidprompt alternative shell, which is an "adaptive prompt for bash and zsh" that promises to "provide a beautifully displayed prompt with useful information when needed". Despite decades of advancement in the GUI, most administrators and many developers still use a dot-matrix command-line interface through some kind of shell. When you understand these commands, it's faster and easier to integrate different tasks using the shell. In his Fosdem presentation, Nojhan points out that today's command interpreter shells (the most widely used from start to finish being bash) have usability issues. They're not very user-friendly: no ergonomics, no feng shui, just an endless stream of small ascii lines of text. These shells aren't designed to highlight important parts of the user's interest, and as Nojhan points out, they don't "follow the state of the work" either.

Why is it so difficult to find a prompt in these shells, on an undifferentiated text screen?

As it happens, there are a plethora of alternative shells or "opinionated prompt systems", all of which have innovative designs to overcome these limitations. Not only does Nojhan point out his own LiquidPrompt, but he also points out a few others, each with a better name than the last: Starship, Oh-My-Posh, Powerline, PowerLevel10K, and Pure. Nojhan compares all of the above in an exhaustive blog post. Through this considerable analysis, Nojhan concludes that LiquidPrompt is the best of all prompt systems (although he acknowledges that each system has its merits, and that all systems should be considered for specific user needs, which is rightfully true).

But no matter how innovative these inventions are, are there any inventions that are enough to entice administrators and coders to move away from their trusty (albeit ted) one-line shells?

ohmyposh.dev

"A good prompt should be focused," Nojhan says. "It should highlight the status that is useful to the user. Do you need to know the version number of your tool? Maybe not. Some states change more than others, so there is no need to repeat. It all depends on what you need and should be definable.

Some overlays, such as oh-my-posh, use color to distinguish different parts of the data. Nojhan ridiculed them as "psychedelic rainbows" and noted that they were useless to people with color blindness.

But at the same time, you want to avoid "text overload" or too much text on the screen.

The bash-based LiquidPrompt uses a three-line approach. It uses only four colors: black, white, and two contrasting colors to choose from, which are discernible for people with color blindness.

"Important information should be visible" - Nojhan.

Here is the default command line:

Here are the "Powerline" topics:

The three-line command line is certainly interesting, but what's really appealing is what you can put into each line. You can embed a variety of neat widgets, including:The current path: Shows your location and "intelligently shortens the path".

The last time the command was executed

Battery level

Username

Hostname

Exit**: If the last command was an error, it is displayed as exiting.

Assignments: Counters for background, hibernation, and detached jobs.

Time

Free Memory Disk space

Remote shell

wifiSignal strength.

It can embed version control information for git and other repositories, showing the current branch tag, the current status, and statistics on the current commit edits. In the demo, nojham shows a line showing the status of the pending git command, git st. The command itself is on the far right of the line, as usual.

But before prompting, the line also shows the number of changes to the main branch - 68 additions and 189 deletions. It can also warn users of other pending commits that may conflict through the clever use of rows, shadows, and pointers.

LiquidPrompt can be configured for specific environments, including AWS, Kubernetes, and Terraform. It even offers custom virtual environments for PythonRubyPerldocker so many features to remember! So, only time will tell if the modern coder's brain is ready for the tres hombre command line.

Related Pages