MCPcopy Index your code
hub / github.com/python-cmd2/cmd2 / detach_subcommand

Method detach_subcommand

cmd2/cmd2.py:1222–1232  ·  view source on GitHub ↗

Detach a subcommand from a command at the specified path. :param command: full command path (space-delimited) leading to the parser hosting the subcommand to be detached (e.g. 'foo bar') :param subcommand: name of the subcommand to detach :return: the

(self, command: str, subcommand: str)

Source from the content-addressed store, hash-verified

1220 root_parser.attach_subcommand(subcommand_path, subcommand, subcommand_parser, **add_parser_kwargs)
1221
1222 def detach_subcommand(self, command: str, subcommand: str) -> Cmd2ArgumentParser:
1223 """Detach a subcommand from a command at the specified path.
1224
1225 :param command: full command path (space-delimited) leading to the parser hosting the
1226 subcommand to be detached (e.g. 'foo bar')
1227 :param subcommand: name of the subcommand to detach
1228 :return: the detached parser
1229 :raises ValueError: if the command path is invalid or the subcommand doesn't exist
1230 """
1231 root_parser, subcommand_path = self.get_root_parser_and_subcmd_path(command)
1232 return root_parser.detach_subcommand(subcommand_path, subcommand)
1233
1234 @property
1235 def always_prefix_settables(self) -> bool:

Callers 2

Calls 1

Tested by 1