]> git.proxmox.com Git - mirror_iproute2.git/blobdiff - bridge/bridge.c
bridge: fdb: Fix for missing keywords in non-JSON output
[mirror_iproute2.git] / bridge / bridge.c
index 6658cb8fd801d68a6f4990f7c9544fef860dda9e..ac4d6a14f510ea7ebd71321c7c3c4bb6070417ac 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0 */
 /*
  * Get/set/delete bridge with netlink
  *
 #include "utils.h"
 #include "br_common.h"
 #include "namespace.h"
+#include "color.h"
 
 struct rtnl_handle rth = { .fd = -1 };
 int preferred_family = AF_UNSPEC;
 int oneline;
 int show_stats;
 int show_details;
+int show_pretty;
+int color;
 int compress_vlans;
-int json_output;
+int json;
 int timestamp;
 char *batch_file;
 int force;
-const char *_SL_;
 
 static void usage(void) __attribute__((noreturn));
 
@@ -38,7 +41,7 @@ static void usage(void)
 "where OBJECT := { link | fdb | mdb | vlan | monitor }\n"
 "      OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] |\n"
 "                   -o[neline] | -t[imestamp] | -n[etns] name |\n"
-"                   -c[ompressvlans] -j{son} }\n");
+"                   -c[ompressvlans] -color -p[retty] -j[son] }\n");
        exit(-1);
 }
 
@@ -169,12 +172,15 @@ main(int argc, char **argv)
                        NEXT_ARG();
                        if (netns_switch(argv[1]))
                                exit(-1);
+               } else if (matches_color(opt, &color)) {
                } else if (matches(opt, "-compressvlans") == 0) {
                        ++compress_vlans;
                } else if (matches(opt, "-force") == 0) {
                        ++force;
                } else if (matches(opt, "-json") == 0) {
-                       ++json_output;
+                       ++json;
+               } else if (matches(opt, "-pretty") == 0) {
+                       ++pretty;
                } else if (matches(opt, "-batch") == 0) {
                        argc--;
                        argv++;
@@ -192,6 +198,8 @@ main(int argc, char **argv)
 
        _SL_ = oneline ? "\\" : "\n";
 
+       check_enable_color(color, json);
+
        if (batch_file)
                return batch(batch_file);