Skip to content

Commit bf15b16

Browse files
authored
Merge pull request #35 from lixiaojun629/develop
ucloud 0.1.21
2 parents 8d41054 + dc018b6 commit bf15b16

840 files changed

Lines changed: 272261 additions & 144 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM ubuntu:18.04
2+
RUN apt-get update && apt-get install wget -y
3+
RUN wget https://github.com/ucloud/ucloud-cli/releases/download/0.1.20/ucloud-cli-linux-0.1.20-amd64.tgz
4+
RUN tar -zxf ucloud-cli-linux-0.1.20-amd64.tgz -C /usr/local/bin/
5+
RUN echo "complete -C $(which ucloud) ucloud" >> ~/.bashrc

Makefile

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
export VERSION=0.1.20
1+
export VERSION=0.1.21
22

3-
.PHONY : build
4-
build:
5-
go install && mv ${GOPATH}/bin/ucloud-cli /usr/local/bin/ucloud
3+
.PHONY : install
4+
install:
5+
go build -i -v -mod=vendor -o out/ucloud main.go
6+
cp out/ucloud /usr/local/bin
67

78
.PHONY : build_mac
89
build_mac:
@@ -25,7 +26,3 @@ build_windows:
2526
.PHONY : build_all
2627
build_all: build_mac build_linux build_windows
2728

28-
.PHONY : install
29-
install:
30-
go build -o out/ucloud main.go
31-
cp out/ucloud /usr/local/bin

README.md

Lines changed: 55 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,58 +5,99 @@
55
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.
66
https://docs.ucloud.cn/software/cli/index
77

8-
## Installing ucloud-cli
8+
## Installing ucloud-cli on macOS or Linux
99

1010
**Using Homebrew(Preferred)**
1111

12-
The [Homebrew](https://docs.brew.sh/Installation) package manager may be used on macOS, Linux and Windows Subsystem for Linux (WSL).
12+
The [Homebrew](https://docs.brew.sh/Installation) package manager may be used on macOS and Linux.
1313
It could install ucloud-cli and its dependencies automatically by running command below.
1414

1515
```
16-
$ brew install ucloud
16+
brew install ucloud
1717
```
1818

1919
If you have installed ucloud-cli already and want to upgrade to the latest version, just run:
2020

2121
```
22-
$ brew upgrade ucloud
22+
brew upgrade ucloud
2323
```
2424

2525
If you come across some errors during the installation via homebrew, please update the homebrew first and try again.
2626

2727
```
28-
$ brew update
28+
brew update
2929
```
3030

3131
If the error is still unresolved, try the following command for help.
3232

3333
```
34-
$ brew doctor
34+
brew doctor
3535
```
3636

3737
**Building from source**
3838

3939
If you have installed git and golang on your platform, you can fetch the source code of ucloud cli from github and complie it by yourself.
4040

4141
```
42-
$ git clone https://github.com/ucloud/ucloud-cli.git
43-
$ cd ucloud-cli
44-
$ make install
42+
git clone https://github.com/ucloud/ucloud-cli.git
43+
cd ucloud-cli
44+
make install
4545
```
4646

4747
**Downloading binary release**
4848

49-
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.
49+
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.
5050
Download the archive , check the shasum256 hashcode and extract it to your $PATH
5151

5252
For example
5353
```
54-
curl -OL https://github.com/ucloud/ucloud-cli/releases/download/0.1.14/ucloud-cli-macosx-0.1.14-amd64.tgz
55-
echo "6953232b20f3474973cf234218097006a2e0d1d049c115da6c0e09c103762d4d *ucloud-cli-macosx-0.1.14-amd64.tgz" | shasum -c
56-
tar zxf ucloud-cli-macosx-0.1.14-amd64.tgz -C /usr/local/bin/
54+
curl -OL https://github.com/ucloud/ucloud-cli/releases/download/0.1.20/ucloud-cli-macosx-0.1.20-amd64.tgz
55+
echo "6953232b20f3474973cf234218097006a2e0d1d049c115da6c0e09c103762d4d *ucloud-cli-macosx-0.1.20-amd64.tgz" | shasum -c
56+
tar zxf ucloud-cli-macosx-0.1.20-amd64.tgz -C /usr/local/bin/
5757
```
5858

59-
## Enabling Shell Auto-Completion
59+
## Installing ucloud cli on Windows
60+
61+
**Building from source**
62+
63+
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```
64+
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"
65+
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.
66+
Open CMD Terminal and run ```ucloud --version ``` to test installation.
67+
68+
69+
**Downloading binary release**
70+
71+
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.
72+
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)
73+
74+
## Using ucloud cli in a Docker container
75+
If you have installed docker on your platform, pull the docker image embeded ucloud cli by follow command.
76+
```
77+
docker pull uhub.service.ucloud.cn/ucloudcli/ucloud-cli:0.1.20
78+
```
79+
80+
The docker image was built by the Dockerfile as follow.
81+
```
82+
FROM ubuntu:18.04
83+
RUN apt-get update && apt-get install wget -y
84+
RUN wget https://github.com/ucloud/ucloud-cli/releases/download/0.1.20/ucloud-cli-linux-0.1.20-amd64.tgz
85+
RUN tar -zxf ucloud-cli-linux-0.1.20-amd64.tgz -C /usr/local/bin/
86+
RUN echo "complete -C $(which ucloud) ucloud" >> ~/.bashrc #enable auto completion
87+
```
88+
89+
Create a docker container named ucloud-cli using the docker image your have pulled by following command.
90+
91+
```
92+
docker run --name ucloud-cli -it -d uhub.service.ucloud.cn/ucloudcli/ucloud-cli:0.1.20
93+
```
94+
Run bash command in ucloud-cli container, and then you could play with ucloud cli.
95+
96+
```
97+
docker exec -it ucloud-cli bash
98+
```
99+
100+
## Enabling Shell Auto-Completion for bash or zsh shell user.
60101

61102
UCloud CLI also has auto-completion support. It can be set up so that if you partially type a command and then press TAB, the rest of the command is automatically filled in.
62103

0 commit comments

Comments
 (0)