Skip to content

Commit f88e42e

Browse files
author
WaySLOG
committed
Merge pull request #171 from akfork/master
add multirust
2 parents 87bc79d + 820cb4b commit f88e42e

2 files changed

Lines changed: 94 additions & 0 deletions

File tree

02-install/02-04-multirust.md

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# Rust 版本管理工具: multirust
2+
3+
multirust 是一个简单的 Rust 版本管理工具.
4+
5+
项目主页是: <https://github.com/brson/multirust>
6+
7+
## Features
8+
9+
* 管理安装多个官方版本的 Rust 二进制程序.
10+
* 配置基于目录的 Rust 工具链.
11+
* 安装和更新来自 Rust 的发布通道: nightly, beta 和 stable.
12+
* 接收来自发布通道更新的通知.
13+
* 从官方安装历史版本的 nightly 工具链.
14+
* 通过指定 stable 版本来安装.
15+
* 安装额外的 std 用于交叉编译.
16+
* 安装自定义的工具链.
17+
* 独立每个安装的 Cargo metadata.
18+
* 校验下载的 hash 值.
19+
* 校验签名 (如果 GPG 存在).
20+
* 断点续传.
21+
* 只依赖 bash, curl 和常见 unix 工具.
22+
* 支持 Linux, OS X, Windows(via MSYS2).
23+
24+
## 安装
25+
26+
```
27+
curl -sf https://raw.githubusercontent.com/brson/multirust/master/blastoff.sh | sh
28+
```
29+
30+
这个命令将会编译和安装 multirust, 安装过程中可能会提示你输入 sudo 的密码. 然后, 他会下载和安装 stable 版本的工具链, 当执行 rustc, rustdoc 和 cargo 时, 将会配置他为默认工具链.
31+
32+
`*nix` 上安装后工具链会被安装到 `~/.multirust/toolchains`.
33+
34+
## 卸载
35+
36+
```
37+
curl -sf https://raw.githubusercontent.com/brson/multirust/master/blastoff.sh | sh -s -- --uninstall
38+
```
39+
40+
## 用法
41+
42+
安装后会得到一个 multirust 命令, 多使用命令自带的帮助提示, 可以快速定位你需要功能.
43+
44+
### 帮助
45+
46+
运行 `multirust -h` 你将会得到如下提示:
47+
48+
```
49+
❯ multirust -h
50+
# Usage: multirust <command> [--verbose] [--version]
51+
#
52+
# Commands:
53+
#
54+
# default Set the default toolchain
55+
# override Set the toolchain override for the current directory tree
56+
# update Install or update a given toolchain (for example, "stable", "beta", "nightly")
57+
# show-override Show information about the current override
58+
# show-default Show information about the current default
59+
# list-overrides List all overrides
60+
# list-toolchains List all installed toolchains
61+
# remove-override Remove an override, for current directory unless specified
62+
# remove-toolchain Uninstall a toolchain
63+
# list-available-targets
64+
# List targets available to install
65+
# add-target Add additional compilation targets to an existing toolchain
66+
# run Run a command in an environment configured for a toolchain
67+
# delete-data Delete all user metadata, including installed toolchains
68+
# upgrade-data Upgrade the ~/.multirust directory from previous versions
69+
# doc Open the documentation for the currently active toolchain
70+
# which Report location of the currently active Rust tool.
71+
# help Show help for this command or subcommands
72+
#
73+
# Use `multirust help <command>` for detailed help.
74+
#
75+
```
76+
77+
根据提示, 使用 `multirust help <command>` 来查看子命令的帮助, 基本看这些帮助文档就足够了.
78+
79+
下面着重介绍几个常用的命令.
80+
81+
`multirust default beta|stable|nightly` 配置默认的工具链.
82+
83+
`multirust override beta|stable|nightly` 配置一个目录以及其子目录的工具链.
84+
85+
`multirust show-default` 显示当前默认的工具链信息.
86+
87+
`multirust show-override` 显示当前目录的 override 的工具链信息.
88+
89+
`multirust list-toolchains` 显示所有安装的工具链.
90+
91+
`multirust list-overrides` 显示所有的 override 的工具链.
92+
93+
`multirust update` 更新所有的发布通道的工具链.

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ https://wayslog.gitbooks.io/rustprimer/content/
1919
1. [Linux](./02-install/02-01-install_rust_on_linux.md)
2020
2. [Mac](./02-install/02-02-install_rust_on_mac_os.md)
2121
3. [Windows](./02-install/02-03-install_rust_on_windows.md)
22+
4. [版本管理工具: multirust](./02-install/02-04-multirust.md)
2223
3. [编辑器](./03-editors/03-00-preface.md)
2324
1. [前期准备](./03-editors/03-01-before.md)「wayslog」
2425
1. [vim](./03-editors/03-02-vim.md)「wayslog」

0 commit comments

Comments
 (0)