Closed ahussey-redhat closed 3 weeks ago
I'm guessing the solution would be to add another argument here https://github.com/FergusFettes/typer-shell/blob/f6c301738365e90c90cefe54bd3c4676839daae5/typer_shell/typer_shell.py#L16
def make_typer_shell(
prompt: str = ">> ",
on_finished: Callable = lambda ctx: None,
intro: str = "\n Welcome to typer-shell! Type help to see commands.\n",
obj: Optional[object] = None,
params: Optional[dict] = None,
params_path: Optional[Path] = None,
launch: Callable = lambda ctx: None,
)
...
shell = make_click_shell(ctx, prompt=prompt, intro=intro)
shell.on_finished: Optional[Callable[[click.Context], None]] = on_finished
Based on the click-shell implementation. I could be way off though
Hey, sorry for the slow reply. I have added this, your suggestion was pretty close! Should be in the pypi shortly, let me know if there is an issue, I would be quicker next time ;)
Thanks for implementing this. I really appreciate it! :)
click-shell takes an option
on_finished
callable, which enables it to run cleanup tasks.It would be great if this could also be added to typer-shell :) https://github.com/clarkperkins/click-shell/blob/main/docs/usage.rst