ip: add new command line argument -json (mutually exclusive with -color)
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
This commit is contained in:
parent
959f142863
commit
5df6077259
|
|
@ -20,6 +20,7 @@ extern int show_raw;
|
||||||
extern int resolve_hosts;
|
extern int resolve_hosts;
|
||||||
extern int oneline;
|
extern int oneline;
|
||||||
extern int brief;
|
extern int brief;
|
||||||
|
extern int json;
|
||||||
extern int timestamp;
|
extern int timestamp;
|
||||||
extern int timestamp_short;
|
extern int timestamp_short;
|
||||||
extern const char * _SL_;
|
extern const char * _SL_;
|
||||||
|
|
|
||||||
6
ip/ip.c
6
ip/ip.c
|
|
@ -33,6 +33,7 @@ int show_details;
|
||||||
int resolve_hosts;
|
int resolve_hosts;
|
||||||
int oneline;
|
int oneline;
|
||||||
int brief;
|
int brief;
|
||||||
|
int json;
|
||||||
int timestamp;
|
int timestamp;
|
||||||
const char *_SL_;
|
const char *_SL_;
|
||||||
int force;
|
int force;
|
||||||
|
|
@ -258,6 +259,8 @@ int main(int argc, char **argv)
|
||||||
batch_file = argv[1];
|
batch_file = argv[1];
|
||||||
} else if (matches(opt, "-brief") == 0) {
|
} else if (matches(opt, "-brief") == 0) {
|
||||||
++brief;
|
++brief;
|
||||||
|
} else if (matches(opt, "-json") == 0) {
|
||||||
|
++json;
|
||||||
} else if (matches(opt, "-rcvbuf") == 0) {
|
} else if (matches(opt, "-rcvbuf") == 0) {
|
||||||
unsigned int size;
|
unsigned int size;
|
||||||
|
|
||||||
|
|
@ -292,6 +295,9 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
_SL_ = oneline ? "\\" : "\n";
|
_SL_ = oneline ? "\\" : "\n";
|
||||||
|
|
||||||
|
if (json)
|
||||||
|
check_if_color_enabled();
|
||||||
|
|
||||||
if (batch_file)
|
if (batch_file)
|
||||||
return batch(batch_file);
|
return batch(batch_file);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue