Skip to content

Commit

Permalink
CLI: version -> --version
Browse files Browse the repository at this point in the history
  • Loading branch information
dkmiller committed Jan 4, 2025
1 parent f28ee56 commit 92b442d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
28 changes: 20 additions & 8 deletions ptah/cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,26 @@
app = typer.Typer(pretty_exceptions_enable=False)


def version(value: bool):
"""
Current version of the Ptah CLI.
"""
if value:
print(get(Version).version())
raise typer.Exit()

Check warning on line 33 in ptah/cli/__init__.py

View check run for this annotation

Codecov / codecov/patch

ptah/cli/__init__.py#L31-L33

Added lines #L31 - L33 were not covered by tests


@app.callback()
def common(
ctx: typer.Context,
version: bool = typer.Option(None, "--version", callback=version),
):
"""
https://stackoverflow.com/a/71008105
"""
pass

Check warning on line 44 in ptah/cli/__init__.py

View check run for this annotation

Codecov / codecov/patch

ptah/cli/__init__.py#L44

Added line #L44 was not covered by tests


@app.command()
def project(output: Serialization = Serialization.yaml):
"""
Expand All @@ -39,14 +59,6 @@ def project(output: Serialization = Serialization.yaml):
print(serialized)


@app.command()
def version():
"""
Current version of the Ptah CLI.
"""
print(get(Version).version())


@app.command(name="build")
def _build():
"""
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[project]
name = "ptah-cli"
readme = "README.md"
version = "0.5.2"
version = "0.6.0"
authors = [
{ name = "Dan Miller", email = "[email protected]" }
]
Expand Down

0 comments on commit 92b442d

Please sign in to comment.