class Option(Parameter):
Options are usually optional values on the command line and have some extra features that arguments don't have.
All other parameters are passed onwards to the parameter constructor.
Parameters | |
show_default | controls if the default value should be shown on the help page. Normally, defaults are not shown. If this value is a string, it shows the string instead of the value. This is particularly useful for dynamic options. |
show_envvar | controls if an environment variable should be shown on the help page. Normally, environment variables are not shown. |
prompt | if set to True or a non empty string then the user will be
prompted for input. If set to True the prompt will be the
option name capitalized. |
confirmation_prompt | Prompt a second time to confirm the value if it was prompted for. Can be set to a string instead of True to customize the message. |
prompt_required | If set to False, the user will be prompted for input only when the option was specified as a flag without a value. |
hide_input | if this is True then the input on the prompt will be
hidden from the user. This is useful for password
input. |
is_flag | forces this option to act as a flag. The default is auto detection. |
flag_value | which value should be used for this flag if it's enabled. This is set to a boolean automatically if the option string contains a slash to mark two options. |
multiple | if this is set to True then the argument is accepted
multiple times and recorded. This is similar to nargs
in how it works but supports arbitrary number of
arguments. |
count | this flag makes an option increment an integer. |
allow_from_autoenv | if this is enabled then the value of this parameter will be pulled from an environment variable in case a prefix is defined on the context. |
help | the help string. |
hidden | hide this option from help outputs. |
Method | __init__ |
Undocumented |
Method | _parse_decls |
Undocumented |
Method | add_to_parser |
Undocumented |
Method | consume_value |
Undocumented |
Method | get_default |
Get the default for the parameter. Tries Context.lookup_default first, then the local default. |
Method | get_help_record |
Undocumented |
Method | prompt_for_value |
No summary |
Method | resolve_envvar_value |
Undocumented |
Method | to_info_dict |
Gather information that could be useful for a tool generating user-facing documentation. |
Method | value_from_envvar |
Undocumented |
Class Variable | param_type_name |
Undocumented |
Instance Variable | _flag_needs_value |
Undocumented |
Instance Variable | allow_from_autoenv |
Undocumented |
Instance Variable | confirmation_prompt |
Undocumented |
Instance Variable | count |
Undocumented |
Instance Variable | default |
Undocumented |
Instance Variable | flag_value |
Undocumented |
Instance Variable | help |
Undocumented |
Instance Variable | hidden |
Undocumented |
Instance Variable | hide_input |
Undocumented |
Instance Variable | is_bool_flag |
Undocumented |
Instance Variable | is_flag |
Undocumented |
Instance Variable | prompt |
Undocumented |
Instance Variable | prompt_required |
Undocumented |
Instance Variable | show_choices |
Undocumented |
Instance Variable | show_default |
Undocumented |
Instance Variable | show_envvar |
Undocumented |
Instance Variable | type |
Undocumented |
Inherited from Parameter
:
Method | __repr__ |
Undocumented |
Method | get_error_hint |
Get a stringified version of the param for use in error messages to indicate which param caused the error. |
Method | get_usage_pieces |
Undocumented |
Method | handle_parse_result |
Undocumented |
Method | make_metavar |
Undocumented |
Method | process_value |
Undocumented |
Method | shell_complete |
No summary |
Method | type_cast_value |
Convert and validate a value against the option's type , multiple , and nargs . |
Method | value_is_missing |
Undocumented |
Instance Variable | _custom_shell_complete |
Undocumented |
Instance Variable | callback |
Undocumented |
Instance Variable | envvar |
Undocumented |
Instance Variable | expose_value |
Undocumented |
Instance Variable | is_eager |
Undocumented |
Instance Variable | metavar |
Undocumented |
Instance Variable | multiple |
Undocumented |
Instance Variable | name |
Undocumented |
Instance Variable | nargs |
Undocumented |
Instance Variable | opts |
Undocumented |
Instance Variable | required |
Undocumented |
Instance Variable | secondary_opts |
Undocumented |
Property | human_readable_name |
Returns the human readable name of this parameter. This is the same as the name for options, but the metavar for arguments. |
click.core.Parameter.__init__
Undocumented
Parameters | |
param_decls:t.Optional[ | Undocumented |
show_default:t.Union[ | Undocumented |
prompt:t.Union[ | Undocumented |
confirmation_prompt:t.Union[ | Undocumented |
prompt_required:bool | Undocumented |
hide_input:bool | Undocumented |
is_flag:t.Optional[ | Undocumented |
flag_value:t.Optional[ | Undocumented |
multiple:bool | Undocumented |
count:bool | Undocumented |
allow_from_autoenv:bool | Undocumented |
type:t.Optional[ | Undocumented |
help:t.Optional[ | Undocumented |
hidden:bool | Undocumented |
show_choices:bool | Undocumented |
show_envvar:bool | Undocumented |
**attrs:t.Any | Undocumented |
click.core.Parameter._parse_decls
Undocumented
Parameters | |
decls:t.Sequence[ | Undocumented |
expose_value:bool | Undocumented |
Returns | |
t.Tuple[ | Undocumented |
click.core.Parameter.add_to_parser
Undocumented
Parameters | |
parser:OptionParser | Undocumented |
ctx:Context | Undocumented |
click.core.Parameter.consume_value
Undocumented
Parameters | |
ctx:Context | Undocumented |
opts:t.Mapping[ | Undocumented |
Returns | |
t.Tuple[ | Undocumented |
click.core.Parameter.get_default
Get the default for the parameter. Tries
Context.lookup_default
first, then the local default.
Parameters | |
ctx:Context | Current context. |
call:bool | If the default is a callable, call it. Disable to return the callable instead. |
Returns | |
t.Optional[ | Undocumented |
click.core.Parameter.get_help_record
Undocumented
Parameters | |
ctx:Context | Undocumented |
Returns | |
t.Optional[ | Undocumented |
Parameters | |
ctx:Context | Undocumented |
Returns | |
t.Any | Undocumented |
Undocumented
Parameters | |
ctx:Context | Undocumented |
Returns | |
t.Optional[ | Undocumented |
click.core.Parameter.to_info_dict
Gather information that could be useful for a tool generating user-facing documentation.
Use click.Context.to_info_dict
to traverse the entire
CLI structure.
Returns | |
t.Dict[ | Undocumented |
click.core.Parameter.value_from_envvar
Undocumented
Parameters | |
ctx:Context | Undocumented |
Returns | |
t.Optional[ | Undocumented |