@ Override public void intializeSubCommand ( Subparsers subparsers ) { Subparser diffyParser = subparsers . addParser ( "diffy" ) . description ( "Jolt CLI Diffy Tool. This tool will ingest two JSON inputs (from files or standard input) and " + "perform the Jolt Diffy operation to detect any differences. The program will return an exit code of " + "0 if no differences are found or a 1 if a difference is found or an error is encountered." ) . defaultHelp ( true ) ; diffyParser . addArgument ( "filePath1" ) . help ( "File path to feed to Input #1 for the Diffy operation. " + "This file should contain valid JSON." ) . type ( Arguments . fileType ( ) . verifyExists ( ) . verifyIsFile ( ) . verifyCanRead ( ) ) ; diffyParser . addArgument ( "filePath2" ) . help ( "File path to feed to Input #2 for the Diffy operation. " + "This file should contain valid JSON. " + "If this argument is not specified then standard input will be used." ) . type ( Arguments . fileType ( ) . verifyExists ( ) . verifyIsFile ( ) . verifyCanRead ( ) ) . nargs ( "?" ) . setDefault ( ( File ) null ) ; // these last two method calls make filePath2 optional diffyParser . addArgument ( "-s" ) . help ( "Diffy will suppress output and run silently." ) . action ( Arguments . storeTrue ( ) ) ; diffyParser . addArgument ( "-a" ) . help ( "Diffy will not consider array order when detecting differences" ) . action ( Arguments . storeTrue ( ) ) ; }
Initialize the arg parser for the Diffy sub command