diplomat.utils.cli_tools.func_to_command

diplomat.utils.cli_tools.func_to_command(func: TypeCasterFunction, parser: ArgumentParser, allow_short_form: bool = True) ArgumentParser[source]

Convert a typecaster function into an argparse command (CLI command).

Parameters:
  • func – Type caster function to turn into a CLI command.

  • parser – The argument parser to add the function CLI command to.

  • allow_short_form – If true, allow abbreviated versions of arguments to be passed to the CLI.

Returns:

The argparse parser with the function added as a command.