TermKit: A Graphical Helpful Command Line
I am really excited about this. Steven Wittens is creating TermKit, an improvement to ye olde command line that takes into account the fact that we aren’t in fact on tn3270 screens, and thus the UI can be doing a lot more for us.
We felt the same way back in the Bespin days, and Joe Walker spent some time on it in the context of the editor.
Steven has spent some solid time creating a system that has a client and a server, all bound together via Socket.IO. The system is cleanly architected and brings the best of loosely coupled systems, for which UNIX has done well upon (e.g. pipes) for many years. You get a feel for the thought behind this when Steven discusses the command line and usability:
A lot of my frustration comes from bash’s arcane syntax. It has a particularly nasty variant of C-style escaping. Just go ahead and try to match a regular expression involving both types of quotes.
But at its core, a bash command is a series of tokens. Some tokens are single words, some are flags, some are quoted strings, some are modifiers (like | and >). It makes sense for the input to reflect this.
TermKit’s input revolves around tokenfield.js, a new snappy widget with plenty of tricks. It can do auto-quoting, inline autocomplete, icon badges, and more. It avoids the escaping issue altogether, by always processing the command as tokens rather than text. Keys that trigger special behaviors (like a quote) can be pressed again to undo the behavior and just type one character.
The behaviors are encoded in a series of objects and regexp-based triggers, which transform and split tokens as they are typed. That means it’s extensible too.
At the end of the day, Unix just has bad usability. It tricks us with unnecessary abbreviations, inconsistent arguments (-r vs -R) and nitpicky syntax. Additionally, Unix has a habit of giving you raw data, but not telling you useful facts, e.g. ‘r-xr-xr-x’ instead of “You can’t touch this” (ba-dum tsshh).
One of the Unix principles is nobly called “Least Surprise”, but in practice, from having observed new Unix users, I think it often becomes “Maximum Confusion”. We should be more pro-active in nudging our users in the right direction, and our tools should be designed for maximum discoverability.
For example, I want to see the relevant part of a man page in a tooltip when I’m typing argument switches. I’d love for dangerous flags to be highlighted in red. I’d love to see regexp hints of possible patterns inline.
There’s tons to be done here, but we can’t do anything without modern UI abilities.
The command line has many great features that make power users love it (especially over mousey clicky ugh), but there is room to help the user so much more as they type. Great to see this example, and I hope it continues to shine.