Debian Codegraph @

docs/design-opinions.md

raw
1 # CLI Design Opinions
2
3 ```{currentmodule} click
4 ```
5 A penny for your thoughts...
6
7 ```{contents}
8 :depth: 1
9 :local: true
10 ```
11
12 ## Options over arguments
13 {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.