Create parser factory
This commit is contained in:
parent
bef6ad9438
commit
749750fbb7
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user