complete-cli 1.0.2 → 1.0.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/prompt.js DELETED
@@ -1,53 +0,0 @@
1
- // Both the Inquirer.js library and the Prompts library have a bug where text is duplicated in a Git
2
- // Bash terminal. Thus, we revert to using the simpler Prompt library.
3
- import { cancel, confirm, intro, isCancel, log, outro, spinner, text, } from "@clack/prompts";
4
- import chalk from "chalk";
5
- import { PROJECT_NAME } from "./constants.js";
6
- export function promptStart() {
7
- intro(chalk.inverse(PROJECT_NAME));
8
- }
9
- export function promptEnd(msg) {
10
- outro(msg);
11
- process.exit();
12
- }
13
- export async function getInputYesNo(msg, defaultValue = true) {
14
- const input = await confirm({
15
- message: msg,
16
- initialValue: defaultValue,
17
- });
18
- if (isCancel(input)) {
19
- cancel("Canceled.");
20
- process.exit(1);
21
- }
22
- return input;
23
- }
24
- /** Returns trimmed input. */
25
- export async function getInputString(msg, defaultValue) {
26
- const input = await text({
27
- message: msg,
28
- initialValue: defaultValue,
29
- });
30
- if (isCancel(input)) {
31
- cancel("Canceled.");
32
- process.exit(1);
33
- }
34
- const trimmedInput = input.trim();
35
- if (trimmedInput === "") {
36
- promptError("You must enter a non-empty value.");
37
- }
38
- return input.trim();
39
- }
40
- export function promptLog(msg) {
41
- log.step(msg); // Step is a hollow green diamond.
42
- }
43
- export function promptSpinnerStart(msg) {
44
- const s = spinner({
45
- indicator: "timer",
46
- });
47
- s.start(msg);
48
- return s;
49
- }
50
- export function promptError(msg) {
51
- cancel(msg);
52
- process.exit(1);
53
- }