Create parser factory

This commit is contained in:
Anton Vakhrushev 2025-04-26 15:25:05 +03:00
parent bef6ad9438
commit 749750fbb7
Signed by: av
GPG Key ID: F5BF52FC352E255A

View File

@ -3,10 +3,8 @@
import argparse
import convert_file_encoding
if __name__ == "__main__":
top_parser = argparse.ArgumentParser()
subparsers = top_parser.add_subparsers()
def create_convert_parser(subparsers):
parser = subparsers.add_parser(
'convert',
description='Recursively convert .cue and .log files from cp1251 to utf-8',
@ -18,6 +16,12 @@ if __name__ == "__main__":
help='Path to target directory for conversion'
)
parser.set_defaults(func=convert_file_encoding.execute)
if __name__ == "__main__":
top_parser = argparse.ArgumentParser()
subparsers = top_parser.add_subparsers()
create_convert_parser(subparsers)
args = top_parser.parse_args()
print(args)