MWArgument

class lsst.daf.butler.cli.utils.MWArgument(param_decls, required=None, **attrs)

Bases: click.core.Argument

Overrides click.Argument with desired behaviors.

Attributes Summary

human_readable_name Returns the human readable name of this parameter.
param_type_name

Methods Summary

add_to_parser(parser, ctx)
consume_value(ctx, opts)
full_process_value(ctx, value)
get_default(ctx) Given a context variable this calculates the default value.
get_error_hint(ctx) Get a stringified version of the param for use in error messages to indicate which param caused the error.
get_help_record(ctx)
get_usage_pieces(ctx)
handle_parse_result(ctx, opts, args)
make_metavar() Overrides click.Option.make_metavar.
process_value(ctx, value) Given a value and context this runs the logic to convert the value as necessary.
resolve_envvar_value(ctx)
type_cast_value(ctx, value) Given a value this runs it properly through the type system.
value_from_envvar(ctx)
value_is_missing(value)

Attributes Documentation

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.

param_type_name = 'argument'

Methods Documentation

add_to_parser(parser, ctx)
consume_value(ctx, opts)
full_process_value(ctx, value)
get_default(ctx)

Given a context variable this calculates the default value.

get_error_hint(ctx)

Get a stringified version of the param for use in error messages to indicate which param caused the error.

get_help_record(ctx)
get_usage_pieces(ctx)
handle_parse_result(ctx, opts, args)
make_metavar() → str

Overrides click.Option.make_metavar. Makes the metavar for the help menu. Always adds a space and an elipsis (’ …’) after the metavar name if the option accepts multiple inputs.

By default click adds an elipsis without a space between the metavar and the elipsis, but we prefer a space between.

Returns:
metavar : str

The metavar value.

process_value(ctx, value)

Given a value and context this runs the logic to convert the value as necessary.

resolve_envvar_value(ctx)
type_cast_value(ctx, value)

Given a value this runs it properly through the type system. This automatically handles things like nargs and multiple as well as composite types.

value_from_envvar(ctx)
value_is_missing(value)