def add_subparser( subparsers: argparse._SubParsersAction, parents: List[argparse.ArgumentParser] ): shell_parser = subparsers.add_parser( "shell", parents=parents, conflict_handler="resolve", formatter_class=argparse.ArgumentDefaultsHelpFormatter, help="Speak to a trained model on the command line", ) shell_parser.set_defaults(func=shell) arguments.set_shell_arguments(shell_parser) run_subparsers = shell_parser.add_subparsers() shell_nlu_subparser = run_subparsers.add_parser( "nlu", parents=parents, conflict_handler="resolve", formatter_class=argparse.ArgumentDefaultsHelpFormatter, help="Interpret messages on the command line using your NLU model.", ) shell_nlu_subparser.set_defaults(func=shell_nlu) arguments.set_shell_nlu_arguments(shell_nlu_subparser)
def add_subparser(subparsers: argparse._SubParsersAction, parents: List[argparse.ArgumentParser]): shell_parser = subparsers.add_parser( "shell", parents=parents, conflict_handler="resolve", formatter_class=argparse.ArgumentDefaultsHelpFormatter, help=("Loads your trained model and lets you talk to your " "assistant on the command line."), ) shell_parser.set_defaults(func=shell) shell_parser.add_argument( "--conversation-id", default=uuid.uuid4().hex, required=False, help="Set the conversation ID.", ) run_subparsers = shell_parser.add_subparsers() shell_nlu_subparser = run_subparsers.add_parser( "nlu", parents=parents, conflict_handler="resolve", formatter_class=argparse.ArgumentDefaultsHelpFormatter, help="Interprets messages on the command line using your NLU model.", ) shell_nlu_subparser.set_defaults(func=shell_nlu) arguments.set_shell_arguments(shell_parser) arguments.set_shell_nlu_arguments(shell_nlu_subparser)
def add_subparser( subparsers: SubParsersAction, parents: List[argparse.ArgumentParser] ) -> None: """Add all shell parsers. Args: subparsers: subparser we are going to attach to parents: Parent parsers, needed to ensure tree structure in argparse """ shell_parser = subparsers.add_parser( "shell", parents=parents, conflict_handler="resolve", formatter_class=argparse.ArgumentDefaultsHelpFormatter, help=( "Loads your trained model and lets you talk to your " "assistant on the command line." ), ) shell_parser.set_defaults(func=shell) shell_parser.add_argument( "--conversation-id", default=uuid.uuid4().hex, required=False, help="Set the conversation ID.", ) run_subparsers = shell_parser.add_subparsers() shell_nlu_subparser = run_subparsers.add_parser( "nlu", parents=parents, conflict_handler="resolve", formatter_class=argparse.ArgumentDefaultsHelpFormatter, help="Interprets messages on the command line using your NLU model.", ) shell_nlu_subparser.set_defaults(func=shell_nlu) arguments.set_shell_arguments(shell_parser) arguments.set_shell_nlu_arguments(shell_nlu_subparser)