2.0.7 |
|
---|---|
2.0.6 |
|
2.0.4 |
|
2.0.2 |
|
1.0.20 |
|
#8 in #rls
每月 79 次下载
41KB
876 行
cargo-rls-install
目的
Rust 语言服务器简易安装
每晚,我都会寻找一个可以使用 RLS 的日子,它可能已经损坏。
为了实现这一点,这个程序会去查看 页面,这是 mexus 的脚本每天更新,并进行抓取。
如果一开始我们没有 mexus 页面,我们就不会创建 Cargo 子命令,
也没有使用 Rust 的意愿。
安装
cargo install cargo-rls-install
安装准备(仅限 Linux)
对于 Linux,安装时需要安装 OpenSSL。
# Ubuntu or Debian
sudo apt install libssl-dev
# WSL(Windows Subsystem for Linux)
sudo apt install libssl-dev
sudo apt install build-essential
sudo apt install pkg-config
# RedHut
sudo yum install openssl-devel
# RedHut(Fedora etc.)
sudo dnf install openssl
用法
cargo rls-install [FLAGS] [OPTIONS]
示例1
上述命令执行了三个操作。
- Rust 语言(Nightly 频道)安装。
- 更改默认工具链。
- RLS(Rust 语言服务器)安装。
在执行每个操作之前,会询问是否执行它。
cargo rls-install -n # --nightly
示例2
直到最后,所有操作都无需批准即可完成。
cargo rls-install -ny # --nightly --yes
示例3
安装稳定版 Rust、RLS 并更改默认工具链。
cargo rls-install -s # --stable
示例4
安装 Beta 版 Rust、RLS 并更改默认工具链。
cargo rls-install -b # --beta
示例5
在所有 Rust 频道上安装 RLS。
默认工具链是 Nightly Rust,因为在 Nightly Rust 上的最后一个操作已完成。
cargo rls-install -ysbn
示例6(v1.0.17-)
检查 Rust 和 RLS 的构建状态。
此命令旨在单独使用。
cargo rls-install -v # --view
# or
cargo rls-install view # v2.0.6-
示例7(v1.0.23-)
安装指定的组件。使用 rustup component add
命令。
# example: rustfmt
cargo rls-install -c rustfmt # --component-add rustfmt
示例8(v1.0.25-)
注意:更改选定的 Rust 频道到默认工具链。使用 rustup default
命令。如果您指定 cargo rls-instrall -d n
,则指定最新日期的 Nightly Rust 作为默认工具链。
# Use stable
cargo rls-install -d s
# Use beta
cargo rls-install -d b
# Use target beta(v1.0.28-)
cargo rls-install -d beta-2019-05-19
# Use nightly
cargo rls-install -d nightly
# Use latest nightly rust toolchain
cargo rls-install -d n
# Use target nightly rust toolchain
cargo rls-install -d nightly-2019-05-21
示例9(v1.0.28-)
卸载选定的Rust通道。使用rustup uninstall
命令。
注意:最新的夜间构建的Rust和默认的工具链不支持卸载。
# Uninstall stable
cargo rls-install -u s
# Uninstall beta
cargo rls-install -u b
# Uninstall target beta
cargo rls-install -u beta-2019-05-19
# Uninstall nightly
cargo rls-install -u n
# Uninstall target nightly
cargo rls-install -u nightly-2019-5-21
# Uninstall all but the latest nightly rust dated
cargo rls-install -u a # a or all
示例10(v2.0.4-)
夜间构建的Rust将在您选择的时间安装。
cargo rls-install -i nightly-2020-03-19
示例11(v2.0.5-)
显示已安装的工具链。使用rustup show
命令。
cargo rls-install show
示例12(v2.0.5-)
安装格式化工具:clippy和rustfmt。使用rustup component add
命令。
cargo rls-install formatter
标志
USAGE:
cargo rls-install [FLAGS] [OPTIONS]
FLAGS:
-b, --beta Install beta channel Rust and RLS
-h, --help Prints help information
-i, --install Install user specified target nightly channel
-n, --nightly Install nightly channel Rust and RLS
-s, --stable Install stable channel Rust and RLS
-V, --version Prints version information
-v, --view RLS build status view
-y, --yes Pre-approval: Install Rust, RLS and change toolchain
OPTIONS:
-c, --component-add <component> Wrapper(rustup component add)
-d, --default-toolchain <default> Wrapper(rustup default)
-u, --uninstall-toolchain <uninstall> Wrapper(rustup uninstall)
SUBCOMMANDS:
formatter Install clippy and rustfmt
help Prints this message or the help of the given subcommand(s)
show Wrapper(rustup show)
view RLS build status view
特别感谢
依赖项
~8–15MB
~213K SLoC