From 55ff04ba21e3e28e58d58dc4259787d80efe8e88 Mon Sep 17 00:00:00 2001
From: Jan Dittberner <jan@dittberner.info>
Date: Sat, 18 Jun 2016 21:13:17 +0200
Subject: [PATCH] Add --hostname option

This commit adds a --hostname option that is mutually exclusive to
-H/--host-address. The idea is to make check_xmppng compatible with
check_v46. Thanks to Andreas Krause for the inspiration.
---
 check_xmppng | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/check_xmppng b/check_xmppng
index 052db5c..5fdd61d 100755
--- a/check_xmppng
+++ b/check_xmppng
@@ -508,8 +508,11 @@ def main():
     """
     import argparse
     parser = argparse.ArgumentParser(description="Check XMPP services")
-    parser.add_argument(
-        "-H", "--host-address", help="host address", required=True)
+    host_address = parser.add_mutually_exclusive_group(required=True)
+    host_address.add_argument("-H", "--host-address", help="host address")
+    host_address.add_argument(
+        "--hostname", help="host name, alternative for host-address",
+        dest="host_address")
     parser.add_argument(
         "-p", "--port", help="port", type=int)
     is_server = parser.add_mutually_exclusive_group()