Good defaults:
You shouldn’t have to memorize tar -xzvf just to extract a tar file; The thing you’re most likely to want to do should be the default. But other use cases should still be achievable through the use of flags. Make simple thing easy and difficult things possible.
Subcommands:
It helps separate and discover the different functions of a CLI. Paired with a help subcommand, you can quickly look up information for the subcommand you’re actually interested in.
Domain specific languages:
Many problems already have a solution in the form of a DSL, such as Regex or SQL. My favourite example for this is httpie, which lets you specify the type, body and parameters of an HTTP request without touching any flags.
I also much prefer long options over ones, because they are self-documenting.
There are many modern alternatives to common Unix commands, often written in rust, or provided in Nushell, that showcase that. Here are some common themes I like:
Good defaults: You shouldn’t have to memorize
tar -xzvfjust to extract a tar file; The thing you’re most likely to want to do should be the default. But other use cases should still be achievable through the use of flags. Make simple thing easy and difficult things possible.Subcommands: It helps separate and discover the different functions of a CLI. Paired with a help subcommand, you can quickly look up information for the subcommand you’re actually interested in.
Domain specific languages: Many problems already have a solution in the form of a DSL, such as Regex or SQL. My favourite example for this is
httpie, which lets you specify the type, body and parameters of an HTTP request without touching any flags.I also much prefer long options over ones, because they are self-documenting.