Mercurial > hg > numerics
changeset 18:e3fc1f75241d
stubbing
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Sun, 21 Sep 2014 11:31:37 -0700 |
parents | 5245d7d0c1bf |
children | 276beb743a59 |
files | numerics/plot.py |
diffstat | 1 files changed, 7 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/numerics/plot.py Sat Sep 20 18:48:58 2014 -0700 +++ b/numerics/plot.py Sun Sep 21 11:31:37 2014 -0700 @@ -9,7 +9,7 @@ plot foo.csv Generates plots of all columns of foo versus the first column. -The title is foo.csv unless overridden with ``--title`` +The title is foo.csv unless overridden with ``--title``. """ # imports @@ -19,8 +19,7 @@ import sys # module globals -__all__ = ['main', 'Parser'] -here = os.path.dirname(os.path.realpath(__file__)) +__all__ = ['main', 'PlotParser'] string = (str, unicode) def ensure_dir(directory): @@ -32,8 +31,9 @@ return directory -class Parser(argparse.ArgumentParser): +class PlotParser(argparse.ArgumentParser): """CLI option parser""" + def __init__(self, **kwargs): kwargs.setdefault('description', __doc__) argparse.ArgumentParser.__init__(self, **kwargs) @@ -48,13 +48,15 @@ def validate(self, options): """validate options""" + def main(args=sys.argv[1:]): """CLI""" # parse command line options - parser = Parser() + parser = PlotParser() options = parser.parse_args(args) + if __name__ == '__main__': main()