Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 28 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,21 @@ _✨ NoneBot2 命令行工具 ✨_

### 安装

使用 pipx 安装
#### 使用 pipx 安装

```shell
pipx install nb-cli
```

使用 Docker 运行
#### 使用 uv 安装

```shell
uv tool install nb-cli@latest
```

其中 `latest` 可以更改为指定的 CLI 版本

#### 使用 Docker 安装

```shell
docker pull nonebot/nb-cli:latest
Expand Down Expand Up @@ -106,7 +114,15 @@ nb --help
- `nb self` 管理 CLI 内部环境
- `nb <script>` 运行脚本

Docker 镜像使用
#### uv tool 使用

```shell
uvx --from nb-cli@latest nb --help
# 或
uv tool run --from nb-cli nb --help
```

#### Docker 镜像使用

```shell
docker run --rm -it -v ./:/workspaces nonebot/nb-cli:latest --help
Expand All @@ -120,7 +136,15 @@ docker run --rm -it -v ./:/workspaces nonebot/nb-cli:latest --help
nb
```

Docker 镜像使用
#### uv tool 使用

```shell
uvx --from nb-cli@latest nb
# 或
uv tool run --from nb-cli nb
```

#### Docker 镜像使用

```shell
docker run --rm -it -v ./:/workspaces nonebot/nb-cli:latest
Expand Down
34 changes: 34 additions & 0 deletions website/docs/guide/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,37 @@ pipx upgrade nb-cli
```shell title="卸载 NoneBot CLI"
pipx uninstall nb-cli
```

## 通过 uv tool 安装

uv (by Astral) 是一个飞快的 Python 包与项目管理器,使用 Rust 语言编写。其也拥有工具集成管理的功能。

请参考 [uv 文档](https://docs.astral.sh/uv/getting-started/installation/) 来安装 uv。

```shell title="直接运行最新 NoneBot CLI"
uvx --from nb-cli@latest nb

# 指定 Python 版本(如 3.12)
uvx -p 3.12 --from nb-cli@latest nb
```

```shell title="安装 NoneBot CLI"
uv tool install nb-cli@latest

# 指定 Python 版本(如 3.12)
uv tool install -p 3.12 nb-cli@latest
```

```shell title="运行已安装的 NoneBot CLI"
uvx --from nb-cli nb
# 或
uv tool run --from nb-cli nb
```

```shell title="升级 NoneBot CLI"
uv tool upgrade nb-cli
```

```shell title="卸载 NoneBot CLI"
uv tool uninstall nb-cli
```