From 04e0b71eb479f095782f030b3b78673706719232 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Mon, 22 Sep 2014 05:58:57 -0700 Subject: [PATCH] nmhive.py: Add --host and --port options Time to polish this up a bit now that it works in testing ;). --- nmhive.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/nmhive.py b/nmhive.py index 06c2cd0..4ee6747 100755 --- a/nmhive.py +++ b/nmhive.py @@ -1,5 +1,7 @@ #!/usr/bin/env python +"""Serve a JSON API for getting/setting notmuch tags with nmbug commits.""" + import json import mailbox import os @@ -99,4 +101,16 @@ def gmane_message_id(group, article): if __name__ == '__main__': - app.run(host='0.0.0.0') + import argparse + + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument( + '-H', '--host', default='127.0.0.1', + help='The hostname to listen on.') + parser.add_argument( + '-p', '--port', type=int, default=5000, + help='The port to listen on.') + + args = parser.parse_args() + + app.run(host=args.host, port=args.port) -- 2.26.2