Beispiel #1
0
     documented_rows = []
     undocumented = []
     max_width = 0
     for phase, _ in Phase.all():
       if phase.description:
         documented_rows.append((phase.name, phase.description))
         max_width = max(max_width, len(phase.name))
       elif self.context.options.goal_list_all:
         undocumented.append(phase.name)
     for name, description in documented_rows:
       print('  %s: %s' % (name.rjust(max_width), description))
     if undocumented:
       print('\nUndocumented goals:\n  %s' % ' '.join(undocumented))


goal(name='goals', action=List).install().with_description('List all documented goals.')


class Help(Task):
  @classmethod
  def setup_parser(cls, option_group, args, mkflag):
    default = None
    if len(args) > 1 and (not args[1].startswith('-')):
      default = args[1]
      del args[1]
    option_group.add_option(mkflag("goal"), dest = "help_goal", default=default)

  def execute(self, targets):
    goal = self.context.options.help_goal
    if goal is None:
      return self.list_goals('You must supply a goal name to provide help for.')
Beispiel #2
0
    documented_rows = []
    undocumented = []
    max_width = 0
    for phase, _ in Phase.all():
      if phase.description:
        documented_rows.append((phase.name, phase.description))
        max_width = max(max_width, len(phase.name))
      elif self.context.options.goal_list_all:
        undocumented.append(phase.name)
    for name, description in documented_rows:
      print('  %s: %s' % (name.rjust(max_width), description))
    if undocumented:
      print('\nUndocumented goals:\n  %s' % ' '.join(undocumented))


goal(name='goals', action=List).install().with_description('List all documented goals.')


class Help(Task):
  @classmethod
  def setup_parser(cls, option_group, args, mkflag):
    default = None
    if len(args) > 1 and (not args[1].startswith('-')):
      default = args[1]
      del args[1]
    option_group.add_option(mkflag("goal"), dest="help_goal", default=default)

  def execute(self, targets):
    goal = self.context.options.help_goal
    if goal is None:
      return self.list_goals('You must supply a goal name to provide help for.')
Beispiel #3
0
        documented_rows = []
        undocumented = []
        max_width = 0
        for phase, _ in Phase.all():
            if phase.description:
                documented_rows.append((phase.name, phase.description))
                max_width = max(max_width, len(phase.name))
            elif self.context.options.goal_list_all:
                undocumented.append(phase.name)
        for name, description in documented_rows:
            print('  %s: %s' % (name.rjust(max_width), description))
        if undocumented:
            print('\nUndocumented goals:\n  %s' % ' '.join(undocumented))


goal(name='goals',
     action=List).install().with_description('List all documented goals.')


class Help(Task):
    @classmethod
    def setup_parser(cls, option_group, args, mkflag):
        default = None
        if len(args) > 1 and (not args[1].startswith('-')):
            default = args[1]
            del args[1]
        option_group.add_option(mkflag("goal"),
                                dest="help_goal",
                                default=default)

    def execute(self, targets):
        goal = self.context.options.help_goal
Beispiel #4
0
    documented_rows = []
    undocumented = []
    max_width = 0
    for phase, _ in Phase.all():
      if phase.description:
        documented_rows.append((phase.name, phase.description))
        max_width = max(max_width, len(phase.name))
      elif self.context.options.goal_list_all:
        undocumented.append(phase.name)
    for name, description in documented_rows:
      print('  %s: %s' % (name.rjust(max_width), description))
    if undocumented:
      print('\nUndocumented goals:\n  %s' % ' '.join(undocumented))


goal(name='goals', action=List).install().with_description('List all documented goals.')


class Help(Task):
  @classmethod
  def setup_parser(cls, option_group, args, mkflag):
    default = None
    if len(args) > 1 and (not args[1].startswith('-')):
      default = args[1]
      del args[1]
    option_group.add_option(mkflag("goal"), dest = "help_goal", default=default)

  def execute(self, targets):
    goal = self.context.options.help_goal
    if goal is None:
      return self.list_goals('You must supply a goal name to provide help for.')
Beispiel #5
0
     print 'Installed goals:'
     documented_rows = []
     undocumented = []
     max_width = 0
     for phase, _ in Phase.all():
       if phase.description:
         documented_rows.append((phase.name, phase.description))
         max_width = max(max_width, len(phase.name))
       elif self.context.options.goal_list_all:
         undocumented.append(phase.name)
     for name, description in documented_rows:
       print '  %s: %s' % (name.rjust(max_width), description)
     if undocumented:
       print '\nUndocumented goals:\n  %s' % ' '.join(undocumented)

goal(name='goals', action=List).install().with_description('List all documented goals.')


class Help(Task):
  @classmethod
  def setup_parser(cls, option_group, args, mkflag):
    # Guard against double parsing for ./pants goal help help
    if not hasattr(cls, '_setup_parser'):
      cls._setup_parser = True

      def parser():
        parser = copy(option_group.parser)
        parser.option_groups.remove(option_group)
        return parser
      Help.parser = staticmethod(parser)
Beispiel #6
0
        documented_rows = []
        undocumented = []
        max_width = 0
        for phase, _ in Phase.all():
            if phase.description:
                documented_rows.append((phase.name, phase.description))
                max_width = max(max_width, len(phase.name))
            elif self.context.options.goal_list_all:
                undocumented.append(phase.name)
        for name, description in documented_rows:
            print("  %s: %s" % (name.rjust(max_width), description))
        if undocumented:
            print("\nUndocumented goals:\n  %s" % " ".join(undocumented))


goal(name="goals", action=List).install().with_description("List all documented goals.")


class Help(Task):
    @classmethod
    def setup_parser(cls, option_group, args, mkflag):
        default = None
        if len(args) > 1 and (not args[1].startswith("-")):
            default = args[1]
            del args[1]
        option_group.add_option(mkflag("goal"), dest="help_goal", default=default)

    def execute(self, targets):
        goal = self.context.options.help_goal
        if goal is None:
            return self.list_goals("You must supply a goal name to provide help for.")