Mercurial > hg > pyloader
changeset 23:9b2ca32e7a36
wire up command line entry point
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Mon, 06 Jun 2011 07:46:18 -0700 |
parents | b16d6a204ac1 |
children | ce8fa574324d |
files | pyloader/factory.py |
diffstat | 1 files changed, 12 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/pyloader/factory.py Mon Jun 06 07:41:23 2011 -0700 +++ b/pyloader/factory.py Mon Jun 06 07:46:18 2011 -0700 @@ -1,3 +1,5 @@ +#!/usr/bin/env python + """ abstract factories """ @@ -6,6 +8,7 @@ import loader import os import sys +from optparse import OptionParser from ConfigParser import InterpolationMissingOptionError from ConfigParser import InterpolationSyntaxError from ConfigParser import SafeConfigParser as ConfigParser @@ -141,6 +144,15 @@ def main(args=sys.argv[1:]): """command line entry point""" + parser = OptionParser() + options, args = parser.parse_args(args) + + if len(args) != 1: + parser.print_usage() + parser.exit() + + factory = IniFactory(args[0]) + print factory.load() if __name__ == '__main__': main()