Replies: 1 comment
-
|
Given you actually want the parameter as Path, not as raw string, have you tried using the (parent) context to access it? def autocomplete(ctx: Context):
print(ctx.parent.params.get("path"), file=sys.stderr) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
First Check
Commit to Help
Example Code
Description
I have some completions that depends on the params passed to the root command callback.
I am not able to get these arguments or the get the raw command string, so I can't get the "path" value is the autocomplete() function here.
argsfor me is always[]How should I do ?
Operating System
macOS
Operating System Details
MacOS 26.0.1
Typer Version
0.21.0
Python Version
3.13.0
Additional Context
Here is a pyproject to reproduce:
File name is named
typer_raw.pyand is right next to the pyproject.toml.I used
uv sync, then activated the .venv and then usedcli --install-completionI'm using ZSH 5.9 arm64-apple-darwin25.0
Beta Was this translation helpful? Give feedback.
All reactions