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
The ucloud-cli provides a unified command line interface to manage Ucloud services. It works through Golang SDK based on UCloud OpenAPI and support Linux, macOS, and Windows.
6
8
7
-
You can install UCloud CLI by Homebrew/Linuxbrew, downloading executable binary file or building from the source code by yourself.
9
+
## Installation
8
10
9
-
##### Homebrew(recommended)
11
+
The easiest way to install ucloud-cli is to use home-brew for Linux and macOS users. This will install the package as well as all dependencies.
10
12
11
-
You can use [Homebrew](https://brew.sh/) on macOS or [Linuxbrew](http://linuxbrew.sh/) on Linux. After installing Homebrew or Linuxbrew,just type the following command to complete the installation.
12
13
```
13
-
brew install ucloud
14
+
$ brew install ucloud
14
15
```
15
-
##### Build from source code
16
16
17
-
If you have installed golang, run the following commands to install the UCloud CLI.
17
+
If you have the ucloud-cli installed and want to upgrade to the latest version you can run:
18
+
19
+
```
20
+
$ brew upgrade ucloud
21
+
```
22
+
23
+
**Note**
24
+
25
+
If you come across error during the installation via home-brew, you may update the management package first.
26
+
27
+
```
28
+
$ brew update
29
+
```
30
+
31
+
**Build from the source code**
32
+
33
+
For windows users, suggest build from the source code which require install Golang first. This also works for Linux and macOS.
18
34
19
35
```
20
36
$ mkdir -p $GOPATH/src/github.com/ucloud
@@ -24,26 +40,45 @@ $ cd ucloud-cli
24
40
$ make install
25
41
```
26
42
27
-
### Uninstall UCloud CLI
28
-
29
-
Remove the executable file /usr/local/bin/ucloud and the directory $HOME/.ucloud
30
-
31
-
### Config UCloud CLI
32
-
33
-
After install the cli, run 'ucloud init' to complete the cli configuration following the tips. Local settings will be saved in directory $HOME/.ucloud
43
+
## Command Completion
34
44
35
-
### Auto complete
36
-
Run 'ucloud --completion' for help
45
+
The ucloud-cli include command completion feature and need configure it manually. Add following scripts to ~/.bash_profile or ~/.bashrc
37
46
38
-
#### Bash shell
39
-
Please append the following scripts to file ~/.bash_profile or ~/.bashrc.
40
47
```
41
48
complete -C /usr/local/bin/ucloud ucloud
42
49
```
43
50
44
-
#### Zsh shell
45
-
Please append the following scripts to file ~/.zshrc.
51
+
**Zsh shell** please add following scripts to ~/.zshrc
52
+
46
53
```
47
54
autoload -U +X bashcompinit && bashcompinit
48
55
complete -F /usr/local/bin/ucloud ucloud
49
-
```
56
+
```
57
+
58
+
## Getting Started
59
+
60
+
Run the command to get started and configure ucloud-cli follow the steps. The public & private keys will be saved automatically and locally.
61
+
62
+
```
63
+
$ ucloud init
64
+
```
65
+
66
+
To reset the configurations, run the command:
67
+
68
+
```
69
+
$ ucloud config
70
+
```
71
+
72
+
To learn the usage and flags, run the command:
73
+
74
+
```
75
+
$ ucloud help
76
+
```
77
+
78
+
## Example
79
+
80
+
Taking configure globalssh to uhost instance as an example, which will acceleare the instance SSH management efficiency (TCP 22 as default):
81
+
82
+
```
83
+
$ ucloud gssh create --location Washington --target-ip 128.14.225.161
gsshIds=cmd.Flags().StringArray("resource-id", make([]string, 0), "Required. ID of the GlobalSSH instances you want to delete. Multiple values specified by multiple flags")
0 commit comments