]> git.proxmox.com Git - mirror_iproute2.git/blobdiff - tipc/tipc.c
ll_map: Add function to remove link cache entry by index
[mirror_iproute2.git] / tipc / tipc.c
index 44398052af46c028ee9fba67d69ad1128a6acc89..f85ddee0e278d8ff99dd3ab6fce7c274683fe814 100644 (file)
 #include "socket.h"
 #include "media.h"
 #include "node.h"
+#include "peer.h"
 #include "cmdl.h"
 
 int help_flag;
+int json;
+int pretty;
 
 static void about(struct cmdl *cmdl)
 {
@@ -32,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"
@@ -39,6 +44,7 @@ static void about(struct cmdl *cmdl)
                " media                 - Show or modify media\n"
                " nametable             - Show nametable\n"
                " node                  - Show or modify node related parameters\n"
+               " peer                  - Peer related operations\n"
                " socket                - Show sockets\n",
                cmdl->argv[0]);
 }
@@ -51,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[] = {
@@ -59,6 +67,7 @@ int main(int argc, char *argv[])
                { "media",      cmd_media,      cmd_media_help},
                { "nametable",  cmd_nametable,  cmd_nametable_help},
                { "node",       cmd_node,       cmd_node_help},
+               { "peer",       cmd_peer,       cmd_peer_help},
                { "socket",     cmd_socket,     cmd_socket_help},
                { NULL }
        };
@@ -66,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':
@@ -76,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;