Same thing for _httpd.py
This commit is contained in:
@@ -123,7 +123,7 @@ def main():
|
|||||||
config_section = 'httpd'
|
config_section = 'httpd'
|
||||||
|
|
||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
parser = argparse.ArgumentParser(exit_on_error=False)
|
parser = argparse.ArgumentParser(exit_on_error=False, add_help=False)
|
||||||
|
|
||||||
parser.add_argument('-c', '--config', help='config file to load')
|
parser.add_argument('-c', '--config', help='config file to load')
|
||||||
parser.add_argument('-d', '--debug', action='store_true', help='enable debug')
|
parser.add_argument('-d', '--debug', action='store_true', help='enable debug')
|
||||||
@@ -166,10 +166,21 @@ def main():
|
|||||||
help='port to bind to',
|
help='port to bind to',
|
||||||
type=int,
|
type=int,
|
||||||
default=config[config_section]['port'])
|
default=config[config_section]['port'])
|
||||||
|
parser.add_argument(
|
||||||
|
'-h',
|
||||||
|
'--help',
|
||||||
|
help='show this help and exit',
|
||||||
|
action='store_true',
|
||||||
|
default=False)
|
||||||
|
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
logging.debug(args)
|
logging.debug(args)
|
||||||
|
|
||||||
|
if args.help:
|
||||||
|
parser.print_help()
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
if not os.path.isfile(args.vardir + 'routerstats.rrd'):
|
if not os.path.isfile(args.vardir + 'routerstats.rrd'):
|
||||||
logging.error('Cannot find rrd file %s', args.vardir + 'routerstats.rrd' )
|
logging.error('Cannot find rrd file %s', args.vardir + 'routerstats.rrd' )
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|||||||
Reference in New Issue
Block a user