@@ -17,15 +17,16 @@ export default class Avro extends Command {
17
17
18
18
// do not change order otherwise we need to change order in getCommand() also
19
19
static SupportedCommands = [ Avro . GET_SCHEMA , Avro . TO_JSON , Avro . TO_AVRO , Avro . TO_CSV ]
20
+
20
21
static flags = {
21
22
help : flags . help ( { char : 'h' } ) ,
23
+ command : flags . string ( { char : 'c' , description : `commands supported: ${ Avro . SupportedCommands } ` } ) ,
22
24
file : flags . string ( { char : 'f' , description : 'input file path' } ) ,
23
25
output : flags . string ( { char : 'o' , description : 'output file path' } ) ,
24
26
schemaType : flags . string ( { char : 't' , description : 'schema type file path' } ) ,
25
-
26
27
}
27
28
28
- static args = [ { name : ` ${ Avro . SupportedCommands . join ( '|' ) } ` } ] // operation type
29
+ static args = [ { name : 'command' } ] // operation type
29
30
/*
30
31
* input,output, and operation are all must
31
32
* */
@@ -40,11 +41,16 @@ export default class Avro extends Command {
40
41
private checkParameters ( flags : any , args : any ) {
41
42
if ( ! flags . file )
42
43
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
+
43
50
if ( ! args . command )
44
51
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 ( )
48
54
49
55
// output is not mendatory for 'get_schema' command
50
56
if ( args . command !== Avro . GET_SCHEMA && ! flags . output )
0 commit comments