#!/usr/bin/python

from autojenkins.run import *


parser = create_opts_parser('create')
parser.add_option('-D', metavar='VAR=VALUE',
                  action="append",
                  help='substitution variables to be used in the template')
parser.add_option('-t', '--template', default='template',
                  help='the template job to copy from')
parser.add_option('-b', '--build',
                  action="store_true", dest="build", default=False,
                  help='start a build right after creation')

(options, args) = parser.parse_args()

if len(args) == 2:
    host = args[0]
    jobname = args[1]
    create_job(host, jobname, options)
else:
    parser.print_help()
