@@ -23,6 +23,7 @@ public static void main(String... args) {
2323 Options options = new Options ();
2424 options .addOption (Option .builder ("h" ).longOpt ("help" ).desc ("print this message" ).build ());
2525 options .addOption (Option .builder ().longOpt ("version" ).desc ("print the version information and exit" ).build ());
26+ options .addOption (Option .builder ().longOpt ("state" ).desc ("Only output diff state: no_changes, incompatible, compatible" ).build ());
2627 options .addOption (Option .builder ().longOpt ("trace" ).desc ("be extra verbose" ).build ());
2728 options .addOption (Option .builder ().longOpt ("debug" ).desc ("Print debugging information" ).build ());
2829 options .addOption (Option .builder ().longOpt ("info" ).desc ("Print additional information" ).build ());
@@ -81,6 +82,9 @@ public static void main(String... args) {
8182 logLevel ));
8283 }
8384 }
85+ if (line .hasOption ("state" )) {
86+ logLevel = "OFF" ;
87+ }
8488 LogManager .getRootLogger ().setLevel (Level .toLevel (logLevel ));
8589
8690 if (line .getArgList ().size () < 2 ) {
@@ -126,7 +130,12 @@ public static void main(String... args) {
126130 System .exit (2 );
127131 }
128132 }
129- System .exit (result .isDiff () ? 1 : 0 );
133+ if (line .hasOption ("state" )) {
134+ System .out .println (result .isDiff () ? result .isDiffBackwardCompatible () ? "compatible" : "incompatible" : "no_changes" );
135+ System .exit (0 );
136+ } else {
137+ System .exit (result .isDiff () ? 1 : 0 );
138+ }
130139 } catch (ParseException e ) {
131140 // oops, something went wrong
132141 System .err .println ("Parsing failed. Reason: " + e .getMessage ());
0 commit comments