Skip to content

Commit

Permalink
Merge pull request #1218 from FlooferLand/main
Browse files Browse the repository at this point in the history
Add an option/flag to check the gvsbuild version
  • Loading branch information
danyeaw authored Jan 26, 2024
2 parents 1151024 + 27f1041 commit a97b6f9
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
12 changes: 12 additions & 0 deletions gvsbuild/info.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import typer


def version_callback(active: bool):
if not active:
return

import importlib.metadata

version = importlib.metadata.version("gvsbuild")
typer.echo(f"gvsbuild v{version}")
raise typer.Exit()
11 changes: 11 additions & 0 deletions gvsbuild/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import gvsbuild.projects # noqa: F401
import gvsbuild.tools # noqa: F401
from gvsbuild.build import build
from gvsbuild.info import version_callback
from gvsbuild.outdated import outdated

rich.reconfigure(markup=False)
Expand All @@ -51,5 +52,15 @@
app.command(help="")(deps)


@app.callback()
def common(
ctx: typer.Context,
version: bool = typer.Option(
None, "--version", callback=version_callback, help="Show the app's version"
),
):
pass


def run():
app()

0 comments on commit a97b6f9

Please sign in to comment.