aiida.cmdline.params.arguments package

Module with pre-defined reusable commandline arguments that can be used as click decorators.

Submodules

Module with pre-defined reusable commandline arguments that can be used as click decorators.

class aiida.cmdline.params.arguments.overridable.OverridableArgument(*args, **kwargs)[source]

Bases: object

Wrapper around click.argument that increases reusability

Once defined, the argument can be reused with a consistent name and sensible defaults while other details can be customized on a per-command basis

Example:

@click.command()
@CODE('code')
def print_code_pk(code):
    click.echo(code.pk)

@click.command()
@CODE('codes', nargs=-1)
def print_code_pks(codes):
    click.echo([c.pk for c in codes])

Notice that the arguments, which are used to define the name of the argument and based on which the function argument name is determined, can be overriden

__call__(*args, **kwargs)[source]

Override the stored kwargs with the passed kwargs and return the argument, using the stored args only if they are not provided. This allows the user to override the variable name, which is useful if for example they want to allow multiple value with nargs=-1 and want to pluralize the function argument for consistency

__dict__ = mappingproxy({'__module__': 'aiida.cmdline.params.arguments.overridable', '__doc__': "\n    Wrapper around click.argument that increases reusability\n\n    Once defined, the argument can be reused with a consistent name and sensible defaults while\n    other details can be customized on a per-command basis\n\n    Example::\n\n        @click.command()\n        @CODE('code')\n        def print_code_pk(code):\n            click.echo(code.pk)\n\n        @click.command()\n        @CODE('codes', nargs=-1)\n        def print_code_pks(codes):\n            click.echo([c.pk for c in codes])\n\n    Notice that the arguments, which are used to define the name of the argument and based on which\n    the function argument name is determined, can be overriden\n    ", '__init__': <function OverridableArgument.__init__>, '__call__': <function OverridableArgument.__call__>, '__dict__': <attribute '__dict__' of 'OverridableArgument' objects>, '__weakref__': <attribute '__weakref__' of 'OverridableArgument' objects>, '__annotations__': {}})
__init__(*args, **kwargs)[source]

Store the default args and kwargs

__module__ = 'aiida.cmdline.params.arguments.overridable'
__weakref__

list of weak references to the object (if defined)