added --version flag

This commit is contained in:
Daniel Fichtinger 2025-07-17 22:19:09 -04:00
parent f490e10f1f
commit c2d2780e4a
3 changed files with 14 additions and 3 deletions

View file

@ -15,6 +15,7 @@ import argparse
import re import re
import sys import sys
import textwrap import textwrap
from importlib.metadata import version
def main() -> None: def main() -> None:
@ -93,6 +94,13 @@ Contact : daniel@ficd.sh
""", """,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=argparse.RawDescriptionHelpFormatter,
) )
parser.add_argument(
"-v",
"--version",
required=False,
help="Print version info and exit.",
action="store_true",
)
parser.add_argument( parser.add_argument(
"-w", "-w",
"--width", "--width",
@ -162,6 +170,9 @@ Contact : daniel@ficd.sh
help="Output file. (default: %(default)s)", help="Output file. (default: %(default)s)",
) )
args = parser.parse_args() args = parser.parse_args()
if args.version:
print(version("mailfmt"))
exit(0)
width = args.width width = args.width
should_check_signoff = args.no_signoff should_check_signoff = args.no_signoff
should_check_signature = args.no_signature should_check_signature = args.no_signature

View file

@ -1,10 +1,10 @@
[project] [project]
name = "mailfmt" name = "mailfmt"
version = "1.0.3" version = "1.0.4"
description = "Heuristic plain text email formatter." description = "Heuristic plain text email formatter."
readme = "README.md" readme = "README.md"
authors = [ authors = [
{ name = "Daniel Fichtinger", email = "daniel@ficd.ca" } { name = "Daniel Fichtinger", email = "daniel@ficd.sh" }
] ]
requires-python = ">=3.11" requires-python = ">=3.11"
dependencies = [] dependencies = []

2
uv.lock generated
View file

@ -4,5 +4,5 @@ requires-python = ">=3.11"
[[package]] [[package]]
name = "mailfmt" name = "mailfmt"
version = "1.0.1" version = "1.0.3"
source = { editable = "." } source = { editable = "." }