added types to arguments of argparse. made output lowercase
This commit is contained in:
parent
530e483496
commit
7f86d66c13
1 changed files with 20 additions and 21 deletions
|
|
@ -41,50 +41,49 @@ logger = logging.getLogger(__name__)
|
|||
|
||||
def parse_args():
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Linspector is for monitoring the vital information of hosts, services and devices in a network.",
|
||||
epilog="Linspector is not some program expecting computers to run! Visit http://linspector.org for more "
|
||||
description="linspector is for monitoring the vital information of hosts, services and devices in a network.",
|
||||
epilog="linspector is not some program expecting computers to run! visit http://linspector.org for more "
|
||||
"information.",
|
||||
prog="linspector")
|
||||
|
||||
parser.add_argument("--version", action="version", version="%(prog)s " + str(__version__),
|
||||
help="Show program's version number and exit")
|
||||
parser.add_argument("--version", action="version", version="%(prog)s " + str(__version__))
|
||||
|
||||
parser.add_argument("config", metavar="CONFIGFILE",
|
||||
help="The configfile to use")
|
||||
help="the configfile to use")
|
||||
|
||||
parser.add_argument("-n", "--nocolor",
|
||||
help="Disable colored output")
|
||||
help="disable colored output")
|
||||
|
||||
parser.add_argument("-l", "--logfile", default="./log/linspector.log", metavar="FILE",
|
||||
help="Set logfile to use (default: ./log/linspector.log)")
|
||||
help="set logfile to use (default: ./log/linspector.log)")
|
||||
|
||||
parser.add_argument("-c", "--logcount", default=5,
|
||||
help="Maximum number of logfiles in rotation (default: 5)")
|
||||
parser.add_argument("-c", "--logcount", default=5, type=int,
|
||||
help="maximum number of logfiles in rotation (default: 5)")
|
||||
|
||||
parser.add_argument("-m", "--logsize", default=10485760,
|
||||
help="Maximum logfile size in Bytes (default: 10485760)")
|
||||
parser.add_argument("-m", "--logsize", default=10485760, type=int,
|
||||
help="maximum logfile size in bytes (default: 10485760)")
|
||||
|
||||
parser.add_argument("-t", "--threads", default=1000,
|
||||
help="Maximum number of scheduler threads (default: 1000)")
|
||||
parser.add_argument("-t", "--threads", default=1000, type=int,
|
||||
help="maximum number of scheduler threads (default: 1000)")
|
||||
|
||||
parser.add_argument("-k", "--corethreads", default=0,
|
||||
help="Number of scheduler core threads (default: 0)")
|
||||
parser.add_argument("-k", "--corethreads", default=0, type=int,
|
||||
help="number of scheduler core threads (default: 0)")
|
||||
|
||||
parser.add_argument("-x", "--delay", default=2.315379,
|
||||
help="Seconds delay between scheduled jobs (default: 2.315379)")
|
||||
parser.add_argument("-x", "--delay", default=2.315379, type=float,
|
||||
help="seconds delay between scheduled jobs (default: 2.315379)")
|
||||
|
||||
output = parser.add_mutually_exclusive_group()
|
||||
output.add_argument("-q", "--quiet", action="store_const", dest="loglevel", const=logging.ERROR,
|
||||
help="Output only errors")
|
||||
help="output only errors")
|
||||
|
||||
output.add_argument("-w", "--warning", action="store_const", dest="loglevel", const=logging.WARNING,
|
||||
help="Output warnings")
|
||||
help="output warnings")
|
||||
|
||||
output.add_argument("-v", "--verbose", action="store_const", dest="loglevel", const=logging.INFO,
|
||||
help="Output info messages")
|
||||
help="output info messages")
|
||||
|
||||
output.add_argument("-d", "--debug", action="store_const", dest="loglevel", const=logging.DEBUG,
|
||||
help="Output debug messages")
|
||||
help="output debug messages")
|
||||
output.set_defaults(loglevel=logging.INFO)
|
||||
return parser.parse_args()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue