from ros2cli.command import add_subparsers_on_demand
from ros2cli.command import CommandExtension


class ConsoleCommand(CommandExtension):
    """Various console related sub-commands."""
    
    def add_arguments(self, parser, cli_name):
        self._subparser = parser
        add_subparsers_on_demand(
            parser, cli_name, '_verb', 'ros2console.verb', required=False)

    def main(self, *, parser, args):
        if not hasattr(args, '_verb'):
            self._subparser.print_help()
            return 0

        extension = getattr(args, '_verb')
        
        return extension.main(args=args)
from ros2cli.command import add_subparsers_on_demand
from ros2cli.command import CommandExtension


class ConsoleCommand(CommandExtension):
    """Various console related sub-commands."""
    
    def add_arguments(self, parser, cli_name):
        self._subparser = parser
        add_subparsers_on_demand(
            parser, cli_name, '_verb', 'ros2console.verb', required=False)

    def main(self, *, parser, args):
        if not hasattr(args, '_verb'):
            self._subparser.print_help()
            return 0

        extension = getattr(args, '_verb')
        
        return extension.main(args=args)
Various console related sub-commands.