27 lines
724 B
Python
Executable File
27 lines
724 B
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
import argparse
|
|
import convert_file_encoding
|
|
|
|
|
|
def create_convert_parser(subparsers):
|
|
parser = subparsers.add_parser(
|
|
"convert",
|
|
description="Recursively convert .cue and .log files from cp1251 to utf-8",
|
|
epilog="Example: python convert_encoding.py /path/to/directory",
|
|
)
|
|
parser.add_argument(
|
|
"directory", type=str, 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)
|
|
args.func(args)
|