CLI#

fitrequest.cli_utils.run_pretty(func: Callable) Callable[source]#

Simplify running fitrequest methods from the CLI, supporting both synchronous and asynchronous functions. The results are pretty-printed using ‘rich’ for enhanced readability.

fitrequest.cli_utils.add_httpx_args(func: Callable) Callable[source]#

If the signature does not already include these arguments, the function adds some common httpx parameters. These parameters will then be accessible via the CLI. They are added only if kwargs is included in the method’s signature.

fitrequest.cli_utils.transform_literals(func: Callable) Callable[source]#

Unfortunatly typer doesn’t support literals, this decorator transform all literals in signature to enums.

fitrequest.cli_utils.literal_to_enum(name: str, literal: type[Literal]) type[StrEnum][source]#

Create an Enum dynamically.

fitrequest.cli_utils.fit_cli_command(command: Callable) Callable[source]#

Enhance CLI commands (automatically generated fitrequest methods) by adding custom request options, supporting additional format types not handled by Typer, and improving the output formatting for a more readable presentation.

fitrequest.cli_utils.is_cli_command(command: Callable) bool[source]#

Returns True if the provided function is intended to be exposed as a command in the CLI.