@kikimoradev/kcloud 0.7.4 → 0.7.6
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/main.js +11 -1
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -207,6 +207,16 @@ const createClackPrompter = ({ input, output }) => {
|
|
|
207
207
|
}
|
|
208
208
|
};
|
|
209
209
|
};
|
|
210
|
+
const unanswerableWithoutTerminal = (message) => new UsageError(`"${message}" needs an answer, and stdin is not a terminal.`, "Run the command in a terminal, or pass --yes to take the default answers.");
|
|
211
|
+
const withoutQuestions = (prompter) => ({
|
|
212
|
+
...prompter,
|
|
213
|
+
text: ({ message }) => Promise.reject(unanswerableWithoutTerminal(message)),
|
|
214
|
+
password: ({ message }) => Promise.reject(unanswerableWithoutTerminal(message)),
|
|
215
|
+
select: ({ message }) => Promise.reject(unanswerableWithoutTerminal(message)),
|
|
216
|
+
confirm: ({ message }) => Promise.reject(unanswerableWithoutTerminal(message))
|
|
217
|
+
});
|
|
218
|
+
const isTerminal$3 = (stream) => stream.isTTY === true;
|
|
219
|
+
const terminalPrompterOf = (streams) => isTerminal$3(streams.input) ? createClackPrompter(streams) : withoutQuestions(createClackPrompter(streams));
|
|
210
220
|
const unanswerable = (message) => new UsageError(`"${message}" needs an answer, and --yes asks no questions.`, "Pass the value as a flag or an environment variable, or run without --yes.");
|
|
211
221
|
const createUnattendedPrompter = (write) => ({
|
|
212
222
|
intro: write,
|
|
@@ -2741,7 +2751,7 @@ const createAdapters = (context) => ({
|
|
|
2741
2751
|
prompter: (settings) => {
|
|
2742
2752
|
const asked = settings.yes ? createUnattendedPrompter((text) => {
|
|
2743
2753
|
context.terminal.error(text);
|
|
2744
|
-
}) :
|
|
2754
|
+
}) : terminalPrompterOf({
|
|
2745
2755
|
input: context.io.stdin,
|
|
2746
2756
|
output: context.io.stderr
|
|
2747
2757
|
});
|