Skip to content

Commit

Permalink
mtf2json: introduced the '--mml-commit' constant and argument
Browse files Browse the repository at this point in the history
  • Loading branch information
juk0de committed Jul 20, 2024
1 parent 8aa1e5b commit a388ba0
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion mtf2json/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# this enables direct import from 'mtf2json' (instead of 'mtf2json.mtf2json')
from .mtf2json import read_mtf, write_json, ConversionError, version, mm_version # noqa
from .mtf2json import read_mtf, write_json, ConversionError, version, mml_commit # noqa
10 changes: 8 additions & 2 deletions mtf2json/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import argparse
from pathlib import Path
import os
from .mtf2json import read_mtf, write_json, ConversionError, version, mm_version
from .mtf2json import read_mtf, write_json, ConversionError, version, mml_commit
from typing import Optional, List, Tuple


Expand All @@ -28,6 +28,9 @@ def create_parser() -> argparse.ArgumentParser:
parser.add_argument('--version', '-V',
action='store_true',
help="Print version")
parser.add_argument('--mml-commit', '-C',
action='store_true',
help="Print latest supported MegaMekLab commit")
parser.add_argument('--mtf-dir', '-M',
type=str,
help="Convert all MTF files in the given directory.",
Expand Down Expand Up @@ -109,7 +112,10 @@ def main() -> None:

# print version
if args.version:
print(f"{version} (MM: {mm_version})")
print(f"{version}")
sys.exit(0)
if args.mml_commit:
print(f"{mml_commit}")
sys.exit(0)

# either file conversion or directory conversion is allowed, but not both simultaneously
Expand Down
2 changes: 1 addition & 1 deletion mtf2json/mtf2json.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@


version = "0.1.6"
mm_version = "0.49.19.1"
mml_commit = "1ceb93b3ad182d54e16578718322847111d3d8a4"


class ConversionError(Exception):
Expand Down
2 changes: 1 addition & 1 deletion mtf2json/mtf2json.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ from typing import Dict, Any


version: str
mm_version: str
mml_commit: str


class ConversionError(Exception):
Expand Down

0 comments on commit a388ba0

Please sign in to comment.