Permalink
Browse files

better for for managing cli args

  • Loading branch information...
1 parent 4a26e4c commit 4434cf8e2f1491657e42a034f7b61bcf9ef83336 @dcolish committed Feb 15, 2012
Showing with 10 additions and 21 deletions.
  1. +3 −19 coqd/runner.py
  2. +7 −2 manager.py
View
@@ -30,28 +30,12 @@ def __init__(self, modules, serialize):
self.serialize = serialize
-def options(parser):
- parser.add_argument("--module", dest="modules", action="append",
- default=[],
- help="load modules into coqd, more than one "
- "can be specified",
- )
- parser.add_argument("--serialize", action="store_true",
- default=False,
- help="Serialize output to JSON")
- return parser
-
-
-def main():
+def main(modules, serialize):
"""
Setup and run coqd
"""
- parser = ArgumentParser(prog="Coqd", description="Options for Coqd",
- version="Coqd 0.1")
- parser = options(parser)
- opts = parser.parse_args(argv[2:])
-
logging.info("Coq is starting... hold on")
- factory = CoqFactory(opts.modules, opts.serialize)
+ factory = CoqFactory(modules, serialize)
reactor.listenTCP(8003, factory)
reactor.run()
+
View
@@ -27,11 +27,16 @@ def initdb():
db.create_all()
+@manager.option("--module", dest="modules", action="append",
+ default=[],
+ help="load modules into coqd, more than one "
+ "can be specified",
+ )
@manager.option('--serialize', action="store_true",
default=False,
help="Serialize output to JSON")
-def runcoqd(serialize):
- coqd_main()
+def runcoqd(modules, serialize):
+ coqd_main(modules, serialize)
if __name__ == "__main__":

0 comments on commit 4434cf8

Please sign in to comment.