-
-
Notifications
You must be signed in to change notification settings - Fork 684
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🐛 Fix
shell_complete
not working for Arguments (#737)
Co-authored-by: svlandeg <svlandeg@github.com>
- Loading branch information
Showing
3 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import click | ||
import typer | ||
|
||
app = typer.Typer() | ||
|
||
|
||
def shell_complete(ctx: click.Context, param: click.Parameter, incomplete: str): | ||
typer.echo(f"ctx: {ctx.info_name}", err=True) | ||
typer.echo(f"arg is: {param.name}", err=True) | ||
typer.echo(f"incomplete is: {incomplete}", err=True) | ||
return ["Emma"] | ||
|
||
|
||
@app.command(context_settings={"auto_envvar_prefix": "TEST"}) | ||
def main(name: str = typer.Argument(shell_complete=shell_complete)): | ||
""" | ||
Say hello. | ||
""" | ||
|
||
|
||
if __name__ == "__main__": | ||
app() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters