]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: compress multiple whitespaces in command string
authorDaniel Walton <dwalton@cumulusnetworks.com>
Fri, 23 Sep 2016 14:02:55 +0000 (14:02 +0000)
committerDaniel Walton <dwalton@cumulusnetworks.com>
Fri, 23 Sep 2016 14:02:55 +0000 (14:02 +0000)
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
tools/argv_translator.py
zebra/zebra_vty.c

index 1c8f0c7e56774baccda63ef0cceeac6763db75b0..4ee0831ed94d62eb9b02fd186b87f18db5499740 100755 (executable)
@@ -267,6 +267,11 @@ DEFUN (no_bgp_maxmed_onstartup,
         line = line.replace('}', ']')
         re_range = re.search('^(.*?)<(\d+-\d+)>(.*)$', line)
 
+        # A one off to handle "CMD_RANGE_STR(1, MULTIPATH_NUM)"
+        if 'CMD_RANGE_STR<' in line:
+            line = line.replace('CMD_RANGE_STR<', 'CMD_RANGE_STR(')
+            line = line.replace('>', ')')
+
         while re_range:
             line = "%s(%s)%s" % (re_range.group(1), re_range.group(2), re_range.group(3))
             re_range = re.search('^(.*?)<(\d+-\d+)>(.*)$', line)
@@ -274,6 +279,9 @@ DEFUN (no_bgp_maxmed_onstartup,
         if not line.endswith('\n'):
             line += '\n'
 
+        # compress duplicate whitespaces
+        re_space = re.search('^(\s*).*(\s*)$', line)
+        line = re_space.group(1) + ' '.join(line.split()) + re_space.group(2)
         return line
 
     def dump(self):
index d395c11a114506673e9f5374d669db01f949feed..3188799f26e35adf8c7d0c08170aa9452d6fa97c 100644 (file)
@@ -655,7 +655,7 @@ DEFUN (ip_route_mask_tag_distance,
 
 DEFUN (ip_route_mask_flags_tag_distance,
        ip_route_mask_flags_tag_distance_cmd,
-       "ip route A.B.C.D A.B.C.D <A.B.C.D|INTERFACE> <reject|blackhole>  tag (1-65535) (1-255)",
+       "ip route A.B.C.D A.B.C.D <A.B.C.D|INTERFACE> <reject|blackhole> tag (1-65535) (1-255)",
        IP_STR
        "Establish static routes\n"
        "IP destination prefix\n"
@@ -1448,7 +1448,7 @@ DEFUN (ip_route_mask_tag_distance_vrf,
 
 DEFUN (ip_route_mask_flags_tag_distance_vrf,
        ip_route_mask_flags_tag_distance_vrf_cmd,
-       "ip route A.B.C.D A.B.C.D <A.B.C.D|INTERFACE> <reject|blackhole>  tag (1-65535) (1-255) " VRF_CMD_STR,
+       "ip route A.B.C.D A.B.C.D <A.B.C.D|INTERFACE> <reject|blackhole> tag (1-65535) (1-255) " VRF_CMD_STR,
        IP_STR
        "Establish static routes\n"
        "IP destination prefix\n"
@@ -2436,7 +2436,7 @@ do_show_ip_route (struct vty *vty, const char *vrf_name, safi_t safi,
 
 DEFUN (show_ip_route_vrf,
        show_ip_route_vrf_cmd,
-       "show ip route  " VRF_CMD_STR " [json]",
+       "show ip route " VRF_CMD_STR " [json]",
        SHOW_STR
        IP_STR
        "IP routing table\n"
@@ -3420,7 +3420,7 @@ DEFUN (show_ip_route_vrf_all_supernets,
 
 DEFUN (show_ip_route_vrf_all_protocol,
        show_ip_route_vrf_all_protocol_cmd,
-       "show ip route " VRF_ALL_CMD_STR "  " QUAGGA_IP_REDIST_STR_ZEBRA,
+       "show ip route " VRF_ALL_CMD_STR " " QUAGGA_IP_REDIST_STR_ZEBRA,
        SHOW_STR
        IP_STR
        "IP routing table\n"
@@ -3475,7 +3475,7 @@ DEFUN (show_ip_route_vrf_all_protocol,
 
 DEFUN (show_ip_route_vrf_all_addr,
        show_ip_route_vrf_all_addr_cmd,
-       "show ip route " VRF_ALL_CMD_STR "  A.B.C.D",
+       "show ip route " VRF_ALL_CMD_STR " A.B.C.D",
        SHOW_STR
        IP_STR
        "IP routing table\n"