@@ -9,20 +9,29 @@ const pkg = require('../package.json'),
99program
1010 . version ( pkg . version )
1111 . usage ( '<jsonFile> [options]' )
12+ . argument ( '<jsonFile>' , 'JSON file to convert' )
1213 . option ( '-o, --output [output]' , 'Path of output file. If not provided, then stdout will be used' , utils . convertToAbsolutePath )
13- . option ( '-f, --field <delimiter>' , 'Optional field delimiter' )
14- . option ( '-w, --wrap <delimiter>' , 'Optional wrap delimiter' )
15- . option ( '-e, --eol <delimiter>' , 'Optional end of line delimiter' )
14+ . option ( '-a, --array-indexes-as-keys' , 'Includes array indexes in the generated keys' )
15+ . option ( '-S, --check-schema' , 'Check for schema differences' )
16+ . option ( '-f, --field <delimiter>' , 'Field delimiter' )
17+ . option ( '-w, --wrap <delimiter>' , 'Wrap delimiter' )
18+ . option ( '-e, --eol <delimiter>' , 'End of Line delimiter' )
19+ . option ( '-E, --empty-field-value <value>' , 'Empty field value' )
20+ . option ( '-n, --expand-nested-objects' , 'Expand nested objects to be deep converted to CSV' )
21+ . option ( '-k, --keys [keys]' , 'Keys of documents to convert to CSV' , utils . constructKeysList )
22+ . option ( '-d, --escape-header-nested-dots' , 'Escape header nested dots' )
1623 . option ( '-b, --excel-bom' , 'Excel Byte Order Mark character prepended to CSV' )
24+ . option ( '-x, --exclude-keys [keys]' , 'Comma separated list of keys to exclude' , utils . constructKeysList )
25+ . option ( '-A, --expand-array-objects' , 'Expand array objects' )
1726 . option ( '-W, --without-header' , 'Withhold the prepended header' )
27+ . option ( '-p, --prevent-csv-injection' , 'Prevent CSV Injection' )
1828 . option ( '-s, --sort-header' , 'Sort the header fields' )
19- . option ( '-H, --trim-header' , 'Trim header fields' )
2029 . option ( '-F, --trim-fields' , 'Trim field values' )
21- . option ( '-S, --check-schema' , 'Check for schema differences' )
22- . option ( '-E, --empty-field-value <value>' , 'Empty field value' )
23- . option ( '-A, --expand-array-objects' , 'Expand array objects' )
30+ . option ( '-H, --trim-header' , 'Trim header fields' )
2431 . option ( '-U, --unwind-arrays' , 'Unwind array values to their own CSV line' )
25- . option ( '-k, --keys [keys]' , 'Keys of documents to convert to CSV' , utils . constructKeysList , undefined )
32+ . option ( '-I, --iso-date-format' , 'Use ISO 8601 date format' )
33+ . option ( '-L, --locale-format' , 'Use locale format for values' )
34+ . option ( '-B, --wrap-booleans' , 'Wrap booleans' )
2635 . parse ( process . argv ) ;
2736
2837const options = program . opts ( ) ;
@@ -36,15 +45,23 @@ Promise.resolve({
3645 wrap : options . wrap ,
3746 eol : options . eol
3847 } ,
48+ arrayIndexesAsKeys : Boolean ( options . arrayIndexesAsKeys ) ,
49+ emptyFieldValue : options . emptyFieldValue ,
50+ escapeHeaderNestedDots : Boolean ( options . escapeHeaderNestedDots ) ,
3951 excelBOM : Boolean ( options . excelBom ) ,
52+ excludeKeys : options . excludeKeys ,
53+ expandNestedObjects : Boolean ( options . expandNestedObjects ) ,
4054 prependHeader : ! options . withoutHeader ,
55+ preventCsvInjection : Boolean ( options . preventCsvInjection ) ,
4156 sortHeader : Boolean ( options . sortHeader ) ,
4257 trimHeaderFields : Boolean ( options . trimHeader ) ,
4358 trimFieldValues : Boolean ( options . trimFields ) ,
4459 checkSchemaDifferences : Boolean ( options . checkSchema ) ,
4560 expandArrayObjects : Boolean ( options . expandArrayObjects ) ,
4661 unwindArrays : Boolean ( options . unwindArrays ) ,
47- emptyFieldValue : options . emptyFieldValue ,
62+ useDateIso8601Format : Boolean ( options . isoDateFormat ) ,
63+ useLocaleFormat : Boolean ( options . localeFormat ) ,
64+ wrapBooleans : Boolean ( options . wrapBooleans ) ,
4865 keys : options . keys
4966 }
5067} )
0 commit comments