#!/usr/bin/env python
import sys
from optparse import OptionParser

import kforge.cli.data

if __name__ == '__main__':
    usage  = '''usage: %prog [path]

Produce a KForge configuration file template.

If path provided then write template to file at path, otherwise print to
stdout.
    '''
    parser = OptionParser(usage)
    
    (options, args) = parser.parse_args()
    conf = kforge.cli.data.get_config_template()
    if len(args) == 0:
        print conf
    elif len(args) == 1:
        ff = file(args[0], 'w')
        ff.write(conf)
        ff.close()
    else:
        print 'ERROR: you have supplied too many arguments\n'
        parser.print_help()
        sys.exit(0)

