Skip to content
Myr

Merge pull request #10 from epequeno/spellcheck

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Spellcheck

authored by Armin Ronacher · committed by Armin Ronacher · parents 3eba021, 1d47e20 · Browse files · 2 files+9 added−9 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+9 added−9 removed

  • other:+9 added−9 removed

2 files+9 added−9 removed

modified:docs/options.rst+4 added-4 removed
3 unmodified lines
4.. currentmodule:: click56Adding options to commands can be accomplished by the :func:`option`7decorator. Since options can come in various different versions there8have a ton of parameters to configure their behavior.8are a ton of parameters to configure their behavior.910Basic Value Options11-------------------12
88 unmodified lines
101----------------102103In addition to boolean flag there are also feature switches. These are104implemented by setting multiple options to the same parameter name and by105defining a flag value. To select a default the default flag can be set to106`True` on the one that should be the default.105defining a flag value. To set a default flag assign a value of `True` to106the flag that should be the default.107108Example::109110 import os
167 unmodified lines
278---------------------------------279280A very useful feature of click is the ability to accept parameters from281environment variables in addition to regular parameters. This allows282tools to be much easier automated. For instance you might want to pass282tools to be automated much easier. For instance you might want to pass283the config file as ``--config`` parameter but also support exporting a284``TOOL_CONFIG=hello.cfg`` key / value pair for a nicer development285experience.286
45 unmodified lines
modified:docs/parameters.rst+5 added-5 removed
7 unmodified lines
8when to use which so here is a quick overview of the differences. As the9name indicates an option is optional. While arguments can be optional10within reason they are much more restricted in how they can be optional.1112To help you pick when to use what the recommendation is to use arguments13exclusively for things like going to subcommands or input filenames /14URLs and have everything else be an option instead.12To help you decide between options and arguments, the recommendation is13to use arguments exclusively for things like going to subcommands or input 14filenames / URLs and have everything else be an option instead.1516Differences17-----------18
43 unmodified lines
62Parameter Names63---------------6465Parameters (both options and arguments) accept a number of positional66arguments which are the parameter declarations. Each string string with a66arguments which are the parameter declarations. Each string with a67single dash is added as short argument, each string starting with a double68dash as long one. If a string is added without any dashes it's the69internal parameter name which is also used as variable name.7071If a parameter does not have a name without dashes added one is generated71If a parameter is not given a name without dashes a name is generated72automatically by taking the longest argument and converting all dashes to73underscores. So for an option with ``('-f', '--foo-bar')`` the parameter74name is `foo_bar`. For an option with ``('-x',)`` the parameter is `x`.75For an option with ``('-f', '--filename', 'dest')`` the parameter is
33 unmodified lines