@salesforce/sf-plugins-core 1.19.3 → 1.20.0

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.
@@ -14,9 +14,10 @@ export declare class Prompter {
14
14
  *
15
15
  * @param message text to display. Do not include a question mark.
16
16
  * @param ms milliseconds to wait for user input. Defaults to 10s.
17
+ * @param defaultAnswer default answer for the prompt. Defaults to true. Pass in `false` to require a positive response.
17
18
  * @return true if the user confirms, false if they do not.
18
19
  */
19
- confirm(message: string, ms?: number): Promise<boolean>;
20
+ confirm(message: string, ms?: number, defaultAnswer?: boolean): Promise<boolean>;
20
21
  }
21
22
  export declare namespace Prompter {
22
23
  type Answers<T = Record<string, unknown>> = T & Record<string, unknown>;
@@ -46,14 +46,16 @@ class Prompter {
46
46
  *
47
47
  * @param message text to display. Do not include a question mark.
48
48
  * @param ms milliseconds to wait for user input. Defaults to 10s.
49
+ * @param defaultAnswer default answer for the prompt. Defaults to true. Pass in `false` to require a positive response.
49
50
  * @return true if the user confirms, false if they do not.
50
51
  */
51
- async confirm(message, ms = 10000) {
52
+ async confirm(message, ms = 10000, defaultAnswer = true) {
52
53
  const { confirmed } = await this.timedPrompt([
53
54
  {
54
55
  name: 'confirmed',
55
56
  message,
56
57
  type: 'confirm',
58
+ default: defaultAnswer,
57
59
  },
58
60
  ], ms);
59
61
  return confirmed;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/sf-plugins-core",
3
- "version": "1.19.3",
3
+ "version": "1.20.0",
4
4
  "description": "Utils for writing deploy and retrieve plugins",
5
5
  "main": "lib/exported",
6
6
  "types": "lib/exported.d.ts",