You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+48-13Lines changed: 48 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,10 @@
1
+
English | [简体中文](./README-CN.md)
2
+
1
3
## UCloud CLI
2
4
3
5

4
6
5
-
The UCloud CLI provides a unified command line interface to UCloud services. It works on Golang SDK based on UCloud OpenAPI and supports Linux, macOS and Windows.
7
+
The UCloud CLI provides a unified command line interface to UCloud services. It works on [ucloud-sdk-go](https://github.com/ucloud/ucloud-sdk-go) based on UCloud OpenAPI and supports Linux, macOS and Windows.
6
8
https://docs.ucloud.cn/software/cli/index
7
9
8
10
## Installing ucloud-cli on macOS or Linux
@@ -54,7 +56,7 @@ make install
54
56
55
57
**Downloading binary release(Recommended on Linux)**
56
58
57
-
Vist the [releases page](https://github.com/ucloud/ucloud-cli/releases) of ucloud cli, and find the appropriate archive for your operating system and architecture.
59
+
Visit the [releases page](https://github.com/ucloud/ucloud-cli/releases) of ucloud cli, and find the appropriate archive for your operating system and architecture.
58
60
Download the archive , check the shasum256 hashcode and extract it to your $PATH
59
61
60
62
For example
@@ -68,8 +70,8 @@ tar zxf ucloud-cli-linux-0.1.22-amd64.tgz -C /usr/local/bin/
68
70
69
71
**Building from source**
70
72
71
-
Download the source code of ucloud cli from [releases page](https://github.com/ucloud/ucloud-cli/releases). You can also download it by running ```git clone https://github.com/ucloud/ucloud-cli.git```
72
-
Ensure you have git installed, because go will download packages using git. Go to the directory of the source code, and then compile the source code by running "go build -mod=vendor -o ucloud.exe"
73
+
Download the source code of ucloud cli from [releases page](https://github.com/ucloud/ucloud-cli/releases) and extract it. You can also download it by running ```git clone https://github.com/ucloud/ucloud-cli.git```
74
+
Go to the directory of the source code, and then compile the source code by running ```go build -mod=vendor -o ucloud.exe```
73
75
After that add ucloud.exe to your environment variable PATH. You could follow [this document](https://www.java.com/en/download/help/path.xml) if you don't know how to do.
74
76
Open CMD Terminal and run ```ucloud --version ``` to test installation.
75
77
@@ -80,7 +82,7 @@ Vist the [releases page](https://github.com/ucloud/ucloud-cli/releases) of uclou
80
82
Download the archive , and extract it. Add binary file ucloud.exe to your environment variable PATH following [this document](https://www.java.com/en/download/help/path.xml)
81
83
82
84
## Using ucloud cli in a Docker container
83
-
If you have installed docker on your platform, pull the docker image embeded ucloud cli by follow command. Lookup Dockerfile from [here](./Dockerfile)
85
+
If you have installed docker on your platform, pull the docker image embedded ucloud cli by follow command. Lookup Dockerfile from [here](./Dockerfile)
@@ -102,15 +104,15 @@ UCloud CLI also has auto-completion support. It can be set up so that if you par
102
104
103
105
**Bash shell**
104
106
105
-
Add following scripts to ~/.bash_profile or ~/.bashrc
107
+
Add following scripts to ~/.bash_profile or ~/.bashrc and then restart your terminal or run ```source <~/.bash_profile|~/.bashrc>```
106
108
107
109
```
108
110
complete -C $(which ucloud) ucloud
109
111
```
110
112
111
113
**Zsh shell**
112
114
113
-
Add following scripts to ~/.zshrc
115
+
Add following scripts to ~/.zshrc and then restart your terminal or run ```source ~/.zshrc```
114
116
115
117
```
116
118
autoload -U +X bashcompinit && bashcompinit
@@ -132,17 +134,45 @@ compctl -K _ucloud ucloud
132
134
133
135
## Setup configuration
134
136
135
-
Run the command below to get started and configure ucloud-cli. The private key and public key will be saved automatically and locally to directory ~/.ucloud.
136
-
You can delete the directory whenever you want.
137
+
The UCloud CLI supports using any of multiple named profiles that are stored in config.json and credential.json files which located in ~/.ucloud.
138
+
You can configure additional profiles by using ```ucloud config add``` with the --profile flag, or by adding entries to the config.json and credential.json files.
139
+
ucloud init will add profile named default if you do not have an active profile, and it does its best to reduce configuration items for first-time use of ucloud-cli.
140
+
141
+
There are 10 configuration items
142
+
143
+
- Profile: name of the profile, duplicated names are not allowed. It can be override by --profile flag
144
+
- Active: Whether to take effect, Only one profile is active
145
+
- ProjectID: ID of default project, and it can be override by --project-id flag
146
+
- Region: default region, it can be override by --region flag
147
+
- Zone: default zone, it can be override by --zone flag
148
+
- BaseURL: default url of UCloud Open API, it can be override by --base-url flag
149
+
- Timeout: default timeout value of querying UCloud Open API, unit second. It can be override by --timeout flag
150
+
- PublicKey: public key of your account. It can be override by --public-key flag
151
+
- PrivateKey: private key of your account. It can be override by --private-key flag
152
+
- MaxRetryTimes: default max retry times for failed API request. It only works for idempotent APIs which can be called many times without side effect, for example 'ReleaseEIP', and it can be override by --max-retry-times flag
137
153
154
+
Run the command below to get started and configure ucloud-cli.
138
155
```
139
156
$ ucloud init
140
157
```
158
+
List all profiles (for example)
159
+
```
160
+
$ ucloud config list
141
161
142
-
To reset the configurations, run:
162
+
Profile Active ProjectID Region Zone BaseURL Timeout PublicKey PrivateKey MaxRetryTimes
0 commit comments