kempo 2.11.2 → 2.11.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/utils/cli.js +1 -1
- package/docs/kempo/utils/cli.js +1 -1
- package/package.json +1 -1
- package/src/utils/cli.js +2 -2
package/dist/utils/cli.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{spawn}from"child_process";import readline from"readline";const args={};let win={};"undefined"!=typeof window?win=window:"undefined"!=typeof global&&(win=global),win.log=(...e)=>{args.debug&&console.log(...e)};export const getArgs=(e={d:"debug"})=>{let r="",s=[];const o=()=>{r&&(0===s.length?args[r]=!0:1===s.length?"false"===s[0]?args[r]=!1:args[r]=s[0]:args[r]=s)};for(let t=2;t<process.argv.length;t++){const n=process.argv[t];n.startsWith("-")?(o(),n.startsWith("--")?r=n.slice(2):(r=n.slice(1),e[r]&&(r=e[r])),s=[]):s.push(n)}return o(),args};export const runChildProcess=e=>new Promise(((r,s)=>{const[o,...t]=e.split(" ");spawn(o,t).on("close",(e=>{0===e?r(`child process exited with code ${e}`):s(new Error(`child process exited with code ${e}`))}))}));export const runChildNodeProcess=(e,r={})=>{const s=`node ${e} ${Object.entries(r).flatMap((([e,r])=>!0===r?[`--${e}`]:[`--${e}`,r])).join(" ")}`;return runChildProcess(s)};export const promptUser=e=>{const r=readline.createInterface({input:process.stdin,output:process.stdout});return new Promise((s=>{r.question(e
|
|
1
|
+
import{spawn}from"child_process";import readline from"readline";const args={};let win={};"undefined"!=typeof window?win=window:"undefined"!=typeof global&&(win=global),win.log=(...e)=>{args.debug&&console.log(...e)};export const getArgs=(e={d:"debug"})=>{let r="",s=[];const o=()=>{r&&(0===s.length?args[r]=!0:1===s.length?"false"===s[0]?args[r]=!1:args[r]=s[0]:args[r]=s)};for(let t=2;t<process.argv.length;t++){const n=process.argv[t];n.startsWith("-")?(o(),n.startsWith("--")?r=n.slice(2):(r=n.slice(1),e[r]&&(r=e[r])),s=[]):s.push(n)}return o(),args};export const runChildProcess=e=>new Promise(((r,s)=>{const[o,...t]=e.split(" ");spawn(o,t).on("close",(e=>{0===e?r(`child process exited with code ${e}`):s(new Error(`child process exited with code ${e}`))}))}));export const runChildNodeProcess=(e,r={})=>{const s=`node ${e} ${Object.entries(r).flatMap((([e,r])=>!0===r?[`--${e}`]:[`--${e}`,r])).join(" ")}`;return runChildProcess(s)};export const promptUser=e=>{const r=readline.createInterface({input:process.stdin,output:process.stdout});return new Promise((s=>{r.question(`${e}: `,(e=>{r.close(),s(e)}))}))};export const promptYN=(e,r="y")=>promptUser(`${e} (${"y"===r?"Y/n":"y/N"}): `).then((e=>{const s=e.trim().toLowerCase();return""===s?"y"===r:"y"===s}));export default{getArgs:getArgs,runChildNodeProcess:runChildNodeProcess,runChildNodeProcess:runChildNodeProcess,promptUser:promptUser,promptYN:promptYN};
|
package/docs/kempo/utils/cli.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{spawn}from"child_process";import readline from"readline";const args={};let win={};"undefined"!=typeof window?win=window:"undefined"!=typeof global&&(win=global),win.log=(...e)=>{args.debug&&console.log(...e)};export const getArgs=(e={d:"debug"})=>{let r="",s=[];const o=()=>{r&&(0===s.length?args[r]=!0:1===s.length?"false"===s[0]?args[r]=!1:args[r]=s[0]:args[r]=s)};for(let t=2;t<process.argv.length;t++){const n=process.argv[t];n.startsWith("-")?(o(),n.startsWith("--")?r=n.slice(2):(r=n.slice(1),e[r]&&(r=e[r])),s=[]):s.push(n)}return o(),args};export const runChildProcess=e=>new Promise(((r,s)=>{const[o,...t]=e.split(" ");spawn(o,t).on("close",(e=>{0===e?r(`child process exited with code ${e}`):s(new Error(`child process exited with code ${e}`))}))}));export const runChildNodeProcess=(e,r={})=>{const s=`node ${e} ${Object.entries(r).flatMap((([e,r])=>!0===r?[`--${e}`]:[`--${e}`,r])).join(" ")}`;return runChildProcess(s)};export const promptUser=e=>{const r=readline.createInterface({input:process.stdin,output:process.stdout});return new Promise((s=>{r.question(e
|
|
1
|
+
import{spawn}from"child_process";import readline from"readline";const args={};let win={};"undefined"!=typeof window?win=window:"undefined"!=typeof global&&(win=global),win.log=(...e)=>{args.debug&&console.log(...e)};export const getArgs=(e={d:"debug"})=>{let r="",s=[];const o=()=>{r&&(0===s.length?args[r]=!0:1===s.length?"false"===s[0]?args[r]=!1:args[r]=s[0]:args[r]=s)};for(let t=2;t<process.argv.length;t++){const n=process.argv[t];n.startsWith("-")?(o(),n.startsWith("--")?r=n.slice(2):(r=n.slice(1),e[r]&&(r=e[r])),s=[]):s.push(n)}return o(),args};export const runChildProcess=e=>new Promise(((r,s)=>{const[o,...t]=e.split(" ");spawn(o,t).on("close",(e=>{0===e?r(`child process exited with code ${e}`):s(new Error(`child process exited with code ${e}`))}))}));export const runChildNodeProcess=(e,r={})=>{const s=`node ${e} ${Object.entries(r).flatMap((([e,r])=>!0===r?[`--${e}`]:[`--${e}`,r])).join(" ")}`;return runChildProcess(s)};export const promptUser=e=>{const r=readline.createInterface({input:process.stdin,output:process.stdout});return new Promise((s=>{r.question(`${e}: `,(e=>{r.close(),s(e)}))}))};export const promptYN=(e,r="y")=>promptUser(`${e} (${"y"===r?"Y/n":"y/N"}): `).then((e=>{const s=e.trim().toLowerCase();return""===s?"y"===r:"y"===s}));export default{getArgs:getArgs,runChildNodeProcess:runChildNodeProcess,runChildNodeProcess:runChildNodeProcess,promptUser:promptUser,promptYN:promptYN};
|
package/package.json
CHANGED
package/src/utils/cli.js
CHANGED
|
@@ -92,7 +92,7 @@ export const promptUser = (query) => {
|
|
|
92
92
|
});
|
|
93
93
|
|
|
94
94
|
return new Promise((resolve) => {
|
|
95
|
-
rl.question(query
|
|
95
|
+
rl.question(`${query}: `, (answer) => {
|
|
96
96
|
rl.close();
|
|
97
97
|
resolve(answer);
|
|
98
98
|
});
|
|
@@ -100,7 +100,7 @@ export const promptUser = (query) => {
|
|
|
100
100
|
};
|
|
101
101
|
|
|
102
102
|
export const promptYN = (query, defaultValue = 'y') => {
|
|
103
|
-
const formattedQuery = `${query}
|
|
103
|
+
const formattedQuery = `${query} (${defaultValue === 'y' ? 'Y/n' : 'y/N'}): `;
|
|
104
104
|
return promptUser(formattedQuery).then((answer) => {
|
|
105
105
|
const normalizedAnswer = answer.trim().toLowerCase();
|
|
106
106
|
if (normalizedAnswer === '') {
|