django-typer icon indicating copy to clipboard operation
django-typer copied to clipboard

shellcompletion complete should print to the command's stdout.

Open bckohan opened this issue 1 year ago • 1 comments

This is tricky because we don't want to redirect stdout using contextlib because that will mess up debuggers which is a main reason to use complete.

bckohan avatar Feb 27 '24 08:02 bckohan

To make this work is definitely another patch situation. Typer sends the completions to click.echo which does take a stream as an argument, but theres no way to hook into Typer's use of the call. echo defaults to stdout, but it would be possible to patch the click._compat.get_text_stdout/err functions to do this...

Should click.echo (and typer.echo) use the command stdout/stderr streams when called within the command context? probably... we do have the context tools to make this work.

bckohan avatar Feb 28 '24 02:02 bckohan