-
First Check
Commit to Help
Example Codefrom typing import List, Optional
import typer
from typing_extensions import Annotated
def main(user: Annotated[Optional[List[str]], typer.Option()] = None):
if not user:
print(f"No provided users (raw input = {user})")
raise typer.Abort()
for u in user:
print(f"Processing user: {u}")
if __name__ == "__main__":
typer.run(main) DescriptionThe code above requires you do use Operating SystemLinux Operating System DetailsNo response Typer Version0.16.0 Python Version3.12 Additional ContextNo response |
Beta Was this translation helpful? Give feedback.
Answered by
kinuax
Jul 5, 2025
Replies: 1 comment 1 reply
-
Typer only supports a fixed number of values for list CLI option. Source: https://typer.tiangolo.com/tutorial/multiple-values/options-with-multiple-values/ If you want to keep
Note that replacing |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
Timmmm
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Typer only supports a fixed number of values for list CLI option. Source: https://typer.tiangolo.com/tutorial/multiple-values/options-with-multiple-values/
If you want to keep
--user
only once, you may pass a random number of users separating them with anything but a space.