def Execute(self, opt, args):
    """List all projects and the associated directories.

    This may be possible to do with 'repo forall', but repo newbies have
    trouble figuring that out.  The idea here is that it should be more
    discoverable.

    Args:
      opt: The options.
      args: Positional args.  Can be a list of projects to list, or empty.
    """

    if opt.fullpath and opt.name_only:
      print('error: cannot combine -f and -n', file=sys.stderr)
      sys.exit(1)

    if not opt.regex:
      projects = self.GetProjects(args, groups=opt.groups)
    else:
      projects = self.FindProjects(args)

    def _getpath(x):
      if opt.fullpath:
        return x.worktree
      return x.relpath

    lines = []
    for project in projects:
      if opt.name_only and not opt.path_only:
        lines.append("%s" % ( project.name))
      elif opt.path_only and not opt.name_only:
        lines.append("%s" % (_getpath(project)))
      else:
        lines.append("%s : %s" % (_getpath(project), project.name))

    lines.sort()
    print('\n'.join(lines))
dataset/ETHPy150Open esrlabs/git-repo/subcmds/list.py/List.Execute/original