Skip to content

Commit 5fad18f

Browse files
committed
0.1.4
Update README.md update readme
1 parent 1cbc80f commit 5fad18f

5 files changed

Lines changed: 72 additions & 29 deletions

File tree

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export VERSION=0.1.3
1+
export VERSION=0.1.4
22

33
.PHONY : build
44
build:

README.md

Lines changed: 58 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,36 @@
1-
## UCloud Command Line Interface
1+
## <u>ucloud-cli
2+
3+
- website: https://www.ucloud.cn/
24

3-
The UCloud Command Line Interface is a tool to manage your UCloud services. It's built on the [UCloud API](https://docs.ucloud.cn/api/summary/index).
5+
![](http://cli-ucloud-logo.sg.ufileos.com/ucloud.png)
46

5-
### Install UCloud CLI
7+
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.
68

7-
You can install UCloud CLI by Homebrew/Linuxbrew, downloading executable binary file or building from the source code by yourself.
9+
## Installation
810

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.
1012

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.
1213
```
13-
brew install ucloud
14+
$ brew install ucloud
1415
```
15-
##### Build from source code
1616

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.
1834

1935
```
2036
$ mkdir -p $GOPATH/src/github.com/ucloud
@@ -24,26 +40,45 @@ $ cd ucloud-cli
2440
$ make install
2541
```
2642

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
3444

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
3746

38-
#### Bash shell
39-
Please append the following scripts to file ~/.bash_profile or ~/.bashrc.
4047
```
4148
complete -C /usr/local/bin/ucloud ucloud
4249
```
4350

44-
#### Zsh shell
45-
Please append the following scripts to file ~/.zshrc.
51+
**Zsh shell** please add following scripts to ~/.zshrc
52+
4653
```
4754
autoload -U +X bashcompinit && bashcompinit
4855
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
84+
```

base/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616
const configFile = "config.json"
1717

1818
//Version 版本号
19-
const Version = "0.1.3"
19+
const Version = "0.1.4"
2020

2121
//ConfigPath 配置文件路径
2222

cmd/globalssh.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ func NewCmdGsshCreate() *cobra.Command {
155155
Use: "create",
156156
Short: "Create GlobalSSH instance",
157157
Long: "Create GlobalSSH instance",
158-
Example: "ucloud gssh create --area Washington --target-ip 8.8.8.8",
158+
Example: "ucloud gssh create --location Washington --target-ip 8.8.8.8",
159159
Run: func(cmd *cobra.Command, args []string) {
160160
port := *req.Port
161161
for code, area := range areaCodeMap {
@@ -200,7 +200,7 @@ func NewCmdGsshDelete() *cobra.Command {
200200
Use: "delete",
201201
Short: "Delete GlobalSSH instance",
202202
Long: "Delete GlobalSSH instance",
203-
Example: "ucloud gssh delete --id uga-xx1 --id uga-xx2",
203+
Example: "ucloud gssh delete --resource-id uga-xx1 --id uga-xx2",
204204
Run: func(cmd *cobra.Command, args []string) {
205205
for _, id := range *gsshIds {
206206
req.InstanceId = &id
@@ -217,7 +217,7 @@ func NewCmdGsshDelete() *cobra.Command {
217217
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")
218218
req.ProjectId = cmd.Flags().String("project-id", ConfigInstance.ProjectID, "Optional. Assign project-id")
219219
req.Region = cmd.Flags().String("region", ConfigInstance.Region, "Optional. Assign region")
220-
cmd.MarkFlagRequired("id")
220+
cmd.MarkFlagRequired("resource-id")
221221
return cmd
222222
}
223223

@@ -231,7 +231,7 @@ func NewCmdGsshModify() *cobra.Command {
231231
Use: "update",
232232
Short: "Update GlobalSSH instance",
233233
Long: "Update GlobalSSH instance, including port and remark attribute",
234-
Example: "ucloud gssh update --id uga-xxx --port 22",
234+
Example: "ucloud gssh update --resource-id uga-xxx --port 22",
235235
Run: func(cmd *cobra.Command, args []string) {
236236
gsshModifyPortReq.Region = sdk.String(region)
237237
gsshModifyPortReq.ProjectId = sdk.String(project)

cmd/uhost.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,14 @@ func NewCmdUHostDelete() *cobra.Command {
252252
Short: "Delete Uhost instance",
253253
Long: "Delete Uhost instance",
254254
Run: func(cmd *cobra.Command, args []string) {
255+
sure, err := ux.Prompt("Are you sure you want to delete this host? (y/n):")
256+
if err != nil {
257+
Cxt.Println(err)
258+
return
259+
}
260+
if !sure {
261+
return
262+
}
255263
if *isDestory {
256264
req.Destroy = sdk.Int(1)
257265
} else {

0 commit comments

Comments
 (0)