Skip to content

Commit edde7d1

Browse files
committed
feat: Add dynamic versioning and version argument
1 parent 1d5c1f2 commit edde7d1

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ The formatter follows a list of pre-defined rules outlined below.
3030
## Installation
3131
Install `feefifofum` directly from GitHub by running the following command:
3232
```shell
33-
pip install git+https://github.com/rushwerks/feefifofum.git@v0.1.3
33+
pip install git+https://github.com/rushwerks/feefifofum.git@v0.2.0
3434
```
3535

3636
## Usage
@@ -56,7 +56,7 @@ feefifofum <file1> <file2> <file3> --verbose
5656
`feefifofum` is also available as a pre-commit hook. It can be configured as follows:
5757
```yaml
5858
- repo: https://github.com/rushwerks/feefifofum/
59-
rev: v0.1.3
59+
rev: v0.2.0
6060
hooks:
6161
- id: feefifofum
6262
```

feefifofum/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__version__ = '0.2.0'

feefifofum/main.py

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from argparse import ArgumentParser
77
from pathlib import Path
88

9+
from feefifofum import __version__
910
from feefifofum.core.format import format_feature_file
1011
from feefifofum.utils.file_utils import get_file_paths, read_file_lines, write_file_lines
1112

@@ -22,6 +23,7 @@ def main() -> None: # pragma: no cover
2223
help='Path to feature files and/or directories',
2324
)
2425
parser.add_argument('--verbose', '-v', action='store_true', help='Enable verbose logging')
26+
parser.add_argument('--version', '-V', action='version', version=f'%(prog)s {__version__}')
2527

2628
args = parser.parse_args()
2729
if args.verbose:

pyproject.toml

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "feefifofum"
7-
version = "0.1.3"
7+
dynamic = ["version"]
88
requires-python = ">=3.7"
99
description = "Feature file formatter"
1010
readme = "README.md"
@@ -23,6 +23,9 @@ Homepage = "https://github.com/rushwerks/feefifofum"
2323
[project.scripts]
2424
feefifofum = "feefifofum.main:main"
2525

26+
[tool.setuptools.dynamic]
27+
version = {attr = "feefifofum.__version__"}
28+
2629
[tool.ruff]
2730
line-length = 120
2831
target-version = "py37"

0 commit comments

Comments
 (0)