#!/usr/bin/python

# Copyright (C) 2011 Canonical Ltd., Daniel Holbach
#
# ##################################################################
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# See file /usr/share/common-licenses/GPL-3 for more details.
#
# ##################################################################
#
#
# harvest - grabs information about development opportunities from
#           harvest.ubuntu.com
#
#
# Daniel Holbach
# (c) 2011 Canonical

from optparse import OptionParser
import sys

from devscripts.logger import Logger

from ubuntutools.harvest import Harvest

def main():
    usage = "usage: %prog source-package-name"
    opt_parser = OptionParser(usage)
    args = opt_parser.parse_args()[1]
    if len(args) != 1:
        opt_parser.print_help()
        sys.exit(1)
    pkg = args[0].strip()

    print Harvest(pkg).report()

if __name__ == '__main__':
    try:
        main()
    except KeyboardInterrupt:
        Logger.error("Aborted.")
        sys.exit(1)