API Reference

auto_cli.cli.register_command(function: Union[str, Callable[[...], Any]], name: Optional[str] = None, parameter_types: Optional[Dict[str, Callable]] = None, return_type: Optional[Callable[[Any], Any]] = None, short_names: Optional[Dict[str, str]] = None) → None

Register function as an available command.

Parameters
  • function – the function to register.

  • name – Override the name of the function in the cli. Defaults to function.__name__

  • parameter_types – Override the type of an argument. Dictionary of name of the parameter to type.

  • return_type – Override the return type of the function. Will be called with the return value of function before it is printed to stdout.

  • short_names – Optionally add a short version of the parameter. Dictionary of name of the parameter to shorter name. For instance {"very_long_name": "-l"}.