mirror of
https://gitlab.com/gnh1201/pylingva.git
synced 2024-11-26 07:22:06 +00:00
Update cli.py
This commit is contained in:
parent
9362c01871
commit
6bb27154bd
|
@ -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'))
|
||||
|
|
Loading…
Reference in New Issue
Block a user