Skip to content

Commit

Permalink
Merge pull request #20 from WillEngler/web-cli
Browse files Browse the repository at this point in the history
Add command line arg for webserver port
  • Loading branch information
minrk committed Feb 22, 2016
2 parents 7ae62b8 + 0d9e8ce commit dc6604c
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions webapp/nbdimeserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import os
import json
from argparse import ArgumentParser
from six import string_types
from tornado import ioloop, web
import nbformat
Expand Down Expand Up @@ -165,8 +166,21 @@ def main(**params):
ioloop.IOLoop.current().start()


def build_arg_parser():
"""
Creates an argument parser that lets the user specify a port
and displays a help message.
"""
description = 'Web interface for Nbdime.'
parser = ArgumentParser(description=description)
parser.add_argument('-p', '--port',
help="Specify the port you want the server "
"to run on. Default is 8888.")
return parser


if __name__ == "__main__":
# TODO: Get (some of) these from cli arguments
arguments = build_arg_parser().parse_args()
port = int(arguments.port) if arguments.port else 8888
cwd = os.path.abspath(os.path.curdir)
main(port=8888, cwd=cwd, outputfilename="")

main(port=port, cwd=cwd, outputfilename="")

0 comments on commit dc6604c

Please sign in to comment.