#!/usr/bin/python

import logging
import optparse
import sys

import blueprint.cli

parser = optparse.OptionParser('Usage: %prog [-q] [<name>]')
parser.add_option('-q', '--quiet',
                  dest='quiet',
                  default=False,
                  action='store_true',
                  help='operate quietly')
options, args = parser.parse_args()

if options.quiet:
    logging.root.setLevel(logging.CRITICAL)

if 1 < len(args):
    parser.print_usage()
    sys.exit(1)

b = blueprint.cli.read(options, args)

try:
    def package(manager, package, version):
        print('{0} {1} {2}'.format(manager, package, version))
    b.walk(package=package)
except IOError:
    pass
