Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allowing user to specify a target version #58

Merged
merged 10 commits into from
Dec 13, 2021
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
nmerket marked this conversation as resolved.
Show resolved Hide resolved
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
Expand Down
31 changes: 21 additions & 10 deletions hpxml_version_translator/__init__.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,34 @@
import argparse
from hpxml_version_translator.converter import convert_hpxml_to_3
from hpxml_version_translator.converter import (
convert_hpxml_to_version,
get_hpxml_versions,
)
import sys


def main(argv=sys.argv[1:]):
parser = argparse.ArgumentParser(description='HPXML Version Translator, convert an HPXML file to 3.0')
parser.add_argument(
'hpxml_input',
help='Filename of hpxml file'
parser = argparse.ArgumentParser(
description="HPXML Version Translator, convert an HPXML file to a newer version"
)
parser.add_argument("hpxml_input", help="Filename of hpxml file")
parser.add_argument(
'-o', '--output',
type=argparse.FileType('wb'),
"-o",
"--output",
type=argparse.FileType("wb"),
default=sys.stdout.buffer,
help='Filename of output HPXML v3 file. If not provided, will go to stdout'
help="Filename of output HPXML v3 file. If not provided, will go to stdout",
)
parser.add_argument(
"-v",
"--to_hpxml_version",
type=str,
default="3.0",
choices=get_hpxml_versions(),
help="Major version of HPXML to translate to, default: 3.0",
)
args = parser.parse_args(argv)
convert_hpxml_to_3(args.hpxml_input, args.output)
convert_hpxml_to_version(args.to_hpxml_version, args.hpxml_input, args.output)


if __name__ == '__main__':
if __name__ == "__main__":
main() # pragma: no cover
Loading