Skip to content
Myr

design-opinions.md

This file

Path

docs/design-opinions.md

19 lines · 906 bytes · Markdown

Last changed by

Add Best practices section (#3127)Rowlando13before adoption0b5c6b7

History of this file

Take it

Add Best practices section (#3127)Rowlando13before adoption0b5c6b7

lines 1–19why, one step back
1# CLI Design Opinions
23```{currentmodule} click4```5A penny for your thoughts...67```{contents}8:depth: 19:local: true10```1112## Options over arguments13{ref}`Positional arguments <arguments>` should be used sparingly, and if used should be required:14- The more positional arguments there are, the more confusing the CLI invocation becomes to read. (This is true of Python too.)15- Making some arguments optional, or arbitrary length, can make it harder to reason about. The parser handles this consistently by filling left to right, with an error if there is a non-optional unfilled after that. But that's not obvious to a user just looking at a command line.16- A command should be doing one thing, and the arguments should be related directly to that.17 - A group, where the argument is the sub-command name.18 - A command acts on some files.19 - A command looks at a source and acts on a destination.