diff options
| author | IskandarMa <epiciskandar@gmail.com> | 2022-01-19 02:24:02 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-01-18 18:24:02 +0000 |
| commit | f6a7f4d4aca4a1808850e2dcd8cc223ae5202062 (patch) | |
| tree | fefc9beff20ea6438e9c1927d83319ed4c85a6b0 /docs/zh-cn/cli_configuration.md | |
| parent | 8a3dfe2246c4a6182cf18349e9c4d0d28cae4ec5 (diff) | |
| download | qmk_firmware-f6a7f4d4aca4a1808850e2dcd8cc223ae5202062.tar.gz qmk_firmware-f6a7f4d4aca4a1808850e2dcd8cc223ae5202062.zip | |
update the Chinese translation based on the latest English version (#14924)
Co-authored-by: peepeetee <43021794+peepeetee@users.noreply.github.com>
Co-authored-by: Joy Lee <chang.li@westberrytech.com>
Co-authored-by: LitoMore <LitoMore@users.noreply.github.com>
Co-authored-by: Dasky <32983009+daskygit@users.noreply.github.com>
Diffstat (limited to 'docs/zh-cn/cli_configuration.md')
| -rw-r--r-- | docs/zh-cn/cli_configuration.md | 126 |
1 files changed, 126 insertions, 0 deletions
diff --git a/docs/zh-cn/cli_configuration.md b/docs/zh-cn/cli_configuration.md new file mode 100644 index 000000000..d3bca4a33 --- /dev/null +++ b/docs/zh-cn/cli_configuration.md | |||
| @@ -0,0 +1,126 @@ | |||
| 1 | # QMK CLI 配置 | ||
| 2 | |||
| 3 | <!--- | ||
| 4 | original document: 0.15.12:docs/cli_configuration.md | ||
| 5 | git diff 0.15.12 HEAD -- docs/cli_configuration.md | cat | ||
| 6 | --> | ||
| 7 | |||
| 8 | 本文详述了 `qmk config` 功能及作用。 | ||
| 9 | |||
| 10 | # 介绍 | ||
| 11 | |||
| 12 | QMK CLI的配置系统是一套键/值(key/value)数据系统,每个键由一个子指令和一个参数名组成,通过点号(英文句号)分隔。这使得配置项可以简单直接地映射到命令行参数上。 | ||
| 13 | |||
| 14 | ## 简单示例 | ||
| 15 | |||
| 16 | 作为一个示例,对于指令 `qmk compile --keyboard clueboard/66/rev4 --keymap default` | ||
| 17 | |||
| 18 | 其存在两个命令行参数,可以通过如下方式从配置中读取: | ||
| 19 | |||
| 20 | * `compile.keyboard` | ||
| 21 | * `compile.keymap` | ||
| 22 | |||
| 23 | 可以这样设置: | ||
| 24 | |||
| 25 | ``` | ||
| 26 | $ qmk config compile.keyboard=clueboard/66/rev4 compile.keymap=default | ||
| 27 | compile.keyboard: None -> clueboard/66/rev4 | ||
| 28 | compile.keymap: None -> default | ||
| 29 | Ψ Wrote configuration to '/Users/example/Library/Application Support/qmk/qmk.ini' | ||
| 30 | ``` | ||
| 31 | |||
| 32 | 现在每次执行 `qmk compile` 时都不需要指定键盘及键映射参数了。 | ||
| 33 | |||
| 34 | ## 设置用户级的默认配置 | ||
| 35 | |||
| 36 | 当你需要在多个命令中使用一致的配置项时,比如很多命令都需要的 `--keyboard` 参数,相比于每次执行命令都去指定该参数值,你可以直接设置用户级的配置值,即可将该配置用于所有的命令。 | ||
| 37 | |||
| 38 | 示例: | ||
| 39 | |||
| 40 | ``` | ||
| 41 | $ qmk config user.keyboard=clueboard/66/rev4 user.keymap=default | ||
| 42 | user.keyboard: None -> clueboard/66/rev4 | ||
| 43 | user.keymap: None -> default | ||
| 44 | Ψ Wrote configuration to '/Users/example/Library/Application Support/qmk/qmk.ini' | ||
| 45 | ``` | ||
| 46 | |||
| 47 | # CLI文档 (`qmk config`) | ||
| 48 | |||
| 49 | `qmk config` 命令可以管理配置数据。当不带额外参数执行时,会输出所有已有配置。存在参数时这些参数将被视为配置项参数,其格式须满足如下形式且无空格分隔: | ||
| 50 | |||
| 51 | <subcommand|general|default>[.<key>][=<value>] | ||
| 52 | |||
| 53 | ## 设置配置值 | ||
| 54 | |||
| 55 | 在配置项的键后加 = 号进行值的设置,配置项的键必须是 `<section>.<key>` 的完整形式。 | ||
| 56 | |||
| 57 | 举例: | ||
| 58 | |||
| 59 | ``` | ||
| 60 | $ qmk config default.keymap=default | ||
| 61 | default.keymap: None -> default | ||
| 62 | Ψ Wrote configuration to '/Users/example/Library/Application Support/qmk/qmk.ini' | ||
| 63 | ``` | ||
| 64 | |||
| 65 | ## 读取配置值 | ||
| 66 | |||
| 67 | 可以读取整个配置文件、单独配置键或是一整个配置系列,也可以同时指定读取多个配置项。 | ||
| 68 | |||
| 69 | ### 全量配置读取示例 | ||
| 70 | |||
| 71 | qmk config | ||
| 72 | |||
| 73 | ### 单系列配置读取示例 | ||
| 74 | |||
| 75 | qmk config compile | ||
| 76 | |||
| 77 | ### 单配置项读取示例 | ||
| 78 | |||
| 79 | qmk config compile.keyboard | ||
| 80 | |||
| 81 | ### 多配置项读取示例 | ||
| 82 | |||
| 83 | qmk config user compile.keyboard compile.keymap | ||
| 84 | |||
| 85 | ## 删除配置值 | ||
| 86 | |||
| 87 | 将配置值设置为 `None` 即可删除该配置值。 | ||
| 88 | |||
| 89 | 示例: | ||
| 90 | |||
| 91 | ``` | ||
| 92 | $ qmk config default.keymap=None | ||
| 93 | default.keymap: default -> None | ||
| 94 | Ψ Wrote configuration to '/Users/example/Library/Application Support/qmk/qmk.ini' | ||
| 95 | ``` | ||
| 96 | |||
| 97 | ## 批量操作 | ||
| 98 | |||
| 99 | 一个指令中可以合并执行多个读写操作,将依序进行执行输出: | ||
| 100 | |||
| 101 | ``` | ||
| 102 | $ qmk config compile default.keymap=default compile.keymap=None | ||
| 103 | compile.keymap=skully | ||
| 104 | compile.keyboard=clueboard/66_hotswap/gen1 | ||
| 105 | default.keymap: None -> default | ||
| 106 | compile.keymap: skully -> None | ||
| 107 | Ψ Wrote configuration to '/Users/example/Library/Application Support/qmk/qmk.ini' | ||
| 108 | ``` | ||
| 109 | |||
| 110 | # 用户配置相关的配置项 | ||
| 111 | |||
| 112 | | 配置项 | 默认值 | 描述 | | ||
| 113 | |-------|-------|------| | ||
| 114 | | user.keyboard | None | 键盘路径(举例:`clueboard/66/rev4`) | | ||
| 115 | | user.keymap | None | 键盘名称(举例:`default`) | | ||
| 116 | | user.name | None | 用户的Github用户名 | | ||
| 117 | |||
| 118 | # 所有配置项 | ||
| 119 | |||
| 120 | | 配置项 | 默认值 | 描述 | | ||
| 121 | |-------|-------|------| | ||
| 122 | | compile.keyboard | None | 键盘路径(举例:`clueboard/66/rev4`) | | ||
| 123 | | compile.keymap | None | 键盘名称(举例:`default`) | | ||
| 124 | | hello.name | None | 执行时展示的欢迎信息 | | ||
| 125 | | new_keyboard.keyboard | None | 键盘路径(举例:`clueboard/66/rev4`) | | ||
| 126 | | new_keyboard.keymap | None | 键盘名称(举例:`default`) | | ||
