Skip to content

Commit 3446b68

Browse files
authored
feat: add --yes flag to commands that prompt users (#1105)
1 parent baae5bc commit 3446b68

9 files changed

Lines changed: 17 additions & 15 deletions

File tree

src/commands/actors/rm.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export class ActorsRmCommand extends ApifyCommand<typeof ActorsRmCommand> {
3434
};
3535

3636
static override flags = {
37-
...YesFlag,
37+
...YesFlag(),
3838
};
3939

4040
async run() {

src/commands/builds/remove-tag.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export class BuildsRemoveTagCommand extends ApifyCommand<typeof BuildsRemoveTagC
3636
description: 'The tag to remove from the build.',
3737
required: true,
3838
}),
39-
...YesFlag,
39+
...YesFlag(),
4040
};
4141

4242
async run() {

src/commands/builds/rm.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export class BuildsRmCommand extends ApifyCommand<typeof BuildsRmCommand> {
3535
};
3636

3737
static override flags = {
38-
...YesFlag,
38+
...YesFlag(),
3939
};
4040

4141
async run() {

src/commands/datasets/rm.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export class DatasetsRmCommand extends ApifyCommand<typeof DatasetsRmCommand> {
3636
};
3737

3838
static override flags = {
39-
...YesFlag,
39+
...YesFlag(),
4040
};
4141

4242
async run() {

src/commands/init.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export class InitCommand extends ApifyCommand<typeof InitCommand> {
5555
};
5656

5757
static override flags = {
58-
...YesFlag,
58+
...YesFlag(),
5959
dockerfile: Flags.string({
6060
description: 'Path to a Dockerfile to use for the Actor (e.g., "./Dockerfile" or "./docker/Dockerfile").',
6161
required: false,

src/commands/key-value-stores/delete-value.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export class KeyValueStoresDeleteValueCommand extends ApifyCommand<typeof KeyVal
4040
};
4141

4242
static override flags = {
43-
...YesFlag,
43+
...YesFlag(),
4444
};
4545

4646
async run() {

src/commands/key-value-stores/rm.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export class KeyValueStoresRmCommand extends ApifyCommand<typeof KeyValueStoresR
3636
};
3737

3838
static override flags = {
39-
...YesFlag,
39+
...YesFlag(),
4040
};
4141

4242
async run() {

src/commands/runs/rm.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export class RunsRmCommand extends ApifyCommand<typeof RunsRmCommand> {
4343
};
4444

4545
static override flags = {
46-
...YesFlag,
46+
...YesFlag(),
4747
};
4848

4949
async run() {

src/lib/command-framework/flags.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,15 @@ export const Flags = {
6565
};
6666

6767
/** Reusable `--yes` / `-y` flag for commands with confirmation prompts. */
68-
export const YesFlag = {
69-
yes: Flags.boolean({
70-
char: 'y',
71-
description: 'Automatic yes to prompts; assume "yes" as answer to all prompts.',
72-
default: false,
73-
}),
74-
};
68+
export function YesFlag(description = 'Automatic yes to prompts; assume "yes" as answer to all prompts.') {
69+
return {
70+
yes: Flags.boolean({
71+
char: 'y',
72+
description,
73+
default: false,
74+
}),
75+
};
76+
}
7577

7678
function stringFlag<const Choices extends string[], const T extends StringFlagOptions<readonly string[]>>(
7779
options: T & { choices?: Choices },

0 commit comments

Comments
 (0)