I am working on a CLI tool written in Python with Typer. We have some bash scripts which I am currently rewriting in Python and one of them generates markdown documentation for the tool using typer-cli. I know I can use Python's Subprocess management to call it, but I would prefer not to.
The idea is to make all scripts completely platform-independent by rewriting them in Python and although the current subprocess approach with that particular call is most likely perfectly fine, I am very curious how to do it otherwise.
I looked into typer-cli's source code and found that I should probably make a call to docs().
This is the code I would like to replace:
# TODO: try to use typer_cli.main.docs here instead
typer_args = (
f"typer {PATH_KPOPS_MAIN} utils docs --name kpops --output {PATH_CLI_COMMANDS_DOC}"
)
subprocess.run(typer_args, shell=True)
I also read about the Context object, but still, I didn't understand how to get the context from the Typer app kpops to pass it to typer-cli's docs function.