]> git.proxmox.com Git - mirror_iproute2.git/blobdiff - tipc/tipc.c
tipc: JSON support for showing nametable
[mirror_iproute2.git] / tipc / tipc.c
index 600d5e2a160f5f9d979a9e0ec44e76cfb366190a..f85ddee0e278d8ff99dd3ab6fce7c274683fe814 100644 (file)
@@ -24,6 +24,8 @@
 #include "cmdl.h"
 
 int help_flag;
+int json;
+int pretty;
 
 static void about(struct cmdl *cmdl)
 {
@@ -33,6 +35,8 @@ static void about(struct cmdl *cmdl)
                "\n"
                "Options:\n"
                " -h, --help \t\tPrint help for last given command\n"
+               " -j, --json \t\tJson format printouts\n"
+               " -p, --pretty \t\tpretty print\n"
                "\n"
                "Commands:\n"
                " bearer                - Show or modify bearers\n"
@@ -53,6 +57,8 @@ int main(int argc, char *argv[])
        const struct cmd cmd = {"tipc", NULL, about};
        struct option long_options[] = {
                {"help", no_argument, 0, 'h'},
+               {"json", no_argument, 0, 'j'},
+               {"pretty", no_argument, 0, 'p'},
                {0, 0, 0, 0}
        };
        const struct cmd cmds[] = {
@@ -69,7 +75,7 @@ int main(int argc, char *argv[])
        do {
                int option_index = 0;
 
-               i = getopt_long(argc, argv, "h", long_options, &option_index);
+               i = getopt_long(argc, argv, "hjp", long_options, &option_index);
 
                switch (i) {
                case 'h':
@@ -79,6 +85,18 @@ int main(int argc, char *argv[])
                         */
                        help_flag = 1;
                        break;
+               case 'j':
+                       /*
+                        * Enable json format printouts
+                        */
+                       json = 1;
+                       break;
+               case 'p':
+                       /*
+                        * Enable json pretty output
+                        */
+                       pretty = 1;
+                       break;
                case -1:
                        /* End of options */
                        break;