File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -42,15 +42,13 @@ export default class Avro extends Command {
42
42
if ( ! flags . file )
43
43
Logger . error ( this , 'Input file is not provided' )
44
44
45
- if ( args . command )
46
- args . command = args . command
47
- else
45
+ if ( flags . command ) // if -c flag have value, then override
48
46
args . command = flags . command
49
47
50
48
if ( ! args . command )
51
49
Logger . error ( this , 'Command is empty or not provided, supported:' + Avro . SupportedCommands )
52
50
else // if exists then make Lower Case
53
- args . command = args . command . toLowerCase ( )
51
+ args . command = args . command . toLowerCase ( )
54
52
55
53
// output is not mendatory for 'get_schema' command
56
54
if ( args . command !== Avro . GET_SCHEMA && ! flags . output )
@@ -116,15 +114,15 @@ export default class Avro extends Command {
116
114
let prependHeader = true // only write on the first line
117
115
avro . createFileDecoder ( flags . file )
118
116
. on ( 'data' , function ( recordStr ) {
119
- // @ts -ignore
117
+ // @ts -ignore
120
118
let json = JSON . parse ( JSON . stringify ( recordStr ) )
121
119
Json2Csv . json2csv ( json , ( err ?: Error , csv ?: string ) => {
122
120
if ( csv ) {
123
- // @ts -ignore
121
+ // @ts -ignore
124
122
Utilities . appendStringToFile ( this , flags . output , csv + '\n' )
125
123
}
126
124
if ( err ) {
127
- // @ts -ignore
125
+ // @ts -ignore
128
126
Logger . error ( this , err . toString ( ) )
129
127
}
130
128
} , { prependHeader} )
You can’t perform that action at this time.
0 commit comments