mirror of
https://github.com/notion-enhancer/notion-enhancer.git
synced 2025-04-11 15:59:03 +00:00
fix(cli): make args["--json"] state available to print funcs
This commit is contained in:
parent
d3840c5922
commit
f61d13ca91
8
bin.mjs
8
bin.mjs
@ -124,10 +124,11 @@ const compileOptsToArgSpec = (options) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let __json;
|
||||||
const printHelp = (commands, options) => {
|
const printHelp = (commands, options) => {
|
||||||
const { name, version, homepage } = manifest,
|
const { name, version, homepage } = manifest,
|
||||||
usage = `${name} <command> [options]`;
|
usage = `${name} <command> [options]`;
|
||||||
if (args["--json"]) {
|
if (__json) {
|
||||||
printObject({
|
printObject({
|
||||||
name,
|
name,
|
||||||
version,
|
version,
|
||||||
@ -150,7 +151,7 @@ const printHelp = (commands, options) => {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
printVersion = () => {
|
printVersion = () => {
|
||||||
if (args["--json"]) {
|
if (__json) {
|
||||||
printObject({
|
printObject({
|
||||||
[manifest.name]: manifest.version,
|
[manifest.name]: manifest.version,
|
||||||
node: process.version.slice(1),
|
node: process.version.slice(1),
|
||||||
@ -208,6 +209,7 @@ try {
|
|||||||
const args = arg(compileOptsToArgSpec(options));
|
const args = arg(compileOptsToArgSpec(options));
|
||||||
if (args["--debug"]) __debug = true;
|
if (args["--debug"]) __debug = true;
|
||||||
if (args["--quiet"]) __quiet = true;
|
if (args["--quiet"]) __quiet = true;
|
||||||
|
if (args["--json"]) __json = true;
|
||||||
if (args["--no"] || args["--quiet"]) __confirmation = "n";
|
if (args["--no"] || args["--quiet"]) __confirmation = "n";
|
||||||
if (args["--yes"]) __confirmation = "y";
|
if (args["--yes"]) __confirmation = "y";
|
||||||
if (args["--help"]) printHelp(commands, options), process.exit();
|
if (args["--help"]) printHelp(commands, options), process.exit();
|
||||||
@ -340,7 +342,7 @@ try {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "check": {
|
case "check": {
|
||||||
if (args["--json"]) {
|
if (__json) {
|
||||||
printObject({
|
printObject({
|
||||||
appPath,
|
appPath,
|
||||||
backupPath,
|
backupPath,
|
||||||
|
Loading…
Reference in New Issue
Block a user