morpheus.cli.utils.MorpheusRelativePath

class MorpheusRelativePath(*args, **kwargs)[source]

Bases: click.types.Path

A specialization of the click.Path class that falls back to using package relative paths if the file cannot be found. Takes the exact same parameters as click.Path

Methods

 __call__(value[, param, ctx]) Call self as a function. convert(value, param, ctx) Convert the value to the correct type. fail(message[, param, ctx]) Helper method to fail with an invalid value message. get_metavar(param) Returns the metavar default for this param if it provides one. get_missing_message(param) Optionally might return extra information about a missing parameter. shell_complete(ctx, param, incomplete) Return a special completion marker that tells the completion system to use the shell to provide path completions for only directories or any paths. split_envvar_value(rv) Given a value from an environment variable this splits it up into small chunks depending on the defined envvar list splitter. to_info_dict() Gather information that could be useful for a tool generating user-facing documentation.
 coerce_path_result
convert(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 fail() with a descriptive message.

Parameters
• value (Any) – The value to convert.

• param (Optional[click.core.Parameter]) – The parameter that is using this type to convert its value. May be None.

• ctx (Optional[click.core.Context]) – The current context that arrived at this value. May be None.

fail(message, param=None, ctx=None)[source]

Helper method to fail with an invalid value message.

get_metavar(param)[source]

Returns the metavar default for this param if it provides one.

get_missing_message(param)[source]

Optionally might return extra information about a missing parameter.

New in version 2.0.

shell_complete(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.

Parameters
• ctx (Context) – Invocation context for this command.

• param (Parameter) – The parameter that is requesting completion.

• incomplete (str) – Value being completed. May be empty.

New in version 8.0.

split_envvar_value(rv)[source]

Given a value from an environment variable this splits it up into small chunks depending on the defined envvar list splitter.

If the splitter is set to None, which means that whitespace splits, then leading and trailing whitespace is ignored. Otherwise, leading and trailing splitters usually lead to empty items being included.

to_info_dict()[source]

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.

New in version 8.0.