Skip to content

Commit

Permalink
fix typo (#595)
Browse files Browse the repository at this point in the history
* chore: fix typo in code

* chore: fix tool names or registered trademarks

Docker
Codecov
Bash
Zsh

Also HTML is an acronym, so it has to be in uppercase

* documentation: fix Markdown fenced block identifier

some were using sh, zsh, most where using bash, some were missing

I updated to use shell everywhere
  • Loading branch information
ccoVeille authored May 30, 2024
1 parent e3b6eaf commit 412be00
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 74 deletions.
38 changes: 21 additions & 17 deletions README-zh_cn.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Air [![Go](https://github.com/cosmtrek/air/workflows/Go/badge.svg)](https://github.com/cosmtrek/air/actions?query=workflow%3AGo+branch%3Amaster) [![Codacy Badge](https://app.codacy.com/project/badge/Grade/dcb95264cc504cad9c2a3d8b0795a7f8)](https://www.codacy.com/gh/cosmtrek/air/dashboard?utm_source=github.com&utm_medium=referral&utm_content=cosmtrek/air&utm_campaign=Badge_Grade) [![Go Report Card](https://goreportcard.com/badge/github.com/cosmtrek/air)](https://goreportcard.com/report/github.com/cosmtrek/air) [![codecov](https://codecov.io/gh/cosmtrek/air/branch/master/graph/badge.svg)](https://codecov.io/gh/cosmtrek/air)
# Air [![Go](https://github.com/cosmtrek/air/workflows/Go/badge.svg)](https://github.com/cosmtrek/air/actions?query=workflow%3AGo+branch%3Amaster) [![Codacy Badge](https://app.codacy.com/project/badge/Grade/dcb95264cc504cad9c2a3d8b0795a7f8)](https://www.codacy.com/gh/cosmtrek/air/dashboard?utm_source=github.com&utm_medium=referral&utm_content=cosmtrek/air&utm_campaign=Badge_Grade) [![Go Report Card](https://goreportcard.com/badge/github.com/cosmtrek/air)](https://goreportcard.com/report/github.com/cosmtrek/air) [![Codecov](https://codecov.io/gh/cosmtrek/air/branch/master/graph/badge.svg)](https://codecov.io/gh/cosmtrek/air)

:cloud: 热重载 Go 应用的工具

Expand Down Expand Up @@ -28,17 +28,21 @@ Air 是为 Go 应用开发设计的另外一个热重载的命令行工具。只

如果你只是想配置构建命令和运行命令,您可以直接使用以下命令,而无需配置文件:

`air --build.cmd "go build -o bin/api cmd/run.go" --build.bin "./bin/api"`
```shell
air --build.cmd "go build -o bin/api cmd/run.go" --build.bin "./bin/api"
```

对于以列表形式输入的参数,使用逗号来分隔项目:

`air --build.cmd "go build -o bin/api cmd/run.go" --build.bin "./bin/api" --build.exclude_dir "templates,build"`
```shell
air --build.cmd "go build -o bin/api cmd/run.go" --build.bin "./bin/api" --build.exclude_dir "templates,build"
```

## 安装

### 推荐使用 install.sh

```bash
```shell
# binary 文件会是在 $(go env GOPATH)/bin/air
curl -sSfL https://raw.githubusercontent.com/cosmtrek/air/master/install.sh | sh -s -- -b $(go env GOPATH)/bin

Expand All @@ -54,15 +58,15 @@ P.S. 非常感谢 mattn 的 [PR](https://github.com/cosmtrek/air/pull/1),使

使用 Go 的版本为 1.22 或更高:

```bash
```shell
go install github.com/cosmtrek/air@latest
```

### Docker

请拉取这个 Docker 镜像 [cosmtrek/air](https://hub.docker.com/r/cosmtrek/air).

```bash
```shell
docker run -it --rm \
-w "<PROJECT>" \
-e "air_wd=<PROJECT>" \
Expand All @@ -74,7 +78,7 @@ docker run -it --rm \

例如,我的项目之一是在 Docker 上运行的:

```bash
```shell
docker run -it --rm \
-w "/go/src/github.com/cosmtrek/hub" \
-v $(pwd):/go/src/github.com/cosmtrek/hub \
Expand All @@ -88,26 +92,26 @@ docker run -it --rm \

首先,进入你的项目文件夹

```bash
```shell
cd /path/to/your_project
```

最简单的方法是执行

```bash
```shell
# 优先在当前路径查找 `.air.toml` 后缀的文件,如果没有找到,则使用默认的
air -c .air.toml
```

您可以运行以下命令初始化,把默认配置添加到当前路径下的`.air.toml` 文件。

```bash
```shell
air init
```

在这之后,你只需执行 `air` 命令,无需添加额外的变量,它就能使用 `.air.toml` 文件中的配置了。

```bash
```shell
air
```

Expand All @@ -117,7 +121,7 @@ air

您可以通过把变量添加在 air 命令之后来传递参数。

```bash
```shell
# 会执行 ./tmp/main bench
air bench

Expand All @@ -127,15 +131,15 @@ air server --port 8080

You can separate the arguments passed for the air command and the built binary with `--` argument.

```bash
```shell
# 会运行 ./tmp/main -h
air -- -h

# 会使用个性化配置来运行 air,然后把 -h 后的变量和值添加到运行的参数中
air -c .air.toml -- -h
```

### Docker-compose
### Docker Compose

```yaml
services:
Expand All @@ -161,7 +165,7 @@ services:

### 遇到 "command not found: air" 或 "No such file or directory" 该怎么办?

```zsh
```shell
export GOPATH=$HOME/xxxxx
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
export PATH=$PATH:$(go env GOPATH)/bin <---- 请确认这行在您的配置信息中!!!
Expand All @@ -171,7 +175,7 @@ export PATH=$PATH:$(go env GOPATH)/bin <---- 请确认这行在您的配置信

请注意:这需要 Go 1.16+ ,因为我使用 `go mod` 来管理依赖。

```bash
```shell
# 1. 首先复刻(fork)这个项目
# 2. 其次克隆(clone)它
Expand All @@ -191,7 +195,7 @@ make install

### 发布新版本

```bash
```shell
# 1. checkout 到 master 分支
git checkout master
Expand Down
52 changes: 28 additions & 24 deletions README-zh_tw.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# :cloud: Air - Live reload for Go apps

[![Go](https://github.com/cosmtrek/air/actions/workflows/release.yml/badge.svg)](https://github.com/cosmtrek/air/actions?query=workflow%3AGo+branch%3Amaster) [![Codacy Badge](https://app.codacy.com/project/badge/Grade/dcb95264cc504cad9c2a3d8b0795a7f8)](https://www.codacy.com/gh/cosmtrek/air/dashboard?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=cosmtrek/air&amp;utm_campaign=Badge_Grade) [![Go Report Card](https://goreportcard.com/badge/github.com/cosmtrek/air)](https://goreportcard.com/report/github.com/cosmtrek/air) [![codecov](https://codecov.io/gh/cosmtrek/air/branch/master/graph/badge.svg)](https://codecov.io/gh/cosmtrek/air)
[![Go](https://github.com/cosmtrek/air/actions/workflows/release.yml/badge.svg)](https://github.com/cosmtrek/air/actions?query=workflow%3AGo+branch%3Amaster) [![Codacy Badge](https://app.codacy.com/project/badge/Grade/dcb95264cc504cad9c2a3d8b0795a7f8)](https://www.codacy.com/gh/cosmtrek/air/dashboard?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=cosmtrek/air&amp;utm_campaign=Badge_Grade) [![Go Report Card](https://goreportcard.com/badge/github.com/cosmtrek/air)](https://goreportcard.com/report/github.com/cosmtrek/air) [![Codecov](https://codecov.io/gh/cosmtrek/air/branch/master/graph/badge.svg)](https://codecov.io/gh/cosmtrek/air)

![air](docs/air.png)

Expand Down Expand Up @@ -28,25 +28,29 @@ Air 是一個另類的自動重新編譯執行命令列工具,用於開發 Go

如果你想設定建置命令和執行命令,你可以在不需要配置檔案的情況下如下使用命令:

`air --build.cmd "go build -o bin/api cmd/run.go" --build.bin "./bin/api"`
```shell
air --build.cmd "go build -o bin/api cmd/run.go" --build.bin "./bin/api"`
```

對於需要輸入列表的參數,可以使用逗號將項目分隔:

`air --build.cmd "go build -o bin/api cmd/run.go" --build.bin "./bin/api" --build.exclude_dir "templates,build"`
```shell
air --build.cmd "go build -o bin/api cmd/run.go" --build.bin "./bin/api" --build.exclude_dir "templates,build"
```

## 安裝

### 使用 `go install` (推薦)

需要使用 go 1.22 或更高版本:

```bash
```shell
go install github.com/cosmtrek/air@latest
```

### 透過 install.sh

```bash
```shell
# binary will be $(go env GOPATH)/bin/air
curl -sSfL https://raw.githubusercontent.com/cosmtrek/air/master/install.sh | sh -s -- -b $(go env GOPATH)/bin
Expand All @@ -58,7 +62,7 @@ air -v

### 透過 [goblin.run](https://goblin.run)

```sh
```shell
# binary will be /usr/local/bin/air
curl -sSfL https://goblin.run/github.com/cosmtrek/air | sh
Expand All @@ -70,15 +74,15 @@ curl -sSfL https://goblin.run/github.com/cosmtrek/air | PREFIX=/tmp sh

使用 go 1.18 或更高版本:

```bash
```shell
go install github.com/cosmtrek/air@latest
```

### Docker/Podman

請讀取 Docker 映像檔 [cosmtrek/air](https://hub.docker.com/r/cosmtrek/air).

```bash
```shell
docker/podman run -it --rm \
-w "<PROJECT>" \
-e "air_wd=<PROJECT>" \
Expand All @@ -90,9 +94,9 @@ docker/podman run -it --rm \

#### Docker/Podman .${SHELL}rc

如果你想像常規應用程式一樣持續使用 air,你可以在你的 ${SHELL}rc (bash,zsh, etc...) 中創建一個函數。
如果你想像常規應用程式一樣持續使用 air,你可以在你的 ${SHELL}rc (Bash, Zsh, etc) 中創建一個函數。

```bash
```shell
air() {
podman/docker run -it --rm \
-w "$PWD" -v "$PWD":"$PWD" \
Expand All @@ -106,19 +110,19 @@ air() {
<details>
<summary>For example</summary>

我其中一個專案是在 docker 中運行
我其中一個專案是在 Docker 中運行

```bash
```shell
docker run -it --rm \
-w "/go/src/github.com/cosmtrek/hub" \
-v $(pwd):/go/src/github.com/cosmtrek/hub \
-p 9090:9090 \
cosmtrek/air
```

另一個例子

```bash
```shell
cd /go/src/github.com/cosmtrek/hub
AIR_PORT=8080 air -c "config.toml"
```
Expand All @@ -133,26 +137,26 @@ AIR_PORT=8080 air -c "config.toml"

首先,進入你的專案目錄

```bash
```shell
cd /path/to/your_project
```

最簡單的使用方式是運行

```bash
```shell
# firstly find `.air.toml` in current directory, if not found, use defaults
air -c .air.toml
```

你可以用以下命令初始化 `.air.toml` 配置檔到當前目錄,並使用預設設置。

```bash
```shell
air init
```

此後,你可以只運行 `air` 命令,而不需要額外的參數,它將使用 `.air.toml` 檔案作為配置。

```bash
```shell
air
```

Expand All @@ -162,7 +166,7 @@ air

你可以在 air 命令後添加參數來運行已構建的二進制檔。

```bash
```shell
# Will run ./tmp/main bench
air bench
Expand All @@ -172,15 +176,15 @@ air server --port 8080

你可以使用 `--` 參數來分隔傳遞給 air 命令和已建構的二進制檔的參數。

```bash
```shell
# Will run ./tmp/main -h
air -- -h
# Will run air with custom config and pass -h argument to the built binary
air -c .air.toml -- -h
```

### Docker-compose
### Docker Compose

```yaml
services:
Expand Down Expand Up @@ -241,7 +245,7 @@ services:

### "找不到命令:air" 或者 "找不到檔案或目錄"

```zsh
```shell
export GOPATH=$HOME/xxxxx
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
export PATH=$PATH:$(go env GOPATH)/bin <---- Confirm this line in you profile!!!
Expand All @@ -255,7 +259,7 @@ export PATH=$PATH:$(go env GOPATH)/bin <---- Confirm this line in you profile!!!
請注意,由於我使用 `go mod` 來管理依賴,所以需要 Go 1.16+。
```bash
```shell
# Fork this project
# Clone it
Expand All @@ -275,7 +279,7 @@ make install
### 發佈版本
```bash
```shell
# Checkout to master
git checkout master
Expand Down
Loading

0 comments on commit 412be00

Please sign in to comment.