move argparsing to parseArgs()
This commit is contained in:
parent
c048fda55a
commit
4eda8f6d2c
8
esgd.py
8
esgd.py
|
@ -188,14 +188,18 @@ class GopherHandler(socketserver.BaseRequestHandler, GopherServerLogic):
|
|||
|
||||
log = Logger()
|
||||
|
||||
if __name__ == "__main__":
|
||||
def parseArgs():
|
||||
parse = argparse.ArgumentParser()
|
||||
parse.add_argument("-u", "--user", default="nobody", help="user to change to on startup")
|
||||
parse.add_argument("-g", "--group", default="nobody", help="group to change to on startup")
|
||||
parse.add_argument("-s", "--host", default="localhost", help="host to host on")
|
||||
parse.add_argument("-p", "--port", default=70, type=int, help="port to host on")
|
||||
parse.add_argument("-d", "--dir", default="/var/gopher", help="directory to host from")
|
||||
args = parse.parse_args()
|
||||
return parse.parse_args()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
args = parseArgs()
|
||||
log.log("arguments parsed")
|
||||
|
||||
switchgrp = grp.getgrnam(args.group).gr_gid
|
||||
|
|
Loading…
Reference in New Issue