Group arg definitions more cleanly

This commit is contained in:
Adam Goldsmith 2022-11-26 19:34:37 -05:00
parent 174ada7375
commit 1c183fb6b4

View File

@ -56,6 +56,14 @@ class Entities(nagiosplugin.Resource):
@nagiosplugin.guarded @nagiosplugin.guarded
def main(): def main():
argp = argparse.ArgumentParser(description=__doc__) argp = argparse.ArgumentParser(description=__doc__)
argp.add_argument(
"-t", "--token", required=True, type=str, help="API token for Home Assistant"
)
argp.add_argument(
"-u", "--url", required=True, type=str, help="URL for Home Assistant"
)
argp.add_argument("-v", "--verbose", action="count", default=0)
argp.add_argument( argp.add_argument(
"-w", "-w",
"--warning", "--warning",
@ -70,13 +78,7 @@ def main():
required=True, required=True,
help="return critical if battery percentage is outside RANGE", help="return critical if battery percentage is outside RANGE",
) )
argp.add_argument(
"-t", "--token", required=True, type=str, help="API token for Home Assistant"
)
argp.add_argument(
"-u", "--url", required=True, type=str, help="URL for Home Assistant"
)
argp.add_argument("-v", "--verbose", action="count", default=0)
args = argp.parse_args() args = argp.parse_args()
check = nagiosplugin.Check( check = nagiosplugin.Check(