知识卡片
以可执行文件扩展 Cargo
把名为 cargo-something 的可执行文件放上 PATH,即可通过 cargo something 调用。cargo --list 可查看这些命令,扩展的分发也可经由 cargo install。
相关卡片 [[安装 Cargo 工具二进制]]
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- 深入 Cargo 与 Crates.io Installing Binaries with cargo install · 查看原书依据
Cargo is designed so you can extend it with new subcommands without having to modify it. If a binary in your $PATH is named cargo-something, you can run it as if it were a Cargo subcommand by running cargo something. Custom commands like this are also listed when you run cargo --list.
参考来源
- 位置:《The Rust Programming Language(第2版)》第14章 深入 Cargo 与 Crates.io(来源项目 a19c7933-4eda-4176-aebd-30fe7e1ad292,`extracted/The Rust Programming Language(第2版)/_epub-src/c14.xhtml`,块 0191)
- 结论依据:原文说明 Cargo 会将 PATH 上具备特定名称的可执行程序视为子命令。
- 原始内容:Cargo is designed so you can extend it with new subcommands without having to modify it. If a binary in your $PATH is named cargo-something, you can run it as if it were a Cargo subcommand by running cargo something. Custom commands like this are also listed when you run cargo --list.