Example #1
0
    def _add_sub_commands(cls, parser):
        title = "{} commands".format(cls._get_short_command_name())
        subparsers = parser.add_subparsers(title=title,
                                           dest="sub_command_name")

        for _, command in get_sub_commands(cls._get_command_name()).items():
            command.advertise(subparsers)
Example #2
0
 def _get_sibling_commands(self):
     assert len(type(self).__bases__) == 1
     commands = []
     parent_command = type(self).__bases__[0]._get_command_name()
     for _, command in get_sub_commands(parent_command).items():
         if command != self.__class__:
             commands.append(command)
     return commands
Example #3
0
def _setup_command_line_interface():
    parser = argparse.ArgumentParser(description=("Setup and manage an "
                                                  "embedded development "
                                                  "infrastructure."))
    parser.add_argument("-v", "--verbose", action="store_true",
                        help="increase output verbosity to INFO")
    parser.add_argument('--log', choices=['DEBUG', 'INFO', 'WARNING',
                                          'ERROR', 'CRITICAL'],
                        help="modify log level (default is WARNING)")

    subparsers = parser.add_subparsers(title='commands',
                                       dest="command_name")

    for _, command in get_sub_commands().items():
        command.advertise(subparsers)
    argcomplete.autocomplete(parser)
    return parser