top of page
Search
robbyleavelle4007y

App My CLI, For Great Good



Even simple shell script verbs provide great extension capability for users. For even bigger impact, provide a simple wrapper framework like gh does, that allows extensions written in go to easily call the main tool itself.


CLIs and TUIs are incredibly effective tool for the developer. They are usually easy to write, extremely useful for the author themselves as ways to exercise their code while developing, and a great way to "self-document" and extend the functionality of the application our library.




App My CLI, for Great Good




This is the minimum we expect from a command line application, but we are not going to be satisfied with a lowest common denominator app, we want to create a great CLI application that delights our users. What does that mean and how do we do it?


We made a trade-off: by choosing a command line interface (CLI) instead of a graphical user interface (GUI), our application is less easy to learn to use for new users. We can partially make up for that by providing good online help.


To build native images using the Java 11 version of GraalVM (19.3.0 and greater), you can either install the Visual Studio 2017 IDE (making sure to include Visual C++ tools for CMake), or you can install the Visual C Build Tools Workload for Visual Studio 2017 Build Tools using chocolatey:


Node.js is a great solution for writing CLI apps. Node.js itself has built-in libraries for reading and writing files, launching other applications, and basic network communication. Beyond that, there are thousands of packages available on npm for just about any kind of task imaginable.


The yargs module automatically builds a great response for displaying help! Your CLI is not only ready to accept -n and --name arguments but also --help and --version. Try running your CLI application with any of the arguments.


With the AWS CLI you have direct access to the Elastic Beanstalk API. The AWS CLI is great for scripting, but is not as easy to use from the command line because of the number of commands that you need to run and the number of parameters on each command. For example, creating an environment requires a series of commands:


Rust is a statically compiled, fast language with great tooling and a rapidly growing ecosystem.That makes it a great fit for writing command line applications:They should be small, portable, and quick to run.Command line applications are also a great way to get started with learning Rust;or to introduce Rust to your team!


Writing a program with a simple command line interface (CLI)is a great exercise for a beginnerwho is new to the language and wants to get a feel for it.There are many aspects to this topic, though,that often only reveal themselves later on.


As you already know, a great feature of argparse is that it generates automatic usage and help messages for your applications. You can access these messages using the -h or --help flag, which is included by default in any argparse CLI.


Another desired feature is to have a nice and readable usage message in your CLI apps. The default usage message of argparse is pretty good already. However, you can use the metavar argument of .add_argument() to slightly improve it.


Knowing how to write effective and intuitive command-line interfaces is a great skill to have as a developer. Writing good CLIs for your apps allows you to give your users a pleasant user experience while interacting with your applications.


Some CLIs have more involved help systems that let developers query beyond the basic help screen. JavaScript package manager NPM, for example, has a terse initial help screen, which is great for double checking commands. Then developers can explore further with npm -h or read a full NPM overview (more like a man page) with npm help npm.


While two of those are flags, login is a command. Commands are also a place to steal from other CLIs. Commands are the actions you want to take, as opposed to flags, which usually are modifiers on those actions. Verbs are good choices, since they describe actions. Here are some common commands:


As you may notice, a command syntax can assume several different forms. To specify which are the commands, options, flags, and arguments in an idiomatic way, we have the args package. It contains classes and functions that help to bring the same organization and hierarchy of your desired CLI syntax into your code. In the template generated by very_good_cli, we have some sample commands and options to illustrate that mapping.


This is just the tip of the iceberg to what is possible to do with a Dart CLI application. We created the Dart CLI template in Very Good CLI to provide the basics of what our team thinks any Dart CLI application should include from the start. Since it is an open source project, ideas and suggestions are always welcome. If you have any, head over to very_good_dart_cli and open an issue.


In this article, I'd like to share what I learned during our development process, and specifically what I wish I had known before we began developing Datree's CLI. Perhaps the next person can use these tips to create a great CLI application faster.


Colors are a great way to attract your user's eyes and help them read commands and outputs much faster. The most recommended font colors are magenta, cyan, blue, green, and gray, but don't forget that background colors can provide more variety. I encourage you to use yellow and red colors but remember that these are typically saved for errors and warnings.


Nice article! I work for a software development company and we often have to create command line utilities for small/trivial tasks and no one thinks about the UI/UX for a CLI. The industry is focused on UI/UX for Web and mobile app only. As Luca said, it would be good to enhance the article with tools that help CLI development. Thanks!


These commands are the entry points for complex workflows, integrations with external services, or even just simple message responses. They're the knock at your app's front door that could be the start of a great conversation.


If you don't do this, the user will be shown an error message that indicates that the slash command didn't work - not a great experience for the user, so you should always acknowledge receipt (unless of course you didn't receive the command, but then you wouldn't know not to respond, and now we've fallen into a logical paradox).


Our team created Very Good Core to provide a starter app option for developers looking for a very good foundation. It comes with our best practices and opinionated architecture. As with any starter app, feel free to build upon it, remove code, and make it your own!


Acknowledging the conversational nature of command-line interaction means you can bring relevant techniques to bear on its design.You can suggest possible corrections when user input is invalid, you can make the intermediate state clear when the user is going through a multi-step process, you can confirm for them that everything looks good before they do something scary.


A good sensible set of options to use for less is less -FIRX.This does not page if the content fills one screen, ignores case when you search, enables color and formatting, and leaves the contents on the screen when less quits.


Show progress if something takes a long time.If your program displays no output for a while, it will look broken.A good spinner or progress indicator can make a program appear to be faster than it is.


You might fork a project to propose changes to the upstream repository. In this case, it's good practice to regularly sync your fork with the upstream repository. To do this, you'll need to use Git on the command line. You can practice setting the upstream repository using the same octocat/Spoon-Knife repository you just forked. 2ff7e9595c


0 views0 comments

Recent Posts

See All

Comments


bottom of page