Update version flag (#1452)
This commit is contained in:
parent
6bc622e67d
commit
0ebe1529a6
@ -66,7 +66,7 @@ pre-commit = {version = "^3.2.1", python = ">=3.8,<4.0"}
|
|||||||
selenium = "^4.10.0"
|
selenium = "^4.10.0"
|
||||||
|
|
||||||
[tool.poetry.scripts]
|
[tool.poetry.scripts]
|
||||||
reflex = "reflex.reflex:main"
|
reflex = "reflex.reflex:cli"
|
||||||
|
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = ["poetry-core>=1.5.1"]
|
requires = ["poetry-core>=1.5.1"]
|
||||||
|
@ -18,10 +18,33 @@ from reflex.utils import build, console, exec, prerequisites, processes, telemet
|
|||||||
cli = typer.Typer()
|
cli = typer.Typer()
|
||||||
|
|
||||||
|
|
||||||
@cli.command()
|
def version(value: bool):
|
||||||
def version():
|
"""Get the Reflex version.
|
||||||
"""Get the Reflex version."""
|
|
||||||
console.print(constants.VERSION)
|
Args:
|
||||||
|
value: Whether the version flag was passed.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
typer.Exit: If the version flag was passed.
|
||||||
|
"""
|
||||||
|
if value:
|
||||||
|
console.print(constants.VERSION)
|
||||||
|
raise typer.Exit()
|
||||||
|
|
||||||
|
|
||||||
|
@cli.callback()
|
||||||
|
def main(
|
||||||
|
version: bool = typer.Option(
|
||||||
|
None,
|
||||||
|
"--version",
|
||||||
|
"-v",
|
||||||
|
callback=version,
|
||||||
|
help="Get the Reflex version.",
|
||||||
|
is_eager=True,
|
||||||
|
),
|
||||||
|
):
|
||||||
|
"""Reflex CLI global configuration."""
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
@cli.command()
|
@cli.command()
|
||||||
@ -306,8 +329,7 @@ def makemigrations(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
cli.add_typer(db_cli, name="db", help="Subcommands for managing the database schema")
|
cli.add_typer(db_cli, name="db", help="Subcommands for managing the database schema.")
|
||||||
main = cli
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
cli()
|
||||||
|
Loading…
Reference in New Issue
Block a user