Merge pull request #1855 from guifelix/patch-1
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Update why.rst
authored by David Lord · committed by GitHub · parents 56e79c9, 94d3710 · Browse files · 1 file·+12 added−12 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
1 file+12 added−12 removed
- other:+12 added−12 removed
Provenance
- Commit
fd4b3d8- Tree
8c46bc5- Author
David Lord <davidism@gmail.com>- Committer
GitHub <noreply@github.com>- Parent 1
56e79c9- Parent 2
94d3710
1 file changed+12 added−12 removed
modified:docs/why.rst+12 added-12 removed
5 unmodified lines6 7 This question is easy to answer: because there is not a single command8 line utility for Python out there which ticks the following boxes:9 10-* is lazily composable without restrictions11-* supports implementation of Unix/POSIX command line conventions12-* supports loading values from environment variables out of the box13-* support for prompting of custom values14-* is fully nestable and composable15-* supports file handling out of the box16-* comes with useful common helpers (getting terminal dimensions,10+* Is lazily composable without restrictions.11+* Supports implementation of Unix/POSIX command line conventions.12+* Supports loading values from environment variables out of the box.13+* Support for prompting of custom values.14+* Is fully nestable and composable.15+* Supports file handling out of the box.16+* Comes with useful common helpers (getting terminal dimensions,17 ANSI colors, fetching direct keyboard input, screen clearing,18- finding config paths, launching apps and editors, etc.)18+ finding config paths, launching apps and editors, etc.).19 20 There are many alternatives to Click; the obvious ones are ``optparse``21 and ``argparse`` from the standard library. Have a look to see if something22 else resonates with you.22 unmodified lines45 -----------------46 47 Click is internally based on ``optparse`` instead of ``argparse``. This48 is an implementation detail that a user does not have to be concerned49-with. Click is not based on argparse because it has some behaviors that49+with. Click is not based on ``argparse`` because it has some behaviors that50 make handling arbitrary command line interfaces hard:51 52-* argparse has built-in behavior to guess if something is an52+* ``argparse`` has built-in behavior to guess if something is an53 argument or an option. This becomes a problem when dealing with54 incomplete command lines; the behaviour becomes unpredictable55 without full knowledge of a command line. This goes against Click's56 ambitions of dispatching to subparsers.57-* argparse does not support disabling interspersed arguments. Without57+* ``argparse`` does not support disabling interspersed arguments. Without58 this feature, it's not possible to safely implement Click's nested59 parsing.60 61 Why not Docopt etc.?71 unmodified lines133 Why No Auto Correction?134 -----------------------135 136 The question came up why Click does not auto correct parameters given that137-even optparse and argparse support automatic expansion of long arguments.137+even optparse and ``argparse`` support automatic expansion of long arguments.138 The reason for this is that it's a liability for backwards compatibility.139 If people start relying on automatically modified parameters and someone140 adds a new parameter in the future, the script might stop working. These141 kinds of problems are hard to find, so Click does not attempt to be magical5 unmodified lines