@@ -17,15 +17,16 @@ export default class Avro extends Command {
1717
1818 // do not change order otherwise we need to change order in getCommand() also
1919 static SupportedCommands = [ Avro . GET_SCHEMA , Avro . TO_JSON , Avro . TO_AVRO , Avro . TO_CSV ]
20+
2021 static flags = {
2122 help : flags . help ( { char : 'h' } ) ,
23+ command : flags . string ( { char : 'c' , description : `commands supported: ${ Avro . SupportedCommands } ` } ) ,
2224 file : flags . string ( { char : 'f' , description : 'input file path' } ) ,
2325 output : flags . string ( { char : 'o' , description : 'output file path' } ) ,
2426 schemaType : flags . string ( { char : 't' , description : 'schema type file path' } ) ,
25-
2627 }
2728
28- static args = [ { name : ` ${ Avro . SupportedCommands . join ( '|' ) } ` } ] // operation type
29+ static args = [ { name : 'command' } ] // operation type
2930 /*
3031 * input,output, and operation are all must
3132 * */
@@ -40,11 +41,16 @@ export default class Avro extends Command {
4041 private checkParameters ( flags : any , args : any ) {
4142 if ( ! flags . file )
4243 Logger . error ( this , 'Input file is not provided' )
44+
45+ if ( args . command )
46+ args . command = args . command
47+ else
48+ args . command = flags . command
49+
4350 if ( ! args . command )
4451 Logger . error ( this , 'Command is empty or not provided, supported:' + Avro . SupportedCommands )
45-
46- // if exists then make it upperCase
47- args . command = args . command . toLowerCase ( )
52+ else // if exists then make Lower Case
53+ args . command = args . command . toLowerCase ( )
4854
4955 // output is not mendatory for 'get_schema' command
5056 if ( args . command !== Avro . GET_SCHEMA && ! flags . output )
0 commit comments