Skip to content

Commit

Permalink
Changed -h option to display a help message rather than change the ho…
Browse files Browse the repository at this point in the history
…st. Host is now -o
  • Loading branch information
kcuzner committed Jun 20, 2012
1 parent e46d5d5 commit 03f241c
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions WebSocketServer.py
Expand Up @@ -191,8 +191,8 @@ def handshake(self, request):


def main():
shortArgs = "p:h:d:"
longArgs = [ "port=", "host=", "document-root="]
shortArgs = "p:hd:o:"
longArgs = [ "port=", "help", "document-root=", "host="]
showUsage = False
overridePort = None
overrideHost = None
Expand All @@ -207,21 +207,25 @@ def main():
except ValueError:
print "Invalid port number:", opt[1]
showUsage = True
elif opt[0] == "--host" or opt[0] == "-h":
#override host
overrideHost = opt[1]
elif opt[0] == "--help" or opt[0] == "-h":
#show help
showUsage = True
elif opt[0] == "--document-root" or opt[0] == "-d":
#override document root
overrideDocRoot = opt[1]
elif opt[0] == "--host" or opt[0] == "-o":
#override host
overrideHost = opt[1]
except getopt.GetoptError:
#we get to print our usage message!
showUsage = True
if showUsage:
print "Python WebSocket Server"
print "Usage:"
print "\t-p --port=\t\tOverride configured port number"
print "\t-h --host=\t\tOverride configured host"
print "\t-o --host=\t\tOverride configured host"
print "\t-d --document-root=\tOverride configured document root"
print "\t-h --help\t\tShow this message"
print "No arguments will start the server as configured in server.config"
return

Expand Down

0 comments on commit 03f241c

Please sign in to comment.