Skip to content

Commit 65829f7

Browse files
authored
Merge pull request #259 from mrodrig/updates-for-cli
CLI Updates
2 parents e0a035e + f8ca4b5 commit 65829f7

File tree

5 files changed

+40
-25
lines changed

5 files changed

+40
-25
lines changed

README.md

Lines changed: 36 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -240,40 +240,56 @@ $ npm install @mrodrig/json-2-csv-cli
240240
```
241241
Usage: json2csv <jsonFile> [options]
242242
243+
Arguments:
244+
jsonFile JSON file to convert
245+
243246
Options:
244247
-V, --version output the version number
245248
-o, --output [output] Path of output file. If not provided, then stdout will be used
246-
-f, --field <delimiter> Optional field delimiter
247-
-w, --wrap <delimiter> Optional wrap delimiter
248-
-e, --eol <delimiter> Optional end of line delimiter
249+
-a, --array-indexes-as-keys Includes array indexes in the generated keys
250+
-S, --check-schema Check for schema differences
251+
-f, --field <delimiter> Field delimiter
252+
-w, --wrap <delimiter> Wrap delimiter
253+
-e, --eol <delimiter> End of Line delimiter
254+
-E, --empty-field-value <value> Empty field value
255+
-n, --expand-nested-objects Expand nested objects to be deep converted to CSV
256+
-k, --keys [keys] Keys of documents to convert to CSV
257+
-d, --escape-header-nested-dots Escape header nested dots
249258
-b, --excel-bom Excel Byte Order Mark character prepended to CSV
259+
-x, --exclude-keys [keys] Comma separated list of keys to exclude
260+
-A, --expand-array-objects Expand array objects
250261
-W, --without-header Withhold the prepended header
262+
-p, --prevent-csv-injection Prevent CSV Injection
251263
-s, --sort-header Sort the header fields
252-
-H, --trim-header Trim header fields
253264
-F, --trim-fields Trim field values
254-
-S, --check-schema Check for schema differences
255-
-E, --empty-field-value <value> Empty field value
256-
-A, --expand-array-objects Expand array objects
257-
-k, --keys [keys] Keys of documents to convert to CSV
258-
-h, --help output usage information
265+
-H, --trim-header Trim header fields
266+
-U, --unwind-arrays Unwind array values to their own CSV line
267+
-I, --iso-date-format Use ISO 8601 date format
268+
-L, --locale-format Use locale format for values
269+
-B, --wrap-booleans Wrap booleans
270+
-h, --help display help for command
259271
```
260272

261273
#### csv2json
262274
```
263275
Usage: csv2json <csvFile> [options]
264276
277+
Arguments:
278+
csvFile CSV file to convert
279+
265280
Options:
266-
-V, --version output the version number
267-
-c, --csv <csv> Path of json file to be converted
268-
-o, --output [output] Path of output file. If not provided, then stdout will be used
269-
-f, --field <delimiter> Optional field delimiter
270-
-w, --wrap <delimiter> Optional wrap delimiter
271-
-e, --eol <delimiter> Optional end of line delimiter
272-
-b, --excel-bom Excel Byte Order Mark character prepended to CSV
273-
-H, --trim-header Trim header fields
274-
-F, --trim-fields Trim field values
275-
-k, --keys [keys] Keys of documents to convert to CSV
276-
-h, --help output usage information
281+
-V, --version output the version number
282+
-o, --output [output] Path of output file. If not provided, then stdout will be used
283+
-f, --field <delimiter> Field delimiter
284+
-w, --wrap <delimiter> Wrap delimiter
285+
-e, --eol <delimiter> End of Line delimiter
286+
-b, --excel-bom Excel Byte Order Mark character prepended to CSV
287+
-p, --prevent-csv-injection Prevent CSV Injection
288+
-F, --trim-fields Trim field values
289+
-H, --trim-header Trim header fields
290+
-h, --header-fields Specify the fields names in place a header line in the CSV itself
291+
-k, --keys [keys] Keys of documents to convert to CSV
292+
--help display help for command
277293
```
278294

279295
## Tests

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
},
66
"name": "json-2-csv",
77
"description": "A JSON to CSV and CSV to JSON converter that natively supports sub-documents and auto-generates the CSV heading.",
8-
"version": "5.5.3",
8+
"version": "5.5.4",
99
"homepage": "https://mrodrig.github.io/json-2-csv",
1010
"repository": {
1111
"type": "git",

src/constants.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ export const defaultCsv2JsonOptions: DefaultCsv2JsonOptions = {
5252
preventCsvInjection: false,
5353
trimFieldValues : false,
5454
trimHeaderFields: false,
55-
wrapBooleans: false,
5655
};
5756

5857
export const excelBOM = '\ufeff';

src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ export interface DefaultCsv2JsonOptions extends
187187
Pick<Csv2JsonOptions, 'headerFields'>,
188188
Pick<Csv2JsonOptions, 'parseValue'>,
189189
// Then extend the types with required fields and specific fields omitted:
190-
Omit<Omit<Omit<BuiltCsv2JsonOptions, 'keys'>, 'headerFields'>, 'parseValue'> {}
190+
Omit<Omit<Omit<Omit<BuiltCsv2JsonOptions, 'wrapBooleans'>, 'keys'>, 'headerFields'>, 'parseValue'> {}
191191

192192
export interface FullJson2CsvOptions extends DefaultJson2CsvOptions {
193193
/**

0 commit comments

Comments
 (0)