added --version flag
This commit is contained in:
parent
f490e10f1f
commit
c2d2780e4a
3 changed files with 14 additions and 3 deletions
11
mailfmt.py
11
mailfmt.py
|
@ -15,6 +15,7 @@ import argparse
|
|||
import re
|
||||
import sys
|
||||
import textwrap
|
||||
from importlib.metadata import version
|
||||
|
||||
|
||||
def main() -> None:
|
||||
|
@ -93,6 +94,13 @@ Contact : daniel@ficd.sh
|
|||
""",
|
||||
formatter_class=argparse.RawDescriptionHelpFormatter,
|
||||
)
|
||||
parser.add_argument(
|
||||
"-v",
|
||||
"--version",
|
||||
required=False,
|
||||
help="Print version info and exit.",
|
||||
action="store_true",
|
||||
)
|
||||
parser.add_argument(
|
||||
"-w",
|
||||
"--width",
|
||||
|
@ -162,6 +170,9 @@ Contact : daniel@ficd.sh
|
|||
help="Output file. (default: %(default)s)",
|
||||
)
|
||||
args = parser.parse_args()
|
||||
if args.version:
|
||||
print(version("mailfmt"))
|
||||
exit(0)
|
||||
width = args.width
|
||||
should_check_signoff = args.no_signoff
|
||||
should_check_signature = args.no_signature
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue