Get the _SubParsersAction for this parser if it exists. :return: the _SubParsersAction for this parser :raises ValueError: if this parser does not support subcommands
(self)
| 658 | super().print_help(file) |
| 659 | |
| 660 | def get_subparsers_action(self) -> "argparse._SubParsersAction[Cmd2ArgumentParser]": |
| 661 | """Get the _SubParsersAction for this parser if it exists. |
| 662 | |
| 663 | :return: the _SubParsersAction for this parser |
| 664 | :raises ValueError: if this parser does not support subcommands |
| 665 | """ |
| 666 | if self._subparsers is not None: |
| 667 | for action in self._subparsers._group_actions: |
| 668 | if isinstance(action, argparse._SubParsersAction): |
| 669 | return action |
| 670 | raise ValueError(f"Command '{self.prog}' does not support subcommands") |
| 671 | |
| 672 | def _build_subparsers_prog_prefix(self, positionals: list[argparse.Action]) -> str: |
| 673 | """Build the 'prog' prefix for a subparsers action. |
no outgoing calls