Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog


## [0.3.1] - 2026-04-17

### Added
- CLI `--version` flag

### Documentation
- Documented `--version` usage in README

## [0.3.0] - 2026-04-17

### Added
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ pipx install photo-tools-cli
```
Installs the CLI in an isolated environment and makes `photo-tools` available globally, avoiding dependency conflicts.

Check installed version:

```shell
photo-tools --version
```

### Using pip (if pipx not available)

```shell
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "photo-tools-cli"
version = "0.3.0"
version = "0.3.1"
description = "Python CLI tools for photography workflows"
readme = "README.md"
requires-python = ">=3.13"
Expand Down
14 changes: 12 additions & 2 deletions src/photo_tools/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from photo_tools.cli_support.cli_errors import handle_cli_errors
from photo_tools.cli_support.cli_reporter import make_reporter
from photo_tools.cli_support.cli_version import version_callback
from photo_tools.commands.clean_unpaired_raws import clean_unpaired_raws
from photo_tools.commands.keep_five_star_raws import keep_five_star_raws
from photo_tools.commands.optimise import optimise
Expand All @@ -20,9 +21,18 @@


@app.callback()
def main() -> None:
def main(
version: bool = typer.Option(
None,
"--version",
"-V",
help="Show version and exit",
callback=version_callback,
is_eager=True,
),
) -> None:
try:
# validate dependencies needed globally (if any)
# validate dependencies needed globally
validate_feature("exif")
except MissingDependencyError as e:
typer.secho(f"Error: {e}", fg=typer.colors.RED, err=True)
Expand Down
18 changes: 18 additions & 0 deletions src/photo_tools/cli_support/cli_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from importlib.metadata import PackageNotFoundError, version

import typer


def get_version() -> str:
try:
return version("photo-tools-cli")
except PackageNotFoundError:
return "unknown"


def version_callback(value: bool) -> None:
if not value:
return

typer.echo(get_version())
raise typer.Exit()
Loading