Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -433,8 +433,6 @@ EXAMPLES
$ ably apps delete
$ ably apps set-apns-p12
$ ably apps rules list
$ ably apps switch my-app
Expand Down Expand Up @@ -2037,6 +2035,8 @@ EXAMPLES
$ ably channels presence update my-channel --data '{"status":"busy"}' --json
$ ably channels presence update my-channel --data '{"status":"busy"}' --pretty-json
$ ably channels presence update my-channel --data '{"status":"online"}' --duration 60
```

Expand Down
1 change: 0 additions & 1 deletion src/commands/apps/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export default class AppsCommand extends BaseTopicCommand {
"$ ably apps create",
"$ ably apps update",
"$ ably apps delete",
"$ ably apps set-apns-p12",
"$ ably apps rules list",
"$ ably apps switch my-app",
];
Expand Down
107 changes: 0 additions & 107 deletions src/commands/apps/set-apns-p12.ts

This file was deleted.

13 changes: 4 additions & 9 deletions src/commands/push/channels/remove-where.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Flags } from "@oclif/core";
import inquirer from "inquirer";

import { AblyBaseCommand } from "../../../base-command.js";
import { forceFlag, productApiFlags } from "../../../flags.js";
Expand All @@ -9,6 +8,7 @@ import {
formatResource,
formatSuccess,
} from "../../../utils/output.js";
import { promptForConfirmation } from "../../../utils/prompt-confirmation.js";

export default class PushChannelsRemoveWhere extends AblyBaseCommand {
static override description =
Expand Down Expand Up @@ -53,14 +53,9 @@ export default class PushChannelsRemoveWhere extends AblyBaseCommand {
.map(([k, v]) => `${k}=${v}`)
.join(", ");

const { confirmed } = await inquirer.prompt([
{
type: "confirm",
name: "confirmed",
message: `Are you sure you want to remove all subscriptions matching: ${filterDesc}?`,
default: false,
},
]);
const confirmed = await promptForConfirmation(
`Are you sure you want to remove all subscriptions matching: ${filterDesc}?`,
);

if (!confirmed) {
this.log("Operation cancelled.");
Expand Down
13 changes: 4 additions & 9 deletions src/commands/push/channels/remove.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Flags } from "@oclif/core";
import inquirer from "inquirer";

import { AblyBaseCommand } from "../../../base-command.js";
import { forceFlag, productApiFlags } from "../../../flags.js";
Expand All @@ -9,6 +8,7 @@ import {
formatResource,
formatSuccess,
} from "../../../utils/output.js";
import { promptForConfirmation } from "../../../utils/prompt-confirmation.js";

export default class PushChannelsRemove extends AblyBaseCommand {
static override description = "Remove a push channel subscription";
Expand Down Expand Up @@ -56,14 +56,9 @@ export default class PushChannelsRemove extends AblyBaseCommand {
: `client ${flags["client-id"]}`;

if (!flags.force && !this.shouldOutputJson(flags)) {
const { confirmed } = await inquirer.prompt([
{
type: "confirm",
name: "confirmed",
message: `Are you sure you want to unsubscribe ${target} from channel ${flags.channel}?`,
default: false,
},
]);
const confirmed = await promptForConfirmation(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We only ask for confirmation in non-json mode, is this intentional?
Also, means flags.force=false is not applicable for non-json mode

`Are you sure you want to unsubscribe ${target} from channel ${flags.channel}?`,
);

if (!confirmed) {
this.log("Operation cancelled.");
Expand Down
13 changes: 4 additions & 9 deletions src/commands/push/config/clear-apns.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Flags } from "@oclif/core";
import inquirer from "inquirer";

import { ControlBaseCommand } from "../../../control-base-command.js";
import { forceFlag } from "../../../flags.js";
Expand All @@ -9,6 +8,7 @@ import {
formatSuccess,
formatWarning,
} from "../../../utils/output.js";
import { promptForConfirmation } from "../../../utils/prompt-confirmation.js";

export default class PushConfigClearApns extends ControlBaseCommand {
static override description =
Expand Down Expand Up @@ -37,14 +37,9 @@ export default class PushConfigClearApns extends ControlBaseCommand {
const appId = await this.requireAppId(flags);

if (!flags.force && !this.shouldOutputJson(flags)) {
const { confirmed } = await inquirer.prompt([
{
default: false,
message: `Are you sure you want to clear APNs configuration for app ${formatResource(appId)}?`,
name: "confirmed",
type: "confirm",
},
]);
const confirmed = await promptForConfirmation(
`Are you sure you want to clear APNs configuration for app ${formatResource(appId)}?`,
);

if (!confirmed) {
this.log("Operation cancelled.");
Expand Down
14 changes: 5 additions & 9 deletions src/commands/push/config/clear-fcm.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Flags } from "@oclif/core";
import inquirer from "inquirer";

import { ControlBaseCommand } from "../../../control-base-command.js";
import { forceFlag } from "../../../flags.js";
Expand All @@ -9,6 +8,7 @@ import {
formatSuccess,
formatWarning,
} from "../../../utils/output.js";
import { promptForConfirmation } from "../../../utils/prompt-confirmation.js";

export default class PushConfigClearFcm extends ControlBaseCommand {
static override description =
Expand Down Expand Up @@ -37,14 +37,9 @@ export default class PushConfigClearFcm extends ControlBaseCommand {
const appId = await this.requireAppId(flags);

if (!flags.force && !this.shouldOutputJson(flags)) {
const { confirmed } = await inquirer.prompt([
{
default: false,
message: `Are you sure you want to clear FCM configuration for app ${formatResource(appId)}?`,
name: "confirmed",
type: "confirm",
},
]);
const confirmed = await promptForConfirmation(
`Are you sure you want to clear FCM configuration for app ${formatResource(appId)}?`,
);

if (!confirmed) {
this.log("Operation cancelled.");
Expand Down Expand Up @@ -88,6 +83,7 @@ export default class PushConfigClearFcm extends ControlBaseCommand {
}

await controlApi.updateApp(appId, {
fcmProjectId: null,
fcmServiceAccount: null,
});

Expand Down
13 changes: 4 additions & 9 deletions src/commands/push/devices/remove-where.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Flags } from "@oclif/core";
import inquirer from "inquirer";

import { AblyBaseCommand } from "../../../base-command.js";
import { forceFlag, productApiFlags } from "../../../flags.js";
import { BaseFlags } from "../../../types/cli.js";
import { formatProgress, formatSuccess } from "../../../utils/output.js";
import { promptForConfirmation } from "../../../utils/prompt-confirmation.js";

export default class PushDevicesRemoveWhere extends AblyBaseCommand {
static override description =
Expand Down Expand Up @@ -51,14 +51,9 @@ export default class PushDevicesRemoveWhere extends AblyBaseCommand {
.map(([k, v]) => `${k}=${v}`)
.join(", ");

const { confirmed } = await inquirer.prompt([
{
type: "confirm",
name: "confirmed",
message: `Are you sure you want to remove all devices matching: ${filterDesc}?`,
default: false,
},
]);
const confirmed = await promptForConfirmation(
`Are you sure you want to remove all devices matching: ${filterDesc}?`,
);

if (!confirmed) {
this.log("Operation cancelled.");
Expand Down
13 changes: 4 additions & 9 deletions src/commands/push/devices/remove.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Args } from "@oclif/core";
import inquirer from "inquirer";

import { AblyBaseCommand } from "../../../base-command.js";
import { forceFlag, productApiFlags } from "../../../flags.js";
Expand All @@ -9,6 +8,7 @@ import {
formatResource,
formatSuccess,
} from "../../../utils/output.js";
import { promptForConfirmation } from "../../../utils/prompt-confirmation.js";

export default class PushDevicesRemove extends AblyBaseCommand {
static override args = {
Expand Down Expand Up @@ -40,14 +40,9 @@ export default class PushDevicesRemove extends AblyBaseCommand {
if (!rest) return;

if (!flags.force && !this.shouldOutputJson(flags)) {
const { confirmed } = await inquirer.prompt([
{
type: "confirm",
name: "confirmed",
message: `Are you sure you want to remove device ${deviceId}?`,
default: false,
},
]);
const confirmed = await promptForConfirmation(
`Are you sure you want to remove device ${deviceId}?`,
);

if (!confirmed) {
this.log("Operation cancelled.");
Expand Down
Loading
Loading