Skip to content

Commit b856aef

Browse files
committed
Add -V/--version option to display version
Signed-off-by: Martin Prpič <martin.prpic@gmail.com>
1 parent e8d00fd commit b856aef

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/commit_editor/cli.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import argparse
22
import sys
3+
from importlib.metadata import version
34
from pathlib import Path
45

56

@@ -9,6 +10,12 @@ def main() -> int:
910
prog="commit-editor",
1011
description="A terminal-based git commit message editor with opinionated formatting",
1112
)
13+
parser.add_argument(
14+
"-V",
15+
"--version",
16+
action="version",
17+
version=f"%(prog)s {version('commit-editor')}",
18+
)
1219
parser.add_argument(
1320
"filename",
1421
type=Path,

0 commit comments

Comments
 (0)