@awsless/clui 0.0.3 → 0.0.4
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/index.cjs +9 -18
- package/dist/index.d.cts +11 -15
- package/dist/index.d.ts +11 -15
- package/dist/index.js +9 -19
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -33,13 +33,11 @@ __export(index_exports, {
|
|
|
33
33
|
Cancelled: () => Cancelled,
|
|
34
34
|
ansi: () => ansi_exports,
|
|
35
35
|
color: () => color,
|
|
36
|
-
isCancel: () => import_prompts4.isCancel,
|
|
37
36
|
log: () => logs_exports,
|
|
38
37
|
prompt: () => prompts_exports,
|
|
39
38
|
symbol: () => symbols_exports
|
|
40
39
|
});
|
|
41
40
|
module.exports = __toCommonJS(index_exports);
|
|
42
|
-
var import_prompts4 = require("@clack/prompts");
|
|
43
41
|
|
|
44
42
|
// src/symbols.ts
|
|
45
43
|
var symbols_exports = {};
|
|
@@ -76,9 +74,9 @@ var Cancelled = class extends Error {
|
|
|
76
74
|
super("cancelled");
|
|
77
75
|
}
|
|
78
76
|
};
|
|
79
|
-
async function wrapPrompt(cb
|
|
77
|
+
async function wrapPrompt(cb) {
|
|
80
78
|
const result = await cb();
|
|
81
|
-
if ((0, import_prompts.isCancel)(result)
|
|
79
|
+
if ((0, import_prompts.isCancel)(result)) {
|
|
82
80
|
throw new Cancelled();
|
|
83
81
|
}
|
|
84
82
|
return result;
|
|
@@ -88,12 +86,12 @@ async function wrapPrompt(cb, { throwOnCancel = true } = {}) {
|
|
|
88
86
|
var text = async (opts) => {
|
|
89
87
|
return wrapPrompt(() => {
|
|
90
88
|
return (0, import_prompts2.text)(opts);
|
|
91
|
-
}
|
|
89
|
+
});
|
|
92
90
|
};
|
|
93
91
|
var password = async (opts) => {
|
|
94
92
|
return wrapPrompt(() => {
|
|
95
93
|
return (0, import_prompts2.password)({ mask: "*", ...opts });
|
|
96
|
-
}
|
|
94
|
+
});
|
|
97
95
|
};
|
|
98
96
|
var integer = async (opts) => {
|
|
99
97
|
const result = await text({
|
|
@@ -107,10 +105,7 @@ var integer = async (opts) => {
|
|
|
107
105
|
return;
|
|
108
106
|
}
|
|
109
107
|
});
|
|
110
|
-
|
|
111
|
-
return parseInt(result, 10);
|
|
112
|
-
}
|
|
113
|
-
return result;
|
|
108
|
+
return parseInt(result, 10);
|
|
114
109
|
};
|
|
115
110
|
var float = async (opts) => {
|
|
116
111
|
const result = await text({
|
|
@@ -124,25 +119,22 @@ var float = async (opts) => {
|
|
|
124
119
|
return;
|
|
125
120
|
}
|
|
126
121
|
});
|
|
127
|
-
|
|
128
|
-
return parseFloat(result);
|
|
129
|
-
}
|
|
130
|
-
return result;
|
|
122
|
+
return parseFloat(result);
|
|
131
123
|
};
|
|
132
124
|
var confirm = async (opts) => {
|
|
133
125
|
return wrapPrompt(() => {
|
|
134
126
|
return (0, import_prompts2.confirm)(opts);
|
|
135
|
-
}
|
|
127
|
+
});
|
|
136
128
|
};
|
|
137
129
|
var select = async (opts) => {
|
|
138
130
|
return wrapPrompt(() => {
|
|
139
131
|
return (0, import_prompts2.select)(opts);
|
|
140
|
-
}
|
|
132
|
+
});
|
|
141
133
|
};
|
|
142
134
|
var multiSelect = async (opts) => {
|
|
143
135
|
return wrapPrompt(() => {
|
|
144
136
|
return (0, import_prompts2.multiselect)(opts);
|
|
145
|
-
}
|
|
137
|
+
});
|
|
146
138
|
};
|
|
147
139
|
|
|
148
140
|
// src/logs.ts
|
|
@@ -307,7 +299,6 @@ var table = (props) => {
|
|
|
307
299
|
Cancelled,
|
|
308
300
|
ansi,
|
|
309
301
|
color,
|
|
310
|
-
isCancel,
|
|
311
302
|
log,
|
|
312
303
|
prompt,
|
|
313
304
|
symbol
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { TextOptions, PasswordOptions, ConfirmOptions, SelectOptions, MultiSelectOptions } from '@clack/prompts';
|
|
2
|
-
export { isCancel } from '@clack/prompts';
|
|
3
2
|
import stringLength from 'string-length';
|
|
4
3
|
import { Options } from 'wrap-ansi';
|
|
5
4
|
import * as chalk from 'chalk';
|
|
@@ -14,26 +13,19 @@ declare namespace symbols {
|
|
|
14
13
|
export { error$1 as error, info$1 as info, step$1 as step, success$1 as success, warning$1 as warning };
|
|
15
14
|
}
|
|
16
15
|
|
|
17
|
-
declare
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
type WrapPromptOptions<T extends boolean | undefined = boolean> = {
|
|
21
|
-
throwOnCancel?: T;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
declare const text: <T extends boolean | undefined = undefined>(opts: TextOptions & WrapPromptOptions<T>) => Promise<T extends false ? string | symbol : string>;
|
|
25
|
-
declare const password: <T extends boolean | undefined = undefined>(opts: PasswordOptions & WrapPromptOptions<T>) => Promise<T extends false ? string | symbol : string>;
|
|
16
|
+
declare const text: (opts: TextOptions) => Promise<string>;
|
|
17
|
+
declare const password: (opts: PasswordOptions) => Promise<string>;
|
|
26
18
|
type NumberOptions = {
|
|
27
19
|
message: string;
|
|
28
20
|
placeholder?: string;
|
|
29
21
|
defaultValue?: number;
|
|
30
22
|
initialValue?: number;
|
|
31
23
|
};
|
|
32
|
-
declare const integer:
|
|
33
|
-
declare const float:
|
|
34
|
-
declare const confirm:
|
|
35
|
-
declare const select: <Value
|
|
36
|
-
declare const multiSelect: <Value
|
|
24
|
+
declare const integer: (opts: NumberOptions) => Promise<number>;
|
|
25
|
+
declare const float: (opts: NumberOptions) => Promise<number>;
|
|
26
|
+
declare const confirm: (opts: ConfirmOptions) => Promise<boolean>;
|
|
27
|
+
declare const select: <Value>(opts: SelectOptions<Value>) => Promise<Exclude<Value, symbol>>;
|
|
28
|
+
declare const multiSelect: <Value>(opts: MultiSelectOptions<Value>) => Promise<Value[]>;
|
|
37
29
|
|
|
38
30
|
declare const prompts_confirm: typeof confirm;
|
|
39
31
|
declare const prompts_float: typeof float;
|
|
@@ -98,4 +90,8 @@ declare namespace ansi {
|
|
|
98
90
|
|
|
99
91
|
declare const color: chalk.ChalkInstance;
|
|
100
92
|
|
|
93
|
+
declare class Cancelled extends Error {
|
|
94
|
+
constructor();
|
|
95
|
+
}
|
|
96
|
+
|
|
101
97
|
export { Cancelled, ansi, color, logs as log, prompts as prompt, symbols as symbol };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { TextOptions, PasswordOptions, ConfirmOptions, SelectOptions, MultiSelectOptions } from '@clack/prompts';
|
|
2
|
-
export { isCancel } from '@clack/prompts';
|
|
3
2
|
import stringLength from 'string-length';
|
|
4
3
|
import { Options } from 'wrap-ansi';
|
|
5
4
|
import * as chalk from 'chalk';
|
|
@@ -14,26 +13,19 @@ declare namespace symbols {
|
|
|
14
13
|
export { error$1 as error, info$1 as info, step$1 as step, success$1 as success, warning$1 as warning };
|
|
15
14
|
}
|
|
16
15
|
|
|
17
|
-
declare
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
type WrapPromptOptions<T extends boolean | undefined = boolean> = {
|
|
21
|
-
throwOnCancel?: T;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
declare const text: <T extends boolean | undefined = undefined>(opts: TextOptions & WrapPromptOptions<T>) => Promise<T extends false ? string | symbol : string>;
|
|
25
|
-
declare const password: <T extends boolean | undefined = undefined>(opts: PasswordOptions & WrapPromptOptions<T>) => Promise<T extends false ? string | symbol : string>;
|
|
16
|
+
declare const text: (opts: TextOptions) => Promise<string>;
|
|
17
|
+
declare const password: (opts: PasswordOptions) => Promise<string>;
|
|
26
18
|
type NumberOptions = {
|
|
27
19
|
message: string;
|
|
28
20
|
placeholder?: string;
|
|
29
21
|
defaultValue?: number;
|
|
30
22
|
initialValue?: number;
|
|
31
23
|
};
|
|
32
|
-
declare const integer:
|
|
33
|
-
declare const float:
|
|
34
|
-
declare const confirm:
|
|
35
|
-
declare const select: <Value
|
|
36
|
-
declare const multiSelect: <Value
|
|
24
|
+
declare const integer: (opts: NumberOptions) => Promise<number>;
|
|
25
|
+
declare const float: (opts: NumberOptions) => Promise<number>;
|
|
26
|
+
declare const confirm: (opts: ConfirmOptions) => Promise<boolean>;
|
|
27
|
+
declare const select: <Value>(opts: SelectOptions<Value>) => Promise<Exclude<Value, symbol>>;
|
|
28
|
+
declare const multiSelect: <Value>(opts: MultiSelectOptions<Value>) => Promise<Value[]>;
|
|
37
29
|
|
|
38
30
|
declare const prompts_confirm: typeof confirm;
|
|
39
31
|
declare const prompts_float: typeof float;
|
|
@@ -98,4 +90,8 @@ declare namespace ansi {
|
|
|
98
90
|
|
|
99
91
|
declare const color: chalk.ChalkInstance;
|
|
100
92
|
|
|
93
|
+
declare class Cancelled extends Error {
|
|
94
|
+
constructor();
|
|
95
|
+
}
|
|
96
|
+
|
|
101
97
|
export { Cancelled, ansi, color, logs as log, prompts as prompt, symbols as symbol };
|
package/dist/index.js
CHANGED
|
@@ -4,9 +4,6 @@ var __export = (target, all) => {
|
|
|
4
4
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
5
5
|
};
|
|
6
6
|
|
|
7
|
-
// src/index.ts
|
|
8
|
-
import { isCancel as isCancel2 } from "@clack/prompts";
|
|
9
|
-
|
|
10
7
|
// src/symbols.ts
|
|
11
8
|
var symbols_exports = {};
|
|
12
9
|
__export(symbols_exports, {
|
|
@@ -48,9 +45,9 @@ var Cancelled = class extends Error {
|
|
|
48
45
|
super("cancelled");
|
|
49
46
|
}
|
|
50
47
|
};
|
|
51
|
-
async function wrapPrompt(cb
|
|
48
|
+
async function wrapPrompt(cb) {
|
|
52
49
|
const result = await cb();
|
|
53
|
-
if (isCancel(result)
|
|
50
|
+
if (isCancel(result)) {
|
|
54
51
|
throw new Cancelled();
|
|
55
52
|
}
|
|
56
53
|
return result;
|
|
@@ -60,12 +57,12 @@ async function wrapPrompt(cb, { throwOnCancel = true } = {}) {
|
|
|
60
57
|
var text = async (opts) => {
|
|
61
58
|
return wrapPrompt(() => {
|
|
62
59
|
return p_text(opts);
|
|
63
|
-
}
|
|
60
|
+
});
|
|
64
61
|
};
|
|
65
62
|
var password = async (opts) => {
|
|
66
63
|
return wrapPrompt(() => {
|
|
67
64
|
return p_password({ mask: "*", ...opts });
|
|
68
|
-
}
|
|
65
|
+
});
|
|
69
66
|
};
|
|
70
67
|
var integer = async (opts) => {
|
|
71
68
|
const result = await text({
|
|
@@ -79,10 +76,7 @@ var integer = async (opts) => {
|
|
|
79
76
|
return;
|
|
80
77
|
}
|
|
81
78
|
});
|
|
82
|
-
|
|
83
|
-
return parseInt(result, 10);
|
|
84
|
-
}
|
|
85
|
-
return result;
|
|
79
|
+
return parseInt(result, 10);
|
|
86
80
|
};
|
|
87
81
|
var float = async (opts) => {
|
|
88
82
|
const result = await text({
|
|
@@ -96,25 +90,22 @@ var float = async (opts) => {
|
|
|
96
90
|
return;
|
|
97
91
|
}
|
|
98
92
|
});
|
|
99
|
-
|
|
100
|
-
return parseFloat(result);
|
|
101
|
-
}
|
|
102
|
-
return result;
|
|
93
|
+
return parseFloat(result);
|
|
103
94
|
};
|
|
104
95
|
var confirm = async (opts) => {
|
|
105
96
|
return wrapPrompt(() => {
|
|
106
97
|
return p_confirm(opts);
|
|
107
|
-
}
|
|
98
|
+
});
|
|
108
99
|
};
|
|
109
100
|
var select = async (opts) => {
|
|
110
101
|
return wrapPrompt(() => {
|
|
111
102
|
return p_select(opts);
|
|
112
|
-
}
|
|
103
|
+
});
|
|
113
104
|
};
|
|
114
105
|
var multiSelect = async (opts) => {
|
|
115
106
|
return wrapPrompt(() => {
|
|
116
107
|
return p_multiselect(opts);
|
|
117
|
-
}
|
|
108
|
+
});
|
|
118
109
|
};
|
|
119
110
|
|
|
120
111
|
// src/logs.ts
|
|
@@ -278,7 +269,6 @@ export {
|
|
|
278
269
|
Cancelled,
|
|
279
270
|
ansi_exports as ansi,
|
|
280
271
|
color,
|
|
281
|
-
isCancel2 as isCancel,
|
|
282
272
|
logs_exports as log,
|
|
283
273
|
prompts_exports as prompt,
|
|
284
274
|
symbols_exports as symbol
|