13 个版本 (7 个重大更新)
新 0.8.0 | 2024 年 8 月 18 日 |
---|---|
0.7.0 | 2024 年 5 月 26 日 |
0.6.0 | 2024 年 2 月 26 日 |
0.4.1 | 2023 年 9 月 21 日 |
0.2.1 | 2022 年 11 月 25 日 |
#27 在 Cargo 插件 中
每月 390 次下载
205KB
4K SLoC
car·go·lin·er, noun
- 在指定港口之间定期航行的货轮。
摘要
Cargo Liner 是一个工具,帮助用户通过官方 cargo install
命令安装和更新当前已安装或将要安装的包,通过编辑位于 $CARGO_HOME/liner.toml
的一个小型且稳定的配置文件来实现。
目标
- 简单直观的 API。
- 稳定的配置文件:避免自动编辑。
- 实际使用
cargo install
、cargo search
或cargo config get
,以及很少的其他操作。
非目标
- 超级稳定性保证。
- 为小型功能重新实现 Cargo 的一半。
- “美观”是最重要的。
- 处理配置文件在不同主机之间的同步。
理由
cargo install
可以很好地下载、编译和安装二进制包。然而,它并没有提供更新已安装程序的方法,无需在CLI上逐个指定。当需要维护多个包时,这会很快变得麻烦,尤其是在多个工作站上执行时。
一些项目,如 cargo-update 或 cargo-updater,就是为了解决这个问题而存在的。它们的策略是利用 Cargo 生成的和维持的 $CARGO_HOME/.crates.toml
和 $CARGO_HOME/.crates2.json
文件来跟踪已安装的包、它们的版本、下载位置以及它们安装了哪些程序。这种方法相当有效,所以如果你正好需要这些,那么可以检查它们。
然而,一些问题仍未得到解决,例如:配置新工作站时,仍然至少需要手动指定每个包一次;在已配置工作站上添加新包时,仍然需要在所有其他工作站上手动安装。这些工具缺乏 共享 和 同步 功能。
因此,当前项目从诸如 zplug(用于 Zsh)和 vim-plug(用于 Vim)等工具中汲取灵感,通过一个中心配置文件来下达命令。然后,该工具简单地运行 cargo search
来检索该文件中列出的所有包的最新版本,然后使用搜索结果执行 cargo install
以安装或更新需要安装或更新的包。这使人们能够安装和维护所有包的更新,同时还能够通过某种方式(例如使用 Git)在所有工作站之间共享文件以保持同步。
安装
-
运行:
cargo install cargo-liner
。 -
创建配置文件,位于:
$CARGO_HOME/liner.toml
。- 如果您在查找目录时遇到困难,请参阅有关 Cargo Home 的参考文档。
-
如果您使用的是与
$CARGO_HOME
不同的 Cargo 安装根,请确保在环境变量$CARGO_INSTALL_ROOT
或$CARGO_HOME/config.toml
文件的install.root
键中正确配置,以便当前工具能够自行检测到这一点。有关此方面的更多信息,请参阅cargo install
文档。 -
在文件中添加您希望安装的包,例如
[packages] cargo-expand = "*" cargo-tarpaulin = "~0.22" nu = "=0.71.0" ripgrep = { version = "13.0.0", all-features = true } [packages.sqlx-cli] version = "0.6.2" default-features = false features = ["native-tls", "postgres"]
或使用
cargo liner import
自动为您完成,以下将提供更详细的说明。
用法
配置
该文件必须位于 $CARGO_HOME/liner.toml
,并包含一个正确格式的TOML文档,遵循以下格式:
[packages]
package-name-1 = "version-req-1"
package-name-2 = "version-req-2"
[packages.package-name-3]
version = "version-req-3"
all-features = boolean
default-features = boolean
features = ["feature-1", "feature-2"]
index = "http://example.com/"
registry = "example-registry"
git = "http://example.com/exa/mple.git"
branch = "branch"
tag = "tag"
rev = "SHA1"
path = "/a/b/c"
bins = ["bin1", "bin2"]
all-bins = boolean
examples = ["ex1", "ex2"]
all-examples = boolean
force = boolean
ignore-rust-version = boolean
frozen = boolean
locked = boolean
offline = boolean
extra-arguments = ["--arg1", "--arg2"]
environment = { ENV1 = "abc", ENV2 = "def" }
skip-check = boolean
no-fail-fast = boolean
#...
[defaults]
[defaults.ship]
no-self = boolean
only-self = boolean
skip-check = boolean
no-fail-fast = boolean
force = boolean
其中:
-
packages
(必需):包名称到包详细信息的映射,指示安装或更新包的方式version
(必需):安装或更新相关包时使用的版本要求字符串;这是仅使用简单配置风格时设置的详细字段。all-features
(可选):布尔值,当设置为true
时,启用--all-features
标志,该标志用于cargo install
。default-features
(可选):布尔值,当设置为false
时,启用--no-default-features
标志,该标志用于cargo install
。features
(可选):字符串列表,指示在构建相关crate时应该启用哪些Cargo特性。index
(可选):指定安装的注册表索引的字符串。registry
(可选):指定要使用的注册表的字符串。git
(可选):指定安装的Git URL的字符串。branch
(可选):指定从Git安装时要使用的分支的字符串。tag
(可选):指定从Git安装时要使用的标签的字符串。rev
(可选):指定从Git安装时要使用的提交的字符串。path
(可选):指定要安装的本地crate的文件系统路径的字符串。bins
(可选):指定在目标crate的binary targets中要安装的binaries的字符串列表,传递给Cargo作为其--bin
选项的重复。all-bins
(可选):布尔值,当设置为true
时,将--bins
CLI 选项传递给Cargo,从而安装包中的所有二进制文件。examples
(可选):指定在目标crate的example targets中要安装的examples的字符串列表,传递给Cargo作为其--example
选项的重复。all-examples
(可选):布尔值,当设置为true
时,将--examples
CLI 选项传递给Cargo,从而安装包中的所有示例。force
(可选):布尔值,当设置为true
时,将--force
传递给Cargo,从而可能覆盖现有的二进制文件或示例;只有当同时传递--skip-check
时才有用。ignore-rust-version
(可选):布尔值,当设置为true
时,将--ignore-rust-version
CLI 选项传递给Cargo,从而忽略包中的rust-version
规范。frozen
(可选):布尔值,当设置为true
时,将--frozen
CLI 选项传递给Cargo,从而要求包的Cargo.lock
和Cargo的缓存都必须是最新的。locked
(可选):布尔值,当设置为true
时,将--locked
CLI 选项传递给Cargo,从而要求包的Cargo.lock
必须是最新的。offline
(可选): 当设置为true
时,将--offline
命令行选项传递给 Cargo,从而要求 Cargo 在不访问网络的情况下运行;只有当同时传递--skip-check
时才能使用。extra-arguments
(可选): 作为附加参数传递给cargo install
的字符串列表,用于关联的包,位于 Cargo Liner 提供的最后一个参数之后和用于将选项与固定参数分开的下一个--
之间。这可以用来管理一个使用尚未实现所需选项的 Cargo Liner 版本的包。environment
(可选): 用于指定为cargo install
进程设置的环境变量的字符串到字符串的映射。skip-check
(可选): 当设置为true
时,将关联的包排除在版本检查之外,并始终将其包括在要安装或更新的包中。这是 CLI 中的--skip-check
的直接等效,除了 CLI 的全局性是所有包都将排除在版本检查之外,而配置的是部分性的,只关注相关的包。它可以用来充分利用两种执行模式:如果一个包在某些方面出现问题,可以使用此选项,而其他包保持不变。CLI 选项具有优先级:如果设置,则任何版本检查步骤都将完全跳过,这应该比将配置选项设置为所有列出的包更有力。no-fail-fast
(可选): 当设置为true
时,使操作继续进行,就像提供了--no-fail-fast
一样,但仅针对关联的包:在调用cargo install
时发生错误的情况下,操作将不会在这里停止,而是继续执行下一个包,但如果下一个包没有在其配置中设置此选项并且安装失败,操作仍然会突然失败。CLI 选项具有优先级:如果设置,则相当于为所有列出的包设置了配置选项。
-
defaults
(可选): 映射的映射,用于在运行某些操作时设置默认值;它们按 CLI 命令分组ship
(可选): 与同名的 CLI 命令对应的字符串到布尔值的映射no-self
(可选): 当设置为true
时,默认启用--no-self
标志。only-self
(可选): 当设置为true
时,默认启用--only-self
标志。skip-check
(可选): 当设置为true
时,默认启用--skip-check
标志。no-fail-fast
(可选): 当设置为true
时,默认启用--no-fail-fast
标志。force
(可选): 当设置为true
时,默认启用--force
标志。
以下是一些约束条件,主要由Cargo执行,但也由TOML执行。
package-name-*
必须是一个有效的包名,即匹配[a-zA-Z][a-zA-Z0-9_-]*
或类似的模式。version-req-*
必须是一个有效的SemVer要求,Cargo风格。特别是,可以使用通配符*
来要求最新版本。feature-*
必须是正在安装的包中定义的Cargo功能的名称,它具有类似于包名的约束;特别是,它不应包含逗号。--arg*
必须是cargo install
命令行参数的名称。ENV*
应该是cargo install
环境变量的名称。boolean
是TOML布尔值,可以是true
或false
。
有关CLI标志、环境变量和配置项之间的关联,请参阅以下CLI文档。CLI优先于环境,环境优先于配置。
CLI
有一些命令可用
$ cargo help liner
Cargo subcommand to install and update binary packages listed in
configuration.
Usage: cargo liner [OPTIONS] [COMMAND]
Commands:
ship The default command if omitted: install and update
configured packages
import Import the `$CARGO_HOME/.crates.toml` Cargo-edited
save file as a new Liner configuration file
completions Generate an auto-completion script for the given shell
help Print this message or the help of the given
subcommand(s)
Options:
-v, --verbose...
Be more verbose. Use multiple times to be more and more so
each time.
When omitted, INFO and above messages of only this crate
are logged. When used once, DEBUG and above messages of
only this crate are logged and error backtraces are shown
(`RUST_BACKTRACE=1`). When used twice, DEBUG and above
messages of all crates are logged, `-v` is given to Cargo
calls (details ran commands), and error backtraces are
fully shown (`RUST_BACKTRACE=full`). When used three times
or more, TRACE and above messages of all crates are logged,
`-vv` is given to Cargo calls (includes build output) and
error backtraces are fully shown (`RUST_BACKTRACE=full`).
This takes precedence over the environment.
-q, --quiet...
Be quieter. Use multiple times to be more and more so each
time.
When omitted, INFO and above messages of only this crate
are logged. When used once, WARN and above messages of only
this crate are logged. When used twice, ERROR messages of
all crates are logged. When used three times or more, no
message will be logged, including Cargo's by passing `-q`
to it and error reports are silenced. This takes precedence
over the environment.
--color <WHEN>
Control the coloring of the logging output.
This enables one to manually specify when should the logs
and error reports be colored or not, for example if the
automatic detection is either not wished or not functional.
The value is also passed onto calls to Cargo.
[default: auto]
[possible values: auto, always, never]
-h, --help
Print help (see a summary with '-h')
-V, --version
Print version
默认命令
当省略子命令时,它将使用带有默认选项的ship
子命令。有关更多详细信息,请参阅其具体文档。
只需运行cargo liner
即可
- 从配置文件中读取包。
- 从Cargo的安装中检测当前已安装的包。
- 检查它们的最新版本。
- 安装或更新需要更新的包,同时遵守版本要求。
- 自我更新。
如果需要bat
和cargo-expand
的示例输出
$ cargo liner
INFO cargo_liner::cargo > Fetching latest package versions...
...
INFO cargo_liner > Results:
┌──────────────┬─────────────┬─────────────┬────────┐
│ Name │ Old version │ New version │ Status │
├──────────────┼─────────────┼─────────────┼────────┤
│ bat │ ø │ 0.24.0 │ 🛈 │
│ cargo-expand │ 1.0.78 │ 1.0.79 │ 🛈 │
│ cargo-liner │ 0.0.0 │ ø │ ✔ │
└──────────────┴─────────────┴─────────────┴────────┘
INFO cargo_liner::cargo > Installing `bat`...
Updating [..] index
Downloading crates ...
Downloaded bat v0.24.0 (registry [..])
Installing bat v0.24.0
Updating [..] index
...
Compiling bat v0.24.0
Finished `release` profile [optimized] target(s) in [..]s
Installing [..]/.cargo/bin/bat
Installed package `bat v0.24.0` (executable `bat`)
...
INFO cargo_liner::cargo > Updating `cargo-expand`...
Updating [..] index
Downloading crates ...
Downloaded cargo-expand v1.0.79 (registry [..])
Installing cargo-expand v1.0.79
Updating [..] index
...
Compiling cargo-expand v1.0.79
Finished `release` profile [optimized] target(s) in [..]s
Replacing [..]/.cargo/bin/cargo-expand
Replaced package `cargo-expand v1.0.78` with `cargo-expand v1.0.79` (executable `cargo-expand`)
...
INFO cargo_liner > Installation report:
┌──────────────┬─────────────┬─────────────┬────────┐
│ Name │ Old version │ New version │ Status │
├──────────────┼─────────────┼─────────────┼────────┤
│ bat │ ø │ 0.24.0 │ + │
│ cargo-expand │ 1.0.78 │ 1.0.79 │ ✔ │
└──────────────┴─────────────┴─────────────┴────────┘
INFO cargo_liner > Done.
其中第一个表格显示每个配置包的当前安装版本和最新版本,以及将要执行的操作;第二个表格显示一个结束报告,显示每个受影响的包的先前版本和新版本,以及调用cargo install
的结果。
输出中可选地用颜色表示状态图标,代表以下内容
ø
:当没有要显示或需要执行的操作时:已经是最新的。?
:当元素无法确定时,例如使用skip-check
时包的新版本。🛈
:当需要执行某些操作时:包的安装或更新。+
:当成功添加某些内容时:包的新安装。✘
:当发生失败时。✔
:当一切顺利时:已更新或成功更新。
ship
子命令
主要命令:执行包的安装和更新。
$ cargo liner help ship
The default command if omitted: install and update configured
packages.
Self-updating is enabled by default.
Usage: cargo liner ship [OPTIONS]
Options:
-n, --no-self
Disable self-updating.
Cannot be used in conjunction with `--only-self`.
[default: false]
[env: `CARGO_LINER_SHIP_NO_SELF`]
[config: `defaults.ship.no-self`]
--with-self
Negation of `--no-self` that overrides it and restores the
default behavior as if absent, i.e. self-update
-s, --only-self
Only self-update and do not install or update any other
package.
Cannot be used in conjunction with `--no-self`.
[default: false]
[env: `CARGO_LINER_SHIP_ONLY_SELF`]
[config: `defaults.ship.only-self`]
--no-only-self
Negation of `--only-self` that overrides it and restores
the default behavior as if absent, i.e. install or update
other packages as well
-c, --skip-check
Skip the summary version check and directly call `cargo
install` on each configured package.
The version check is relatively quick and enables skipping
calls to `cargo install` when no update is required, which
saves quite a bit of time. However, if you wish, this
option is still available in order not to run the check:
doing so will probably take more time in the end most of
the time, except if you have a very small amount of
packages configured (e.g. one or two) or if all or almost
all packages are not already installed.
It can also be used as a workaround in case a certain
operation fails in your particular environment, for
example: reading from `.crates.toml` under the
`$CARGO_HOME` or `$CARGO_INSTALL_ROOT` directory or making
requests to the registry. These operations will thus be
entirely skipped.
[default: false]
[env: `CARGO_LINER_SHIP_SKIP_CHECK`]
[config: `defaults.ship.skip-check`]
--no-skip-check
Negation of `--skip-check` that overrides it and restores
the default behavior as if absent, i.e. perform the usual
version check
-k, --no-fail-fast
Disable the default fail-fast execution of `cargo
install`s.
By default, whenever a call to `cargo install` fails for
any reason, the overall operation is stopped as soon as
possible. In some cases, such as packages simply failing to
compile, this is a bit too restrictive as it prevents
installing the following packages. The option it therefore
provided in order to make the installation keep on going by
continuing to call `cargo install` on each configured
package, even if some previous one failed. However, in case
any of the packages fails to install and the option is
used, an error will still be reported at the end,
containing an indication of all the packages that failed to
install.
This is not to be confused with Cargo's `--keep-going`
build option: it disables fast-failing between crate
compilations, while the current one disables fast-failing
between entire calls to `cargo install`; in fact,
`--keep-going` is never passed onto Cargo. It is neither to
be confused with `cargo test --no-fail-fast` since `cargo
test` is never used.
[default: false]
[env: `CARGO_LINER_SHIP_NO_FAIL_FAST`]
[config: `defaults.ship.no-fail-fast`]
--fail-fast
Negation of `--no-fail-fast` that overrides it and restores
the default behavior as if absent, i.e. stop as soon as the
first error occurs
-f, --force
Force overwriting existing crates or binaries.
Passes the option flag onto each call of `cargo install`.
It will, for example, redownload, recompile and reinstall
every configured package when used in conjunction with
`--skip-check`.
[default: false]
[env: `CARGO_LINER_SHIP_FORCE`]
[config: `defaults.ship.force`]
--no-force
Negation of `--force` that overrides it and restores the
default behavior as if absent, i.e. don't pass the argument
onto Cargo
-v, --verbose...
Be more verbose. Use multiple times to be more and more so
each time.
When omitted, INFO and above messages of only this crate
are logged. When used once, DEBUG and above messages of
only this crate are logged and error backtraces are shown
(`RUST_BACKTRACE=1`). When used twice, DEBUG and above
messages of all crates are logged, `-v` is given to Cargo
calls (details ran commands), and error backtraces are
fully shown (`RUST_BACKTRACE=full`). When used three times
or more, TRACE and above messages of all crates are logged,
`-vv` is given to Cargo calls (includes build output) and
error backtraces are fully shown (`RUST_BACKTRACE=full`).
This takes precedence over the environment.
-q, --quiet...
Be quieter. Use multiple times to be more and more so each
time.
When omitted, INFO and above messages of only this crate
are logged. When used once, WARN and above messages of only
this crate are logged. When used twice, ERROR messages of
all crates are logged. When used three times or more, no
message will be logged, including Cargo's by passing `-q`
to it and error reports are silenced. This takes precedence
over the environment.
--color <WHEN>
Control the coloring of the logging output.
This enables one to manually specify when should the logs
and error reports be colored or not, for example if the
automatic detection is either not wished or not functional.
The value is also passed onto calls to Cargo.
[default: auto]
[possible values: auto, always, never]
-h, --help
Print help (see a summary with '-h')
只需在命令行中运行cargo liner ship
即可
- 从配置文件中读取包。
- 从位于
$CARGO_INSTALL_ROOT
目录下的Cargo管理的.crates.toml
文件中读取当前已安装的包,如果cargo config get
能够从环境变量或install.root
配置项中检索其值(在$CARGO_HOME/config.toml
中),或者如果第一次尝试失败,将回退到在默认的$CARGO_HOME
目录下搜索文件,其中简单的设置不存在也是一个原因。有关此内容的更多详细信息,请参阅cargo install
文档。每次第一次尝试失败时,在尝试默认值之前,都会将其记录为DEBUG
消息,因此请使用-vv
来调查您的配置似乎没有被考虑。 - 使用
cargo search
检查每个包的最新可用版本。 - 对于需要安装或更新的每个包运行
cargo install
,同时遵守版本要求。 - 只有当没有提供
--no-self
时才进行自我更新。
import
子命令
此命令旨在在安装工具并首次使用后使用:它将在配置文件中填充当前已安装的包。
$ cargo liner help import
Import the `$CARGO_HOME/.crates.toml` Cargo-edited save file as a new
Liner configuration file.
Star versions are used by default. The version transformation options
are mutually exclusive.
Usage: cargo liner import [OPTIONS]
Options:
-e, --exact
Import package versions as "exact versions", i.e. prepended
with an equal operator.
Cannot be used in conjunction with either `--compatible` or
`--patch`. Default: `false`, i.e. use a star requirement.
-c, --compatible
Import package versions as "compatible versions", i.e.
prepended with a caret operator.
Cannot be used in conjunction with either `--exact` or
`--patch`. Default: `false`, i.e. use a star requirement.
-p, --patch
Import package versions as "patch versions", i.e. prepended
with a tilde operator.
Cannot be used in conjunction with either `--exact` or
`--compatible`. Default: `false`, i.e. use a star
requirement.
-f, --force
Overwrite the current configuration file if it already
exists.
Default: `false`, i.e. return an error in case the file
already exists.
-s, --keep-self
Also import this `cargo-liner` package into the
configuration, for example in order to specify a certain
version requirement later on.
Default: `false`, i.e. exclude the current package from the
list of packages to install or update in the resulting
configuration file. Note however that the `ship` command
will still self-update by default.
-l, --keep-local
Also import all locally-installed packages into the
configuration. This means packages installed via `cargo
install --path <path>` will be present in the
configuration.
Default: `false`, i.e. exclude all packages installed via
`cargo install --path <path>` from the list of packages to
install or update in the resulting configuration file.
-v, --verbose...
Be more verbose. Use multiple times to be more and more so
each time.
When omitted, INFO and above messages of only this crate
are logged. When used once, DEBUG and above messages of
only this crate are logged and error backtraces are shown
(`RUST_BACKTRACE=1`). When used twice, DEBUG and above
messages of all crates are logged, `-v` is given to Cargo
calls (details ran commands), and error backtraces are
fully shown (`RUST_BACKTRACE=full`). When used three times
or more, TRACE and above messages of all crates are logged,
`-vv` is given to Cargo calls (includes build output) and
error backtraces are fully shown (`RUST_BACKTRACE=full`).
This takes precedence over the environment.
-q, --quiet...
Be quieter. Use multiple times to be more and more so each
time.
When omitted, INFO and above messages of only this crate
are logged. When used once, WARN and above messages of only
this crate are logged. When used twice, ERROR messages of
all crates are logged. When used three times or more, no
message will be logged, including Cargo's by passing `-q`
to it and error reports are silenced. This takes precedence
over the environment.
--color <WHEN>
Control the coloring of the logging output.
This enables one to manually specify when should the logs
and error reports be colored or not, for example if the
automatic detection is either not wished or not functional.
The value is also passed onto calls to Cargo.
[default: auto]
[possible values: auto, always, never]
-h, --help
Print help (see a summary with '-h')
例如,如果您之前已安装
bat@0.22.1
cargo-make@0.36.3
cargo-outdated@0.11.1
然后运行cargo liner import
将产生以下配置文件,如果它尚不存在
[packages]
bat = "*"
cargo-make = "*"
cargo-outdated = "*"
默认情况下,此命令会从目标文件中排除
cargo-liner
:将重复专门的自我更新;存在-s/--keep-self
选项标志以禁用此排除。- 所有本地安装的包,即通过
cargo install --path=...
安装的包:避免将无法更新的包(因为它们在使用的注册表中没有保证存在)污染目标文件;存在-l/--keep-local
选项标志以禁用此排除。
默认情况下,命令将导入具有星号版本要求的包。提供了 --exact
、--compatible
和 --patch
选项,以自定义如何将当前安装的版本导入到版本要求中:--exact
将它们前置为 =
,--compatible
为 ^
,--patch
为 ~
。
例如,使用已安装的这三个包,运行 cargo liner import --patch
将会得到
[packages]
bat = "~0.22.1"
cargo-make = "~0.36.3"
cargo-outdated = "~0.11.1"
文件当然可以按照预期手动编辑。
completions
子命令
这可以在 shell 中为当前项目启用 CLI 自动完成
$ cargo liner help completions
Generate an auto-completion script for the given shell.
The script is generated for `cargo-liner`, but with arguments rooted
on `cargo-liner liner`, thus making auto-completing work when typing
`cargo liner`. The generated script is emitted to standard output.
Usage: cargo liner completions [OPTIONS] <SHELL>
Arguments:
<SHELL>
The shell flavor to use when generating the completions
[possible values: bash, elvish, fish, powershell, zsh]
Options:
-v, --verbose...
Be more verbose. Use multiple times to be more and more so
each time.
When omitted, INFO and above messages of only this crate
are logged. When used once, DEBUG and above messages of
only this crate are logged and error backtraces are shown
(`RUST_BACKTRACE=1`). When used twice, DEBUG and above
messages of all crates are logged, `-v` is given to Cargo
calls (details ran commands), and error backtraces are
fully shown (`RUST_BACKTRACE=full`). When used three times
or more, TRACE and above messages of all crates are logged,
`-vv` is given to Cargo calls (includes build output) and
error backtraces are fully shown (`RUST_BACKTRACE=full`).
This takes precedence over the environment.
-q, --quiet...
Be quieter. Use multiple times to be more and more so each
time.
When omitted, INFO and above messages of only this crate
are logged. When used once, WARN and above messages of only
this crate are logged. When used twice, ERROR messages of
all crates are logged. When used three times or more, no
message will be logged, including Cargo's by passing `-q`
to it and error reports are silenced. This takes precedence
over the environment.
--color <WHEN>
Control the coloring of the logging output.
This enables one to manually specify when should the logs
and error reports be colored or not, for example if the
automatic detection is either not wished or not functional.
The value is also passed onto calls to Cargo.
[default: auto]
[possible values: auto, always, never]
-h, --help
Print help (see a summary with '-h')
其结果可以被保存到配置为可以通过 shell source
(或等效)的文件中,或者在每次启动时生成并 eval
(或等效)。例如,在 Zsh 中,向 ~/.zshrc
中添加
[[ -f ~/.cargo/bin/cargo-liner ]] && eval "$(cargo liner -qqq completions zsh)"
将启用每个新 shell 中的完成功能,但前提是 Cargo Liner 确实已安装(这部分可能需要根据您的特定环境进行调整)。
贡献
版权声明
Sergej Tucakov 为本项目标志使用的动画。
依赖项
~13–25MB
~405K SLoC