added new command 'translation'
This commit is contained in:
parent
75a123eb72
commit
6c5e83849e
9
chatmastermind/commands/translation.py
Normal file
9
chatmastermind/commands/translation.py
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import argparse
|
||||||
|
from ..configuration import Config
|
||||||
|
|
||||||
|
|
||||||
|
def translation_cmd(args: argparse.Namespace, config: Config) -> None:
|
||||||
|
"""
|
||||||
|
Handler for the 'translation' command.
|
||||||
|
"""
|
||||||
|
pass
|
||||||
@ -14,6 +14,7 @@ from .commands.tags import tags_cmd
|
|||||||
from .commands.config import config_cmd
|
from .commands.config import config_cmd
|
||||||
from .commands.hist import hist_cmd
|
from .commands.hist import hist_cmd
|
||||||
from .commands.print import print_cmd
|
from .commands.print import print_cmd
|
||||||
|
from .commands.translation import translation_cmd
|
||||||
from .chat import msg_location
|
from .chat import msg_location
|
||||||
|
|
||||||
|
|
||||||
@ -102,7 +103,7 @@ def create_parser() -> argparse.ArgumentParser:
|
|||||||
# 'tags' command parser
|
# 'tags' command parser
|
||||||
tags_cmd_parser = cmdparser.add_parser('tags',
|
tags_cmd_parser = cmdparser.add_parser('tags',
|
||||||
help="Manage tags.",
|
help="Manage tags.",
|
||||||
aliases=['t'])
|
aliases=['T'])
|
||||||
tags_cmd_parser.set_defaults(func=tags_cmd)
|
tags_cmd_parser.set_defaults(func=tags_cmd)
|
||||||
tags_group = tags_cmd_parser.add_mutually_exclusive_group(required=True)
|
tags_group = tags_cmd_parser.add_mutually_exclusive_group(required=True)
|
||||||
tags_group.add_argument('-l', '--list', help="List all tags and their frequency",
|
tags_group.add_argument('-l', '--list', help="List all tags and their frequency",
|
||||||
@ -136,6 +137,18 @@ def create_parser() -> argparse.ArgumentParser:
|
|||||||
print_cmd_modes.add_argument('-a', '--answer', help='Only print the answer', action='store_true')
|
print_cmd_modes.add_argument('-a', '--answer', help='Only print the answer', action='store_true')
|
||||||
print_cmd_modes.add_argument('-S', '--only-source-code', help='Only print embedded source code', action='store_true')
|
print_cmd_modes.add_argument('-S', '--only-source-code', help='Only print embedded source code', action='store_true')
|
||||||
|
|
||||||
|
# 'translation' command parser
|
||||||
|
translation_cmd_parser = cmdparser.add_parser('translation', parents=[ai_parser],
|
||||||
|
help="ask, create and repeat translations.",
|
||||||
|
aliases=['t'])
|
||||||
|
translation_cmd_parser.set_defaults(func=translation_cmd)
|
||||||
|
translation_group = translation_cmd_parser.add_mutually_exclusive_group(required=True)
|
||||||
|
translation_group.add_argument('-a', '--ask', nargs='+', help='Ask to translate the given text', metavar='TEXT')
|
||||||
|
translation_group.add_argument('-c', '--create', nargs='+', help='Create a translation', metavar='TEXT')
|
||||||
|
translation_group.add_argument('-r', '--repeat', nargs='*', help='Repeat a translation', metavar='MESSAGE')
|
||||||
|
translation_cmd_parser.add_argument('-s', '--source-lang', help="Source language", metavar="LANGUAGE")
|
||||||
|
translation_cmd_parser.add_argument('-t', '--target-lang', help="Target language", metavar="LANGUAGE")
|
||||||
|
|
||||||
argcomplete.autocomplete(parser)
|
argcomplete.autocomplete(parser)
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user