def _Interactive(self, opt, args):
    all = filter(lambda x: x.IsDirty(), self.GetProjects(args))
    if not all:
      print >>sys.stderr,'no projects have uncommitted modifications'
      return

    out = _ProjectList(self.manifest.manifestProject.config)
    while True:
      out.header('        %s', 'project')
      out.nl()

      for i in xrange(0, len(all)):
        p = all[i]
        out.write('%3d:    %s', i + 1, p.relpath + '/')
        out.nl()
      out.nl()

      out.write('%3d: (', 0)
      out.prompt('q')
      out.write('uit)')
      out.nl()

      out.prompt('project> ')
      try:
        a = sys.stdin.readline()
      except __HOLE__:
        out.nl()
        break
      if a == '':
        out.nl()
        break

      a = a.strip()
      if a.lower() in ('q', 'quit', 'exit'):
        break
      if not a:
        continue

      try:
        a_index = int(a)
      except ValueError:
        a_index = None

      if a_index is not None:
        if a_index == 0:
          break
        if 0 < a_index and a_index <= len(all):
          _AddI(all[a_index - 1])
          continue

      p = filter(lambda x: x.name == a or x.relpath == a, all)
      if len(p) == 1:
        _AddI(p[0])
        continue
    print 'Bye.'
dataset/ETHPy150Open android/tools_repo/subcmds/stage.py/Stage._Interactive