From db56b462dec88c8e14f3de16e5bf63282e102788 Mon Sep 17 00:00:00 2001 From: jaywcjlove Date: Mon, 7 Nov 2022 03:41:59 +0000 Subject: [PATCH] doc: update `yum.md`. 4a1eb6964d7c48549c48bdd4fc91050e708f124a --- docs/cargo.html | 26 ++++++++++++++++++++++---- docs/yum.html | 22 ++++++++++++++++------ style/style.css | 4 ++++ 3 files changed, 42 insertions(+), 10 deletions(-) diff --git a/docs/cargo.html b/docs/cargo.html index e4520b8e..b1187852 100644 --- a/docs/cargo.html +++ b/docs/cargo.html @@ -42,7 +42,7 @@

此快速参考备忘清单 Cargo 提供了编译 Rust 常用命令和示例

入门

安装 Rust 和 Cargo

$ curl -sSf https://static.rust-lang.org/rustup.sh | sh
 
@@ -102,10 +102,28 @@
:-:-
cargo version显示版本信息以确认 Cargo 已安装
cargo new创建一个新项目
cargo test在项目中运行单元测试
cargo check快速编译项目,无需生成二进制文件来检查错误
cargo fmt自动格式化代码
cargo build编译一个项目
cargo run一步编译和运行项目
cargo clippy --all-targets -- --D warningsLinter 检查错误
cargo tarpaulin --ignore-tests检查代码覆盖率
+

切换源

+ +
$ touch ~/.cargo/config # 添加配置文件
+$ vim ~/.cargo/config   # 编辑配置文件
+
+

配置文件 config 内容

+
[source.crates-io]
+registry = "https://github.com/rust-lang/crates.io-index"
+replace-with = 'tuna' # 👈 如果需要提交包注释配置源
+
+[source.tuna]
+registry = "https://mirrors.tuna.tsinghua.edu.cn/git/crates.io-index.git"
+# registry = "git://mirrors.ustc.edu.cn/crates.io-index"
+
+

💥 注意切换源需要删除缓存目录

+
$ rm -rf ~/.cargo/.package-cache   # ⚠️ 删除缓存目录内容
+

创建新项目

$ cargo new hello_world --bin
 
+
  • --bin 正在制作一个二进制程序
  • --lib 正在创建一个库(lib)
  • @@ -202,7 +220,7 @@
    # `source` 表下,就是存储有关要更换的来源名称
     [source]
     
    -# 在`source` 表格之下的,可为一定数量的有关来源名称. 示例下面就# 定义了一个新源, 叫 `my-awesome-source`, 其内容来自本地 # `vendor`目录 ,其相对于包含`.cargo/config`文件的目录
    +# 在`source` 表格之下的,可为一定数量的有关来源名称. 示例下面就,定义了一个新源, 叫 `my-awesome-source`,其内容来自本地,`vendor`目录 ,其相对于包含 `.cargo/config` 文件的目录
     [source.my-awesome-source]
     directory = "vendor"
     
    @@ -212,7 +230,7 @@
     # tag = "v1.0.1"
     # rev = "313f44e8"
     
    -# The crates.io 默认源 在"crates-io"名称下, 且在这里我们使用 `replace-with` 字段指明 默认源更换成"my-awesome-source"源
    +# crates.io 默认源 在"crates-io"名称下,且在这里我们使用 `replace-with` 字段指明 默认源更换成"my-awesome-source"源
     [source.crates-io]
     replace-with = "my-awesome-source"
     
    @@ -230,7 +248,7 @@ directory = "path/to/vendor" -

    更换源的配置通过完成 .cargo/config,下面为全套可用字段是

    +

    更换源的配置通过完成 .cargo/config,上面是全套可用字段

包相关命令

init/new

diff --git a/docs/yum.html b/docs/yum.html index bb93a03a..f048f89a 100644 --- a/docs/yum.html +++ b/docs/yum.html @@ -191,14 +191,16 @@

update-to

将一个或所有软件包更新到特定版本

upgrade

-

更新包考虑过时

+
$ yum -y upgrade
+
+

更新包考虑过时,只升级所有包,不升级软件和系统内核

localinstall

-

从本地文件、http 或 ftp 安装包

-
$ yum localinstall abc-1-1.i686.rpm
-
-

从本地目录安装 abc 包

-
$ yum localinstall http://myrepo/abc-1-1.i686.rpm
+
# 从本地文件、http 或 ftp 安装包
+$ yum localinstall abc-1-1.i686.rpm
+# 从本地目录安装 abc 包
+$ yum localinstall http://myrepo/abc-1-1.i686.rpm
 
+

从 FTP 站点安装 abc

downgrade

将软件包降级到早期版本

@@ -253,6 +255,14 @@

yumdb

检查或更改 yum 数据库

yumdownloader

+
# 使用本地源离线安装 net-tools 工具包
+$ yumdownloader net-tools.x86_64
+# 使用 –destdir 参数设置下载的目标目录
+$ yumdownloader net-tools.x86_64 --destdir=/usr/local/bin/
+# 使用 –resolve 参数解决依赖关系并下载所需的安装包
+$ yumdownloader net-tools.x86_64 --resolve --destdir=/usr/local/bin/
+
+

从 repo 下载一个包到当前目录

不同 YUM 命令的常用选项

yum --disableplugin=langpacks info vsftpd
diff --git a/style/style.css b/style/style.css
index eae21db2..a4b568e4 100644
--- a/style/style.css
+++ b/style/style.css
@@ -735,6 +735,10 @@ body:not(.home) .h2wrap-body > .wrap:hover .h3wrap > h3 a::after {
   border-radius: 0 0 0.5rem 0.5rem;
 }
 
+.wrap-header.h3wrap > .wrap-body :not(:first-child):last-child {
+  border-radius: 0 0 0.5rem 0.5rem;
+}
+
 .wrap-header.h3wrap > .wrap-body {
   z-index: 0;
   display: flex;