Skip to content

Commit bb2d984

Browse files
committed
update version ahndling plus option
1 parent ac4fcb3 commit bb2d984

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

CHANGES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## 1.0.0
44

5-
- Added tests, CI workflows and hatchling/ trusted publishing
5+
- Added tests, CI workflows and hatchling/ trusted publishing and `--version` option
66
[@jensens, 2025-11-03]
77
- Initial porting from https://github.com/rnixx/githelper
88
[@rnix, 2025-03-03]

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ build-backend = "hatchling.build"
4343
[tool.hatch.version]
4444
source = "vcs"
4545

46+
[tool.hatch.build.hooks.vcs]
47+
version-file = "src/mxrepo/_version.py"
48+
4649
[tool.hatch.metadata]
4750
allow-direct-references = true
4851

src/mxrepo/main.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from argparse import ArgumentParser
2+
from importlib.metadata import version
23

34
import json
45
import os
@@ -9,6 +10,11 @@
910

1011

1112
mainparser = ArgumentParser(description="Git helper utilities")
13+
mainparser.add_argument(
14+
"--version",
15+
action="version",
16+
version=f"%(prog)s {version('mxrepo')}",
17+
)
1218
subparsers = mainparser.add_subparsers(help="command", required=True)
1319

1420

0 commit comments

Comments
 (0)