Note: In this article, I’m going to talk about the usability of command line tools with programming as the main goal.
Programming environments can be broadly divided into two catagories, graphical and command line oriented. Command line interface is usually considered a relic of the past, invented to solve problems which are long dead.
If that were true, why is it that there’s a significant number of people who use command line tools on their systems with multi gigabyte RAM and multi gigahertz CPUs? It turns out that CLI provides a lot of features which aren’t provided by any equivalent GUI (pipelining, customization, composition, generality of use…). An in depth discussion of those features is a topic of another article. Today I’m going to talk about the problems with command line tools and how they can be fixed.
Command Line Tools Speak The Language Of Computers
A shell is a minimal wrapper around the basic program execution mechanism of the platform. It maintains an environment which consists of environment variables, current working directory etc, and when you execute a command, it breaks the command line into words and passes that list to the executable along with the environment. The problem here is that the user doesn’t view the command line as a list of words, but as a collection of command line switches and arguments. Modern shells do a pretty nice job of providing help when dealing with commands, but it breaks down from time to time.
So the shells outsource the problem of defining command line syntax to the executable by passing it just a list of words, even though 99% of programs follow a pretty standard way of doing that. Wouldn’t it be better if a shell standardizes the syntax of command line format (along with an option to opt out of that and handling thing the hard way)? It would allow the users to perform high level transformations like jumping between flags, arguments etcetera.
Virtual Terminals Are Dumb
It’s very rare that you open only one shell when doing some non trivial task. All the shells you open are completely isolated, even though you opened them for a specific task common to all of them. All of them have their separate working directories and separate environment. There needs to be a way to group those shells together so that they’re able to talk to each other and maintain a common state. I made a zsh plugin a while ago which syncs the working directory in all panes of a tmux window. It crudely accomplishes one of the goals mentioned above, but there needs to be a general method of communication between shell instances (and GUI tools, CLI can’t beat them everywhere).
This article was a list of ideas which could improve the life of command line users if implemented. Let me know in the comments if you had similar ideas, problems or solutions in mind.
See you later.