utils.command_line_tools module

Tools for command line interfaces with click

class PythonLiteralOption(param_decls=None, show_default=False, prompt=False, confirmation_prompt=False, hide_input=False, is_flag=None, flag_value=None, multiple=False, count=False, allow_from_autoenv=True, type=None, help=None, hidden=False, show_choices=True, show_envvar=False, **attrs)[source]

Bases: click.core.Option

Option allowing a python literal to be passed as a string which is then parsed

Notes

Small variation on a solution proposed by stackoverflow user Stephen Rauch

type_cast_value(ctx, value)[source]

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