Beispiel #1
0
parser.add_option("-t", "--ticks", type="float", dest="ticks", default=None,
    help="Number of ticks allowed per batch. 1 tick = 0.5 sec. Defaults to the recipe time.")



if __name__ == '__main__':
  (options, args) = parser.parse_args()

  if options.list_recipes:
    for recipe in recipes:
      if all(map(lambda t: t in recipe.tags, options.tags)):
        line = [recipe.name]

        remaining_tags = set(recipe.tags) - set(options.tags)
        if remaining_tags and options.verbose:
          line.append("[%s]" % (",".join(remaining_tags),))
        print " ".join(line)
  elif options.recipe_requested is not None:
    recipe = recipe_for_item(options.recipe_requested)

    if recipe:
      print recipe
    else:
      print "Could not find recipe with name %s" % (options.recipe_requested,)
  elif options.build_target is not None:
    ticks = options.ticks or recipe_for_item(options.build_target).ticks

    formula = Formula(options.build_target, amount=options.amount, ticks=ticks)
    formula.expand()
    print formula