Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cli branch #13880

Merged
merged 12 commits into from
Jul 11, 2023
6 changes: 6 additions & 0 deletions TOC-tidb-cloud.md
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,12 @@
- [describe](/tidb-cloud/ticloud-cluster-describe.md)
- [list](/tidb-cloud/ticloud-cluster-list.md)
- [connect-info](/tidb-cloud/ticloud-cluster-connect-info.md)
- branch
- [create](/tidb-cloud/ticloud-branch-create.md)
- [delete](/tidb-cloud/ticloud-branch-delete.md)
- [describe](/tidb-cloud/ticloud-branch-describe.md)
- [list](/tidb-cloud/ticloud-branch-list.md)
- [connect-info](/tidb-cloud/ticloud-branch-connect-info.md)
- config
- [create](/tidb-cloud/ticloud-config-create.md)
- [delete](/tidb-cloud/ticloud-config-delete.md)
Expand Down
1 change: 1 addition & 0 deletions tidb-cloud/cli-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ To use the `ticloud` CLI in your terminal, run `ticloud [command] [subcommand]`.
| Command | Subcommand | Description |
|------------|------------------------------------------------------------|----------------------------------------------------------------------------------------------------------|
| cluster | create, delete, describe, list, connect-info | Manage clusters |
| branch | create, delete, describe, list, connect-info | Manage branches |
| completion | bash, fish, powershell, zsh | Generate completion script for specified shell |
| config | create, delete, describe, edit, list, set, use | Configure user profiles |
| connect | - | Connect to a TiDB cluster |
Expand Down
49 changes: 49 additions & 0 deletions tidb-cloud/ticloud-branch-connect-info.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
title: ticloud branch connect-info
summary: The reference of `ticloud branch connect-info`.
---

# ticloud branch connect-info

Get the connection string of a branch:

```shell
ticloud branch connect-info [flags]
```

## Examples

Get the connection string of a branch in interactive mode:

```shell
ticloud branch connect-info
```

Get the connection string of a branch in non-interactive mode:

```shell
ticloud branch connect-info --branch-id <branch-id> --cluster-id <cluster-id> --client <client-name> --operating-system <operating-system>
```

## Flags

In non-interactive mode, you need to manually enter the required flags. In interactive mode, you can just follow CLI prompts to fill them in.

| Flag | Description | Required | Note |
|---------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------|------------------------------------------------------|
| -c, --cluster-id string | The ID of the cluster, in which the branch is created | Yes | Only works in non-interactive mode. |
| -b, --branch-id string | The ID of the branch | Yes | Only works in non-interactive mode. |
| --client string | The desired client used for the connection. Supported clients include `general`, `mysql_cli`, `mycli`, `libmysqlclient`, `python_mysqlclient`, `pymysql`, `mysql_connector_python`, `mysql_connector_java`, `go_mysql_driver`, `node_mysql2`, `ruby_mysql2`, `php_mysqli`, `rust_mysql`, `mybatis`, `hibernate`, `spring_boot`, `gorm`, `prisma`, `sequelize_mysql2`, `django_tidb`, `sqlalchemy_mysqlclient`, and `active_record`. | Yes | Only works in non-interactive mode. |
| --operating-system string | The operating system name. Supported operating systems include `macOS`, `Windows`, `Ubuntu`, `CentOS`, `RedHat`, `Fedora`, `Debian`, `Arch`, `OpenSUSE`, `Alpine`, and `Others`. | Yes | Only works in non-interactive mode. |
| -h, --help | Help information for this command | No | Works in both non-interactive and interactive modes. |

## Inherited flags

| Flag | Description | Required | Note |
|----------------------|-------------------------------------------------------------------------------------------------------|----------|-------------------------------------------------------------------------------------------------------------------|
| --no-color | Disables color in output. | No | Only works in non-interactive mode. In interactive mode, disabling color might not work with some UI components. |
| -P, --profile string | Specifies the active [user profile](/tidb-cloud/cli-reference.md#user-profile) used in this command. | No | Works in both non-interactive and interactive modes. |

## Feedback

If you have any questions or suggestions on the TiDB Cloud CLI, feel free to create an [issue](https://github.com/tidbcloud/tidbcloud-cli/issues/new/choose). Also, we welcome any contributions.
51 changes: 51 additions & 0 deletions tidb-cloud/ticloud-branch-create.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
title: ticloud branch create
summary: The reference of `ticloud branch create`.
---

# ticloud branch create

Create a branch for a cluster:

```shell
ticloud branch create [flags]
```

> **Note:**
>
> Currently, you can only create branches for TiDB Serverless cluster.
shiyuhang0 marked this conversation as resolved.
Show resolved Hide resolved

## Examples

Create a branch in interactive mode:

```shell
ticloud branch create
```

Create a branch in non-interactive mode:

```shell
ticloud branch create --cluster-id <cluster-id> --branch-name <branch-name>
```

## Flags

In non-interactive mode, you need to manually enter the required flags. In interactive mode, you can just follow CLI prompts to fill them in.

| Flag | Description | Required | Note |
|-------------------------|------------------------------------------------------------|----------|-----------------------------------------------------|
| -c, --cluster-id string | The ID of the cluster, in which the branch will be created | Yes | Only works in non-interactive mode. |
| --branch-name string | The name of the branch to be created | Yes | Only works in non-interactive mode. |
| -h, --help | Get help information for this command | No | Works in both non-interactive and interactive modes |

## Inherited flags

| Flag | Description | Required | Note |
|----------------------|------------------------------------------------------------------------------------------------------|----------|--------------------------------------------------------------------------------------------------------------------|
| --no-color | Disables color in output. | No | Only works in non-interactive mode. In interactive mode, disabling color might not work with some UI components. |
| -P, --profile string | Specifies the active [user profile](/tidb-cloud/cli-reference.md#user-profile) used in this command. | No | Works in both non-interactive and interactive modes. |

## Feedback

If you have any questions or suggestions on the TiDB Cloud CLI, feel free to create an [issue](https://github.com/tidbcloud/tidbcloud-cli/issues/new/choose). Also, we welcome any contributions.
54 changes: 54 additions & 0 deletions tidb-cloud/ticloud-branch-delete.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
title: ticloud branch delete
summary: The reference of `ticloud branch delete`.
---

# ticloud branch delete

Delete a branch from your cluster:

```shell
ticloud branch delete [flags]
```

Or use the following alias command:

```shell
ticloud branch rm [flags]
```

## Examples

Delete a branch in interactive mode:

```shell
ticloud branch delete
```

Delete a branch in non-interactive mode:

```shell
ticloud branch delete --branch-id <branch-id> --cluster-id <cluster-id>
```

## Flags

In non-interactive mode, you need to manually enter the required flags. In interactive mode, you can just follow CLI prompts to fill them in.

| Flag | Description | Required | Note |
|-------------------------|--------------------------------------------|----------|------------------------------------------------------|
| -b, --branch-id string | The ID of the branch to be deleted | Yes | Only works in non-interactive mode. |
| --force | Deletes a branch without confirmation | No | Works in both non-interactive and interactive modes. |
| -h, --help | Help information for this command | No | Works in both non-interactive and interactive modes. |
| -c, --cluster-id string | The cluster ID of the branch to be deleted | Yes | Only works in non-interactive mode. |

## Inherited flags

| Flag | Description | Required | Note |
|----------------------|--------------------------------------------------------------------------------------------|----------|-------------------------------------------------------------------------------------------------------------------|
| --no-color | Disables color in output. | No | Only works in non-interactive mode. In interactive mode, disabling color might not work with some UI components. |
| -P, --profile string | The active [user profile](/tidb-cloud/cli-reference.md#user-profile) used in this command. | No | Works in both non-interactive and interactive modes. |

## Feedback

If you have any questions or suggestions on the TiDB Cloud CLI, feel free to create an [issue](https://github.com/tidbcloud/tidbcloud-cli/issues/new/choose). Also, we welcome any contributions.
53 changes: 53 additions & 0 deletions tidb-cloud/ticloud-branch-describe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
title: ticloud branch describe
summary: The reference of `ticloud branch describe`.
---

# ticloud branch describe

Get information about a branch (such as the endpoints, [user name prefix](/tidb-cloud/select-cluster-tier.md#user-name-prefix), and usages):

shiyuhang0 marked this conversation as resolved.
Show resolved Hide resolved
```shell
ticloud branch describe [flags]
```

Or use the following alias command:

```shell
ticloud branch get [flags]
```

## Examples

Get the branch information in interactive mode:

```shell
ticloud branch describe
```

Get the branch information in non-interactive mode:

```shell
ticloud branch describe --branch-id <branch-id> --cluster-id <cluster-id>
```

## Flags

In non-interactive mode, you need to manually enter the required flags. In interactive mode, you can just follow CLI prompts to fill them in.

| Flag | Description | Required | Note |
|-------------------------|-----------------------------------|----------|------------------------------------------------------|
| -b, --branch-id string | The ID of the branch | Yes | Only works in non-interactive mode. |
| -h, --help | Help information for this command | No | Works in both non-interactive and interactive modes. |
| -c, --cluster-id string | The cluster ID of the branch | Yes | Only works in non-interactive mode. |

## Inherited flags

| Flag | Description | Required | Note |
|----------------------|------------------------------------------------------------------------------------------------------|----------|--------------------------------------------------------------------------------------------------------------------|
| --no-color | Disables color in output. | No | Only works in non-interactive mode. In interactive mode, disabling color might not work with some UI components. |
| -P, --profile string | Specifies the active [user profile](/tidb-cloud/cli-reference.md#user-profile) used in this command. | No | Works in both non-interactive and interactive modes. |

## Feedback

If you have any questions or suggestions on the TiDB Cloud CLI, feel free to create an [issue](https://github.com/tidbcloud/tidbcloud-cli/issues/new/choose). Also, we welcome any contributions.
66 changes: 66 additions & 0 deletions tidb-cloud/ticloud-branch-list.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
title: ticloud branch list
summary: The reference of `ticloud branch list`.
---

# ticloud branch list

List all branches for a cluster:

```shell
ticloud branch list <cluster-id> [flags]
```

Or use the following alias command:

```shell
ticloud branch ls <cluster-id> [flags]
```

## Examples

List all branches for a cluster (interactive mode):

```shell
ticloud branch list
```

List all branches for a specified cluster (non-interactive mode):

```shell
ticloud branch list <cluster-id>
```

List all branches for a specified cluster in the JSON format:

```shell
ticloud branch list <cluster-id> -o json
```

## Args
shiyuhang0 marked this conversation as resolved.
Show resolved Hide resolved

Branch list command has the following arguments:
shiyuhang0 marked this conversation as resolved.
Show resolved Hide resolved

| Argument Index | Description | Required | Note |
|----------------|-----------------------------------------------------|----------|---------------------------------------|
| `<cluster-id>` | The cluster ID of the branches which will be listed | Yes | Only works in non-interactive mode. |

## Flags

In non-interactive mode, you need to manually enter the required flags. In interactive mode, you can just follow CLI prompts to fill them in.

| Flag | Description | Required | Note |
|---------------------|--------------------------------------------------------------------------------------------------------------------------|----------|------------------------------------------------------|
| -h, --help | Help information for this command | No | Works in both non-interactive and interactive modes. |
| -o, --output string | Output format (`human` by default). Valid values are `human` or `json`. To get a complete result, use the `json` format. | No | Works in both non-interactive and interactive modes. |

## Inherited flags

| Flag | Description | Required | Note |
|----------------------|------------------------------------------------------------------------------------------------------|----------|--------------------------------------------------------------------------------------------------------------------------|
| --no-color | Disables color in output. | No | Only works in non-interactive mode. In interactive mode, disabling color might not work with some UI components. |
| -P, --profile string | Specifies the active [user profile](/tidb-cloud/cli-reference.md#user-profile) used in this command. | No | Works in both non-interactive and interactive modes. |

## Feedback

If you have any questions or suggestions on the TiDB Cloud CLI, feel free to create an [issue](https://github.com/tidbcloud/tidbcloud-cli/issues/new/choose). Also, we welcome any contributions.
Loading
Loading