class documentation

The ``Path`` type is similar to the :class:`File` type, but returns the filename instead of an open file. Various checks can be enabled to validate the type of file and permissions. :param exists: The file or directory needs to exist for the value to be valid. If this is not set to ``True``, and the file does not exist, then all further checks are silently skipped. :param file_okay: Allow a file as a value. :param dir_okay: Allow a directory as a value. :param readable: if true, a readable check is performed. :param writable: if true, a writable check is performed. :param executable: if true, an executable check is performed. :param resolve_path: Make the value absolute and resolve any symlinks. A ``~`` is not expanded, as this is supposed to be done by the shell only. :param allow_dash: Allow a single dash as a value, which indicates a standard stream (but does not open it). Use :func:`~click.open_file` to handle opening this value. :param path_type: Convert the incoming path value to this type. If ``None``, keep Python's default, which is ``str``. Useful to convert to :class:`pathlib.Path`. .. versionchanged:: 8.1 Added the ``executable`` parameter. .. versionchanged:: 8.0 Allow passing ``type=pathlib.Path``. .. versionchanged:: 6.0 Added the ``allow_dash`` parameter.

Method __init__ Undocumented
Method coerce_path_result Undocumented
Method convert Convert the value to the correct type. This is not called if the value is ``None`` (the missing value).
Method shell_complete Return a special completion marker that tells the completion system to use the shell to provide path completions for only directories or any paths.
Method to_info_dict Gather information that could be useful for a tool generating user-facing documentation.
Instance Variable allow_dash Undocumented
Instance Variable dir_okay Undocumented
Instance Variable executable Undocumented
Instance Variable exists Undocumented
Instance Variable file_okay Undocumented
Instance Variable name Undocumented
Instance Variable readable Undocumented
Instance Variable resolve_path Undocumented
Instance Variable type Undocumented
Instance Variable writable Undocumented

Inherited from ParamType:

Method __call__ Undocumented
Method fail Helper method to fail with an invalid value message.
Method get_metavar Returns the metavar default for this param if it provides one.
Method get_missing_message Optionally might return extra information about a missing parameter.
Method split_envvar_value Given a value from an environment variable this splits it up into small chunks depending on the defined envvar list splitter.
Class Variable arity Undocumented
Class Variable envvar_list_splitter Undocumented
Class Variable is_composite Undocumented
def __init__(self, exists=False, file_okay=True, dir_okay=True, writable=False, readable=True, resolve_path=False, allow_dash=False, path_type=None, executable=False): (source)

Undocumented

Parameters
exists:boolUndocumented
file_okay:boolUndocumented
dir_okay:boolUndocumented
writable:boolUndocumented
readable:boolUndocumented
resolve_path:boolUndocumented
allow_dash:boolUndocumented
path_type:t.Optional[t.Type]Undocumented
executable:boolUndocumented
def coerce_path_result(self, rv): (source)

Undocumented

Parameters
rv:t.AnyUndocumented
Returns
t.AnyUndocumented
def convert(self, value, param, ctx): (source)

Convert the value to the correct type. This is not called if the value is ``None`` (the missing value). This must accept string values from the command line, as well as values that are already the correct type. It may also convert other compatible types. The ``param`` and ``ctx`` arguments may be ``None`` in certain situations, such as when converting prompt input. If the value cannot be converted, call :meth:`fail` with a descriptive message. :param value: The value to convert. :param param: The parameter that is using this type to convert its value. May be ``None``. :param ctx: The current context that arrived at this value. May be ``None``.

Parameters
value:t.AnyUndocumented
param:t.Optional[Parameter]Undocumented
ctx:t.Optional[Context]Undocumented
Returns
t.AnyUndocumented
def shell_complete(self, ctx, param, incomplete): (source)

Return a special completion marker that tells the completion system to use the shell to provide path completions for only directories or any paths. :param ctx: Invocation context for this command. :param param: The parameter that is requesting completion. :param incomplete: Value being completed. May be empty. .. versionadded:: 8.0

Parameters
ctx:ContextUndocumented
param:ParameterUndocumented
incomplete:strUndocumented
Returns
t.List[CompletionItem]Undocumented
def to_info_dict(self): (source)

Gather information that could be useful for a tool generating user-facing documentation. Use :meth:`click.Context.to_info_dict` to traverse the entire CLI structure. .. versionadded:: 8.0

Returns
t.Dict[str, t.Any]Undocumented
allow_dash = (source)

Undocumented

dir_okay = (source)

Undocumented

executable = (source)

Undocumented

exists = (source)

Undocumented

file_okay = (source)

Undocumented

name = (source)

Undocumented

readable = (source)

Undocumented

resolve_path = (source)

Undocumented

type = (source)

Undocumented

writable = (source)

Undocumented