Update cli.py

This commit is contained in:
Namhyeon Go 2024-06-07 06:04:38 +00:00
parent 9362c01871
commit 6bb27154bd

View File

@ -15,6 +15,7 @@ Simple translator tool.
def translate():
arg = ArgumentParser(description=desc, allow_abbrev=False, add_help=False)
arg.add_argument("-h", "--help", action="help", help="Display this message")
arg.add_argument("-u", "--url", type=str, help="Server URL of an instance")
arg.add_argument("-s", "--source", type=str, help="Source Language to translate")
arg.add_argument("-t", "--target", type=str, help="Target Language to translate")
arg.add_argument("-txt", "--text", type=str, help="Text to translate")
@ -22,9 +23,12 @@ def translate():
arg.add_argument("-f", "--file", help="Path file .txt to translate")
arg.add_argument("-o", "--output", help="Output file translation result")
args = arg.parse_args()
translate = pylingva()
if args.url:
translate.set_url(args.url)
if args.list_languages:
lang = translate.languages()
print("{:<25} {:<25}".format('Name', 'Code'))