trepan/processor/command/base_submgr.py
def run(self, args):
        """Ooops -- the debugger author didn't redefine this run docstring."""
        if len(args) < 2:
            # We were given cmd without a subcommand; cmd is something
            # like "show", "info" or "set". Generally this means list
            # all of the subcommands.
            self.section("List of %s commands (with minimum abbreviation in "
                     "parenthesis):" % self.name)
            for subcmd_name in self.cmds.list():
                # Some commands have lots of output.
                # they are excluded here because 'in_list' is false.
                subcmd = self.cmds.subcmds[subcmd_name]
                self.summary_help(subcmd_name, subcmd)
                pass
            return False

        subcmd_prefix = args[1]
        # We were given: cmd subcmd ...
        # Run that.
        subcmd = self.cmds.lookup(subcmd_prefix)
        if subcmd:
            nargs = len(args) - 2
            if nargs < subcmd.min_args:
                self.errmsg(("Subcommand '%s %s' needs at least %d argument(s); " +
                             "got %d.") %
                             (self.name, subcmd.name, subcmd.min_args, nargs))
                return False
            if subcmd.max_args is not None and nargs > subcmd.max_args:
                self.errmsg(("Subcommand '%s %s' takes at most %d argument(s); " +
                             "got %d.") %
                             (self.name, subcmd.name, subcmd.max_args, nargs))
                return False
            return subcmd.run(args[2:])
        else:
            return self.undefined_subcmd(self.name, subcmd_prefix)
        return
def run(self, args):
        """Ooops -- the debugger author didn't redefine this run docstring."""
        if len(args) < 2:
            # We were given cmd without a subcommand; cmd is something
            # like "show", "info" or "set". Generally this means list
            # all of the subcommands.
            self.section("List of %s commands (with minimum abbreviation in "
                     "parenthesis):" % self.name)
            for subcmd_name in self.cmds.list():
                # Some commands have lots of output.
                # they are excluded here because 'in_list' is false.
                subcmd = self.cmds.subcmds[subcmd_name]
                self.summary_help(subcmd_name, subcmd)
                pass
            return False

        subcmd_prefix = args[1]
        # We were given: cmd subcmd ...
        # Run that.
        subcmd = self.cmds.lookup(subcmd_prefix)
        if subcmd:
            nargs = len(args) - 2
            if nargs < subcmd.min_args:
                self.errmsg(("Subcommand '%s %s' needs at least %d argument(s); " +
                             "got %d.") %
                             (self.name, subcmd.name, subcmd.min_args, nargs))
                return False
            if subcmd.max_args is not None and nargs > subcmd.max_args:
                self.errmsg(("Subcommand '%s %s' takes at most %d argument(s); " +
                             "got %d.") %
                             (self.name, subcmd.name, subcmd.max_args, nargs))
                return False
            return subcmd.run(args[2:])
        else:
            return self.undefined_subcmd(self.name, subcmd_prefix)
        return
Ooops -- the debugger author didn't redefine this run docstring.