File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ $inputFile = null;
3232$ inputFormat = null ;
3333$ outputFile = null ;
3434$ outputFormat = null ;
35+ $ silentMode = false ;
3536foreach ($ argv as $ k => $ arg ) {
3637 if ($ k == 0 ) {
3738 continue ;
@@ -67,6 +68,10 @@ foreach($argv as $k => $arg) {
6768 error ("Conflicting arguments: only one of --write-json or --write-yaml is allowed! " , "usage " );
6869 }
6970 break ;
71+ case '-s ' :
72+ case '--silent ' :
73+ $ silentMode = true ;
74+ break ;
7075 case '-h ' :
7176 case '--help ' :
7277 case 'help ' :
@@ -118,7 +123,9 @@ switch ($command) {
118123 $ validator ->validate ($ openApiData , (object )['$ref ' => 'file:// ' . dirname (__DIR__ ) . '/schemas/openapi-v3.0.json ' ]);
119124
120125 if ($ validator ->isValid () && empty ($ errors )) {
121- print_formatted ("The supplied API Description \B\Gvalidates\C against the OpenAPI v3.0 schema. \n" , STDERR );
126+ if (!$ silentMode ) {
127+ print_formatted ("The supplied API Description \B\Gvalidates\C against the OpenAPI v3.0 schema. \n" , STDERR );
128+ }
122129 exit (0 );
123130 }
124131
@@ -307,6 +314,7 @@ Usage:
307314 \Y--read-yaml\C force reading input as YAML. Auto-detect if not specified.
308315 \Y--write-json\C force writing output as JSON. Auto-detect if not specified.
309316 \Y--write-yaml\C force writing output as YAML. Auto-detect if not specified.
317+ \Y-s, --silent\C silent mode. Will hide all success/information messages and only print errors.
310318
311319
312320EOF
You can’t perform that action at this time.
0 commit comments