|
|
|
|
|
|
|
|
var cli = { |
|
|
var cli = { |
|
|
nodeShellExec |
|
|
nodeShellExec |
|
|
, get prompter() { |
|
|
, get prompter() { |
|
|
const clii = readline.createInterface({ input: process.stdin, output: process.stdout }); |
|
|
|
|
|
clii.ask = function(q){ |
|
|
|
|
|
return new Promise((resolve, reject)=>{ |
|
|
|
|
|
clii.question(q, (answer)=>{ resolve(answer) }) |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
var prompt_interface = { |
|
|
|
|
|
ask : function(q){ |
|
|
|
|
|
// Needs to be serialized. Parallel asks are not possible. |
|
|
|
|
|
const clii = readline.createInterface({ input: process.stdin, output: process.stdout }); |
|
|
|
|
|
return new Promise((resolve, reject)=>{ |
|
|
|
|
|
clii.question(q, (answer)=>{ |
|
|
|
|
|
clii.close(); |
|
|
|
|
|
resolve(answer) |
|
|
|
|
|
}) |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
return clii |
|
|
|
|
|
|
|
|
return prompt_interface |
|
|
} |
|
|
} |
|
|
, prompt |
|
|
, prompt |
|
|
} |
|
|
} |