Skip to content
Draft
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
72 changes: 72 additions & 0 deletions src/pages/docs/cli/accounts/current.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
---
title: "ably accounts current"
meta_description: "Show the current Ably account information using the CLI."
meta_keywords: "ably cli, cli, accounts, current account, ably accounts current"
---

<Code>
```shell
ably accounts current [flags]
```
</Code>

Use the `ably accounts current` command to display information about the currently active Ably account. This shows account details, user information, configured apps, and the current API key being used.

## Flags

You can optionally pass the following flags to the `ably accounts current` command:

### `--help | -h` <a id="help"/>

Show CLI help for this command.

## Global flags

The following global flags are supported using the `ably accounts current` command:

* [`--api-key`](/docs/cli#api-key)
* [`--access-token`](/docs/cli#access-token)
* [`--client-id`](/docs/cli#client-id)
* [`--endpoint`](/docs/cli#endpoint)
* [`--env`](/docs/cli#env)
* [`--host`](/docs/cli#host)
* [`--json`](/docs/cli#json)
* [`--pretty-json`](/docs/cli#pretty-json)
* [`--token`](/docs/cli#token)
* [`--verbose`](/docs/cli#verbose)

## Output

The `ably accounts current` command displays:

| Property | Description |
| -------- | ----------- |
| Account | The account name and ID. |
| User | The email address of the logged-in user. |
| Apps configured | Number of apps configured for this account. |
| Current App | The currently selected app name and ID. |
| Current API Key | The API key being used. |
| Key Label | The label of the current API key. |

## Examples

Show current account information:

<Code>
```shell
ably accounts current
```
</Code>

**Output:**
<Code>
```text
Account: Ably (a12B3c)
User: [email protected]
Apps configured: 2
Current App: example-app (Ab1CdE)
Current API Key: Ab1CdE.F2ghIJ
Key Label: Example Key
```
</Code>

20 changes: 20 additions & 0 deletions src/pages/docs/cli/accounts/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
title: "ably accounts"
meta_description: "Manage Ably accounts and configured access tokens using the CLI."
meta_keywords: "ably cli, cli, accounts, authentication, account management, ably accounts"
---

Use the `ably accounts` command group to manage your Ably accounts and configured access tokens. These commands enable you to log in, switch between accounts, view account information, and monitor account statistics.

## Subcommands

The following commands are used to manage accounts:

| Command | Description |
| ------- | ----------- |
| [`ably accounts current`](/docs/cli/accounts/current) | Show the current Ably account information. |
| [`ably accounts list`](/docs/cli/accounts/list) | List all locally configured Ably accounts. |
| [`ably accounts login`](/docs/cli/accounts/login) | Log in to an Ably account. |
| [`ably accounts logout`](/docs/cli/accounts/logout) | Log out from an Ably account. |
| [`ably accounts switch`](/docs/cli/accounts/switch) | Switch to a different Ably account. |
| [`ably accounts stats`](/docs/cli/accounts/stats) | Get account-level statistics. |
63 changes: 63 additions & 0 deletions src/pages/docs/cli/accounts/list.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
---
title: "ably accounts list"
meta_description: "List all locally configured Ably accounts using the CLI."
meta_keywords: "ably cli, cli, accounts, account list, ably accounts list"
---

<Code>
```shell
ably accounts list [flags]
```
</Code>

Use the `ably accounts list` command to display all locally configured Ably accounts. This shows account information for all accounts that have been configured in the CLI, including which one is currently active.

## Global flags

The following global flags are supported using the `ably accounts list` command:

* [`--access-token`](/docs/cli#access-token)
* [`--api-key`](/docs/cli#api-key)
* [`--client-id`](/docs/cli#client-id)
* [`--env`](/docs/cli#env)
* [`--endpoint`](/docs/cli#endpoint)
* [`--host`](/docs/cli#host)
* [`--json`](/docs/cli#json)
* [`--pretty-json`](/docs/cli#pretty-json)
* [`--token`](/docs/cli#token)
* [`--verbose`](/docs/cli#verbose)

## Output

The `ably accounts list` command displays:

| Property | Description |
| -------- | ----------- |
| Account | The account name and ID. |
| Name | The alias name of the account, if one is configured. |
| User | The email address of the logged-in user. |
| Apps | Number of apps configured for this account. |
| Current App | The currently selected app name and ID. |

## Examples

List all configured accounts:

<Code>
```shell
ably accounts list
```
</Code>

**Output:**
<Code>
```text
Found 1 accounts:

▶ Account: default (current)
Name: ExampleAccount (a12B3c)
User: [email protected]
Apps configured: 2
Current app: example-app (Ab1CdE)
```
</Code>
80 changes: 80 additions & 0 deletions src/pages/docs/cli/accounts/login.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
---
title: "ably accounts login"
meta_description: "Log in to your Ably account using the CLI."
meta_keywords: "ably cli, cli, accounts, login, authentication, ably accounts login"
---

<Code>
```shell
ably accounts login <token> [flags]
```
</Code>

Use the `ably accounts login` command to authenticate with your Ably account.

## Arguments

Pass the following arguments to the `ably accounts login` command:

### `<token>` <a id="token"/>

The access token for your Ably account, for example: `abc1D2ef3Gh4Ij...`.

If not provided, the CLI will prompt you to enter an access token, or open a browser window for you to obtain one from your Ably account.

## Flags

You can optionally pass the following flags to the `ably accounts login` command:

### `--alias | -a` <a id="alias"/>

An alias name for this account configuration. If not specified, this becomes the default account.

### `--no-browser` <a id="no-browser"/>

Prevent the CLI from automatically opening a browser for authentication. Use this flag if you prefer to handle authentication manually or in headless environments.

### `--help | -h` <a id="help"/>

Show CLI help for this command.

## Global flags

The following global flags are supported using the `ably accounts login` command:

* [`--api-key`](/docs/cli#api-key)
* [`--access-token`](/docs/cli#access-token)
* [`--client-id`](/docs/cli#client-id)
* [`--endpoint`](/docs/cli#endpoint)
* [`--env`](/docs/cli#env)
* [`--host`](/docs/cli#host)
* [`--json`](/docs/cli#json)
* [`--pretty-json`](/docs/cli#pretty-json)
* [`--token`](/docs/cli#token)
* [`--verbose`](/docs/cli#verbose)

## Examples

Log in with interactive authentication:

```shell
ably accounts login
```

Log in with a specific access token:

```shell
ably accounts login abc1D2ef3Gh4Ij...
```

Log in with an alias for the account:

```shell
ably accounts login --alias example-company
```

Log in without opening a browser:

```shell
ably accounts login --no-browser
```
76 changes: 76 additions & 0 deletions src/pages/docs/cli/accounts/logout.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
---
title: "ably accounts logout"
meta_description: "Log out from an Ably account using the CLI."
meta_keywords: "ably cli, cli, accounts, logout, authentication, ably accounts logout"
---

<Code>
```shell
ably accounts logout <alias> [flags]
```
</Code>

Use the `ably accounts logout` command to remove authentication credentials for an Ably account from the CLI. This will remove the locally stored access token and any associated account configuration.

## Arguments

Pass the following arguments to the `ably accounts logout` command:

### `<alias>` <a id="alias"/>

The alias of the account to log out from, for example: `example-company`.

If not provided, logs out from the currently active account.

## Flags

You can optionally pass the following flags to the `ably accounts logout` command:

### `--force | -f` <a id="force"/>

Force logout without a confirmation prompt. This skips the interactive confirmation step.

### `--help | -h` <a id="help"/>

Show CLI help for this command.

## Global flags

The following global flags are supported using the `ably accounts logout` command:

* [`--api-key`](/docs/cli#api-key)
* [`--access-token`](/docs/cli#access-token)
* [`--client-id`](/docs/cli#client-id)
* [`--endpoint`](/docs/cli#endpoint)
* [`--env`](/docs/cli#env)
* [`--host`](/docs/cli#host)
* [`--json`](/docs/cli#json)
* [`--pretty-json`](/docs/cli#pretty-json)
* [`--token`](/docs/cli#token)
* [`--verbose`](/docs/cli#verbose)

## Examples

Log out from the current account:

<Code>
```shell
ably accounts logout
```
</Code>

Log out from a specific account by alias:

<Code>
```shell
ably accounts logout example-company
```
</Code>

Force logout without confirmation:

<Code>
```shell
ably accounts logout --force
```
</Code>
Loading