Skip to content
Discussion options

You must be logged in to vote

You can configure Usage using metavar parameter:

import typer from typing import Literal, get_args ALL_PRODUCT_TYPES_T = Literal[ "Longlonglongname1:more_long_things_here", "Longname2:NUM1ABC", "Longname2:NUM1ABC_delete", "Longname2:NUM2ABC", "Longname2:NUM2ABC_delete", "Longname3:NU_3_ABC___", "Longname3:NU_2_CDE___", "Longname3:NU_2_CDE____delete", ] app = typer.Typer() def get_help_for_literal(literal_type: type) -> str: values = get_args(literal_type) return "\n\n".join(f"'{value}'" for value in values) @app.command() def main( product_type: ALL_PRODUCT_TYPES_T = typer.Argument( ..., metavar="PRODUCT_TYPE", help=get_help_for_li…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by pjonsson
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Question or problem
2 participants