def _do_args(self, args):

        actions_todo = []
        pos_args = 0
        skip_next = False
        num_to_skip = 0
        possible_pos_args = len(self._pos_args) + len(self._req_pos_args)
        subcmd = None

        for i, arg in enumerate(args):
            if skip_next and num_to_skip > 0:
                num_to_skip -= 1
                continue
            skip_next = False
            num_to_skip = 0
            if arg.find('=') != -1:
                arg, next_arg = arg.split('=')
                args.insert(i+1, next_arg)

            if not arg.startswith('--') and arg[0] == '-' and len(arg) > 2:
                for j, char in enumerate(arg):
                    if char == '-':
                        continue
                    args.insert(i + 1 + j, '-{}'.format(char))
                continue

            if arg not in self._args_map:
                if arg in self._subcmds_map:
                    subcmd = self._subcmds_map[arg]
                    args = args[i:]
                    args[0] = '{} {}'.format(self._raw_args[0], args[0])
                    break
                if possible_pos_args and arg[0] != '-':
                    pos_args += 1
                    index = 'index{}'.format(pos_args)
                    self._context[self._args_map[index].name] = arg
                    self._context[index] = arg
                    arg = self._args_map[index].name
                elif not possible_pos_args:
                    print('Argument error from {}\n{} doesn\'t accept '
                          'positional arguments.'.format(arg,
                                                         self._raw_args[0]))
                    self._display_usage(exit=True)
                else:
                    print('Argument error from {}\n{} doesn\'t accept any '
                          'arguments like {}.'.format(arg,
                                                      self._raw_args[0],
                                                      arg))
                    self._display_usage(exit=True)

            argo = self._args_map[arg]
            if argo.args_taken:
                if i+argo.args_taken == len(args):
                    print('Argument error from {}\n{} expected {} arguments '
                          'but received 0.'.format(arg, arg, argo.args_taken))
                    self._display_usage(exit=True)
                taken_args = []
                for j in range(argo.args_taken):
                    possible_arg = args[i + 1 + j]
                    if possible_arg.startswith('-'):
                        print('Argument error from {}\n{} expected {} '
                              'arguments but '
                              'received {}.'.format(possible_arg,
                                                    arg,
                                                    argo.args_taken,
                                                    len(taken_args)))
                        self._display_usage(exit=True)
                    taken_args.append(possible_arg)
                self._context[argo.name] = taken_args
                if argo.short:
                    self._context[argo.short] = taken_args
                if argo.long:
                    self._context[argo.long] = taken_args
                skip_next = True
                num_to_skip = argo.args_taken
            elif argo in self._flags:
                self._context[argo.name] = True
                if argo.short:
                    self._context[argo.short] = True
                if argo.long:
                    self._context[argo.long] = True
            if argo.has_action:
                actions_todo.append(argo.action)

        for act in actions_todo:
            if act == self._display_version or act == self._display_help:
                act()

        if pos_args < len(self._req_pos_args):
            print('Argument error.\nRequired number of positional arguments '
                  'not found.')
            self._display_usage(exit=True)

        for arg in self._req_opts:
            if arg.name not in self._context:
                display_name = ''
                if arg.long:
                    display_name = arg.long
                else:
                    display_name = arg.short
                print('Argument error.\nRequired option {} not found.'
                      .format(display_name))

        for flag in self._flags:
            if flag.name not in self._context:
                self._context[flag.name] = False
                if flag.short:
                    self._context[flag.short] = False
                if flag.long:
                    self._context[flag.long] = False

        for arg in set(self._args_map.values()):
            if arg.name not in self._context:
                if arg.default:
                    self._context[arg.name] = arg.default
                    if arg.short:
                        self._context[arg.short] = arg.default
                    if arg.long:
                        self._context[arg.long] = arg.default
                    if arg.index:
                        self._context['index{}'.format(arg.index)] = arg.default
                else:
                    self._context[arg.name] = False
                    if arg.short:
                        self._context[arg.short] = False
                    if arg.long:
                        self._context[arg.long] = False
                    if arg.index:
                        self._context['index{}'.format(arg.index)] = False

        for act in actions_todo:
            act(self._context)

        if subcmd:
            subcmd.start(args)
Counts how many apps are registered for each group.  Recursively
dataset/ETHPy150Open kbknapp/Clapp-py/clapp/clapp.py/App._do_args--crossover with--dataset/ETHPy150Open dcos/dcos-cli/cli/dcoscli/tables.py/_count_apps