ordigi/elodie/arguments.py

25 lines
536 B
Python
Raw Normal View History

"""
"""
import sys, getopt
from re import sub
def parse(argv, options, long_options, usage):
def help():
print 'Usage: %s' % usage
try:
opts, args = getopt.getopt(argv, options, long_options)
except getopt.GetoptError:
print 'Unknown arguments'
help()
sys.exit(2)
return_arguments = {}
for opt, arg in opts:
if opt == '-h':
help()
sys.exit()
else:
return_arguments[sub('^-+', '', opt)] = arg
return return_arguments