diff --git a/pymule/__main__.py b/pymule/__main__.py index ba3d4f377c767e4c0cf3924428557e1a058a69d5..0e0236670d7f5d419e2ffd553fcc0d5fc1f02214 100644 --- a/pymule/__main__.py +++ b/pymule/__main__.py @@ -1,8 +1,11 @@ import argparse +import createrun if __name__ == '__main__': parser = argparse.ArgumentParser() subparsers = parser.add_subparsers() + createrun.create_parser(subparsers) + parsed = parser.parse_args() diff --git a/pymule/createrun.py b/pymule/createrun.py index 8c46bb13f733095eb2ca65f2f1b911a6b339eb1f..f97e33c672d5edfde8564889e64f08b276c5a12d 100644 --- a/pymule/createrun.py +++ b/pymule/createrun.py @@ -223,11 +223,12 @@ def interogate(args={}): return args -def parseargs(): +def create_parser(subparsers): specs = inspect.getargspec(create_menu) defaults = dict(zip(specs.args, specs.defaults)) - parser = argparse.ArgumentParser( + parser = subparsers.add_parser( + 'create', description='Generate menu and config files' ) parser.add_argument( @@ -274,7 +275,8 @@ def parseargs(): help="comma seperated list of piece,pc,pi,c,i[,seeds to use]" ) - parsed = parser.parse_args() + +def parseargs(parsed): args = {} if parsed.nseeds: @@ -360,8 +362,7 @@ def save(menu, conf, folder, force=False): print "Please change the ntasks and time options accordingly" -if __name__ == '__main__': - import sys - args, force = parseargs() +def main(parsed): + args, force = parseargs(parsed) menu, config, folder = create_menu(**args) save(menu, config, folder, force=force)