#!/usr/bin/env python

"""TODO helloworld

SYNOPSIS

    TODO helloworld [-?] [-v]

DESCRIPTION

    TODO This describes how to use this script. This docstring 
    will be printed by the script if there is a problem or 
    if the user requests help (-?, --?, --help).

OPTIONS

    -? : display help (--? and --help do the same thing).

    -v : verbose output

EXAMPLES

    TODO: Show some examples of how to use this script.

EXIT STATUS

    TODO: List exit codes

AUTHOR

    TODO: Name <name@example.org>

    "Hello World" skeleton script attribution: Noah Spurrier
    (ref http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/528877)

LICENSE

    This script is in the public domain, free from copyrights or restrictions. 

$Id$
"""

import sys, os, getopt, traceback
import time
import re

VERBOSE = False

def exit_with_usage ():

    print globals()['__doc__']
    os._exit(1)

def parse_args (options='', long_options=[]):

    try:
        optlist, args = getopt.getopt(sys.argv[1:], options+'?', long_options+['help','?'])
    except Exception, e:
        print str(e)
        exit_with_usage()
    options = dict(optlist)
    if [elem for elem in options if elem in ['-?','--?','--help']]:
        exit_with_usage()
    return (options, args)

def main ():

    global VERBOSE

    (options, args) = parse_args('v')
    if '-v' in options:
        VERBOSE = True
    else:
        VERBOSE = False
    # if args<=0:
    #     exit_with_usage()

    # TODO: Do something more interesting here...
    print 'Hello world!'

if __name__ == '__main__':
    try:
        start_time = time.time()
        if VERBOSE: print time.asctime()
        main()
        if VERBOSE: print time.asctime()
        if VERBOSE: print 'TOTAL TIME IN MINUTES:',
        if VERBOSE: print (time.time() - start_time) / 60.0
        sys.exit(0)
    except SystemExit, e:
        raise e
    except Exception, e:
        print 'ERROR, UNEXPECTED EXCEPTION'
        print str(e)
        traceback.print_exc()
        os._exit(1)

# This file has been zigned!  See http://michaeldavies.org/zign-tools
# zign-version: 0.9.4
# zign-hashes: MD5, SHA-1
# -----BEGIN PGP SIGNED MESSAGE-----
# Hash: SHA1
# 
# 0353b52464b519134f5bbf9fe96d917a6c16d9d41837b83d711d0523509e04f63d2923e6
# -----BEGIN PGP SIGNATURE-----
# Version: GnuPG v1.4.7 (Darwin)
# 
# iD8DBQFHmzkr7kkvCQqp1vwRArdOAJ9tCmNF+yrjMpqXEboAYFigy5EnggCfeXzi
# /G7LBYfA+EF7cVCUf6cqVYU=
# =2RS9
# -----END PGP SIGNATURE-----
# zign: Protecting you since 2007 :-)
# 