Uodated cli and add option to print to output
This commit is contained in:
parent
abfeea00ec
commit
d9ee930204
12
bin/cli.js
12
bin/cli.js
@ -29,12 +29,18 @@ const options = yargs
|
|||||||
type: "string",
|
type: "string",
|
||||||
demandOption: false,
|
demandOption: false,
|
||||||
})
|
})
|
||||||
.argv;
|
.option("p", {
|
||||||
|
alias: "print",
|
||||||
|
describe: "Print the exported json to console",
|
||||||
|
type: "boolean",
|
||||||
|
demandOption: false,
|
||||||
|
}).argv;
|
||||||
|
|
||||||
const inputFile = options.input;
|
const inputFile = options.input;
|
||||||
const outputFile = options.output;
|
const outputFile = options.output;
|
||||||
const mapperFile = options.mapper;
|
const mapperFile = options.mapper;
|
||||||
const sheetName = options.sheet;
|
const sheetName = options.sheet;
|
||||||
|
const print = options.print;
|
||||||
|
|
||||||
const exported = excel2json({
|
const exported = excel2json({
|
||||||
inputFile: inputFile,
|
inputFile: inputFile,
|
||||||
@ -42,3 +48,7 @@ const exported = excel2json({
|
|||||||
outputFile: outputFile,
|
outputFile: outputFile,
|
||||||
sheetName: sheetName,
|
sheetName: sheetName,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (print) {
|
||||||
|
console.log(exported);
|
||||||
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "excel2json-xlsx",
|
"name": "excel2json-xlsx",
|
||||||
"version": "1.0.2",
|
"version": "1.0.3",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"excel",
|
"excel",
|
||||||
"json",
|
"json",
|
||||||
|
Loading…
Reference in New Issue
Block a user