Skip to content

Commit

Permalink
feat(framework) Add --version flag to CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesbvll committed Dec 2, 2024
1 parent ae9ec5b commit 45fdbc0
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/py/flwr/cli/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,37 @@
import typer
from typer.main import get_command

from flwr.common.version import package_version

from .build import build
from .install import install
from .log import log
from .ls import ls
from .new import new
from .run import run


app = typer.Typer(
help=typer.style(
"flwr is the Flower command line interface.",
fg=typer.colors.BRIGHT_YELLOW,
bold=True,
),
no_args_is_help=True,
invoke_without_command=True,
)


@app.callback()
def main(
version: bool = typer.Option(False, "--version", help="Show the version and exit.")
):
"""Print the version of the package."""
if version:
typer.echo(package_version)
raise typer.Exit()


app.command()(new)
app.command()(run)
app.command()(build)
Expand Down

0 comments on commit 45fdbc0

Please sign in to comment.