Skip to content
Merged
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
8 changes: 4 additions & 4 deletions course/environment/install-environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,14 +154,14 @@ port install zig
2. 安装 asdf [Zig 插件](https://github.com/asdf-community/asdf-zig):

```bash
asdf plugin-add zig https://github.com/asdf-community/asdf-zig.git
asdf plugin add zig https://github.com/asdf-community/asdf-zig.git
```

3. 安装完成后,便可使用 asdf 管理 Zig 版本。以下是一些常用命令:

```bash
# 列举所有可安装的版本
asdf list-all zig
asdf list all zig

# 安装指定版本的 Zig
asdf install zig <version>
Expand All @@ -170,8 +170,8 @@ asdf install zig <version>
asdf uninstall zig <version>

# 设置全局默认版本,会写到 $HOME/.tool-versions 文件
asdf global zig <version>
asdf set -u zig <version>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

asdf 的新版本中,asdf set 命令用于设置版本。要设置全局默认版本(写入 $HOME/.tool-versions),正确的参数是 --home,而 asdf set 并没有 -u 选项。使用 -u 会导致命令报错。

建议将其修改为 asdf set --home

Suggested change
asdf set -u zig <version>
asdf set --home zig <version>


# 设置当前目录使用的版本,会写到 $(pwd)/.tool-versions 文件
asdf local zig <version>
asdf set zig <version>
```
Loading