Guide or Reference for Quality UX With CLI Applications

Are there any good references or guides on designing CLI command structures for high quality UX and ergonomics? Like when to use arguments, when to use options, how to expose a choice as an option, etc.
11 Replies
cned
cned5w ago
What is the difference between an "argument" an "option" and a "choice"?
VoidPointer
VoidPointerOP5w ago
Thanks for the feedback, but the argument vs option part of this is only part of the question, and I quite understand what arguments vs options are. I'm looking for resources on how to design a CLI, from an ergonomic and user-centric point of view. In my current, very simple use-case, I have the command or verb and the path to a file to be analysed as arguments, and how to sort the output as an option. That's quite neat and meets my usability and user-friendly expectations. Yet now, as the app grows and I add more commands, it becomes more challenging to maintain usability and ergonomic standards with a growing range of possible arguments and options. Right now I even ask should the sort option take a direction, like --sort asc|desc, or should I have two mutually exclusive sort options, like --sort-asc and -sort-desc. This has a medium to high priority because many commands will have a sort option, and they should all be uniform. That they should at least be uniform for all commands is one of the set of design guidelines I'm looking for, but it was a fairly obvious one I know instinctively as a user and as an engineer. I'm quite sure the designers of various shells, like Bash, Zsh, and Fish, and PowerShell, have put some thought into this usability aspect, and while I can study all of these and extract the good stuff and improve on the bad for my CLI, I'm sure papers and articles have been written on in, even if no studies done. I think a look at the Gnu and POSIX conventions and their background and or history will be helpful to be, thanks.
VoidPointer
VoidPointerOP5w ago
I've done some looking around and found this group. I think the open source document Command Line Interface Guidelines will prove tremendously helpful for what I am looking for, and if nobody knows of any such resources, just that may be enough for me to close this post a bit later.
Command Line Interface Guidelines
An open-source guide to help you write better command-line programs, taking traditional UNIX principles and updating them for the modern day.
MODiX
MODiX4w ago
Spectre.Console is a .NET library that allows for easy creation of console UIs, text formatting in the console, and command-line argument parsing. https://spectreconsole.net/
Spectre.Console - Welcome!
Spectre.Console is a .NET library that makes it easier to create beautiful console applications.
VoidPointer
VoidPointerOP4w ago
I have no idea, and it really does very little to answer my question. having a pretty console UI and a good command parser does not automatically introduce good design and UX principles and practices for CLI applications. Either the poster has a fetish for Spectre or is a shill for it.
Unknown User
Unknown User4w ago
Message Not Public
Sign In & Join Server To View
VoidPointer
VoidPointerOP4w ago
I've previously used Spectre on this project and read their documentation on command parsing, and didn't find what I'm asking for. I found how to create commands, arguments, and options, but not how to uses these for optimum UX. The document on Command Line Interface Guidelines, at https://clig.dev, goes a long way to answer me, and if my question elicits nothing but criticism, I will close the post by reason of the one answer I have found myself. I was just hoping somebody might know about a similar resource to the single one I found.
Unknown User
Unknown User4w ago
Message Not Public
Sign In & Join Server To View
VoidPointer
VoidPointerOP4w ago
I have been looking at the various parsers as well, but will reconsider them in light of the design principles I found in that document. Thanks for you input.
Unknown User
Unknown User4w ago
Message Not Public
Sign In & Join Server To View
VoidPointer
VoidPointerOP4w ago
I'm not at all looking for guidance on writing my own parser. That would be daft with those already available. I'm using Cocona Lite for my current project and am very happy with it. I was looking for the type of design advice that helps me choose between having e.g. a sort ascending option and a sort descending option, or have a sort direction argument. All the parsers I know make either way of doing this very easy. I'm concerned about the ergonomics of how the cli input is structured, not how to interpret it.

Did you find this page helpful?