Skip to main content

print_version

Prints the current Typer version and exits the program if the version flag is set and the context is not in resilient parsing mode.

def print_version(
ctx: click.Context,
param: Option,
value: bool
) - > None

Prints the current Typer version and exits the program if the version flag is set.

Parameters

NameTypeDescription
ctxclick.ContextThe Click context object containing state information for the current command execution.
paramOptionThe specific CLI option object that triggered this callback.
valueboolThe boolean flag indicating whether the version option was provided by the user.

Returns

TypeDescription
NoneNothing is returned as the function terminates the process with a typer.Exit exception upon printing.