Home Computing FOSDEM 24: Can the Unix Shell Be Improved? Hell Yes!

FOSDEM 24: Can the Unix Shell Be Improved? Hell Yes!

Notes from a Feb. 3 FOSDEM 2024 talk “Liquid Prompt: yes, we can drastically rethink the design of a shell prompt.” (aw1.126 in your FOSDEM index)

Nojhan (full name) is a visual designer and creator of the LiquidPrompt alternative shell, “an adaptive prompt for Bash & Zsh” that promises “a nicely displayed prompt with useful information when you need it.”

Despite decades of GUI advances, most admins and many devs still use dot-matrix-era command line interfaces, through a shell of some sort. When you know the commands, it’s faster and easier to integrate different tasks with a shell.

Today’s command interpreter shells — Bash being the most widely used since forever — have usability issues though, Nojhan pointed out in his FOSDEM presentation.

They are not very user-friendly: no ergonomics, no feng shui, just endless lines of tiny ASCII text. The shells were not designed to highlight the important bits of what the user is interested in, nor do they, as Nojhan points out,  “Follow the state of the work.”

Why, with a screen of undifferentiated text, is it so difficult to find the prompt on these shells?

As it happens, there are plenty of alternative shells, or “opinionated prompt systems” all of which have innovative designs to get around these limitations.

Nojhan points not only to his own LiquidPrompt but to others, each with a name more outstanding than the last: Starship, Oh-My-Posh, Powerline, and Powerlevel10k and Pure.

Nojhan compared all of the above mentioned in exhaustive detail for a blog post. And through this considerable analysis, Nojhan concluded LiquidPrompt to be the finest of all of the prompt systems (though he admits each one has its strong points and they all should be considered against specific user requirements, natch).

But however innovative these inventions may all be, will any be sufficiently arresting to move admins and coders from their trusted-if-dreary single-line shells of choice?

Design Tips for a Better Shell

ohmyposh.dev

“A good prompt should be focused, ” Nojhan said. It should highlight states that are useful for the user. Do you need to know the version numbers of your tools? Maybe not. Some states change more than others, so they don’t need to be reiterated. It all depends on the scope that you need, which should be definable.

Some overlays, such as Oh-My-Posh use color to differentiate different parts of the data. Nojhan derides this as “psychedelic rainbows” and notes they are useless for the colorblind.

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

LiquidPrompt, based on Bash, uses a three-line approach. It uses only four colors: black, white and two opposing colors of your choice that are discernable from one another for those with color blindness.

“The important information should be visible” — Nojhan.

Here is the default command line:

And here is the “Powerline” theme:

A three-headed command line is certainly intriguing, but what really sells the package is what you can put into each line. There are all sorts of neat widgets you can embed, including:

  • Current path: displays where you are, with ” smart path shortening.”
  • Last command execution time
  • Battery level
  • Username
  • Hostname
  • Exit code: the last command’s exit code if it was an error.
  • Jobs: counters for background, sleeping, and detached jobs.
  • Time
  • Available Memory/Disk space
  • Remote shell 
  • Wifi signal strength.

It can embed version control information for git and other repositories, showing the current branch/tags, current state, and statistics on the current commits/edits.

In the presentation, Nojham displays a line that shows the status of a pending git command, git st. The command itself sits, as usual, on the far right of the line.

But the line also shows, before the prompt, the number of changes pending to master branch — 68 additions and 189 removals. It can also warn the user when there other, possibly conflicting, commits pending, all delivered through a clever use of line shades and pointers.

LiquidPrompt can be configured for specific environments, including AWS, Kubernetes and Terraform. It even offers customized virtual environments for Python, Ruby, Perl, Docker and others.

So many features to remember! And so only time will tell if the modern coder brain is prepared for the Tres Hombre command line.

FOSDEM is not uploading to YouTube this year, but you can view this presentation, and many others, directly from the FOSDEM video collection:

Group Created with Sketch.

 

Reference

Denial of responsibility! TechCodex is an automatic aggregator of Global media. In each content, the hyperlink to the primary source is specified. All trademarks belong to their rightful owners, and all materials to their authors. For any complaint, please reach us at – [email protected]. We will take necessary action within 24 hours.
DMCA compliant image

Leave a Comment