dotfiles

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Dotfiles

Dotfiles

Carry out the user's request on their dotfiles: the GitHub repository seven7thirty3five5/dotfiles, cloned at
~/.local/share/chezmoi
. With no request, ask what to change.
A run starts and ends in sync:
git status
is clean, local
main
matches
origin/main
, and
chezmoi verify --exclude=scripts
passes, so the home folder matches the repository.
在用户的 dotfiles 上执行请求:GitHub 仓库 seven7thirty3five5/dotfiles, 克隆位置为
~/.local/share/chezmoi
。如果用户没有提出具体请求,先询问需要更改什么。
每次运行开始和结束时都应保持同步:
git status
干净,本地
main
与
origin/main
一致,并且
chezmoi verify --exclude=scripts
通过,从而确保 home folder 与仓库相匹配。

1. Orient

1. 了解现状

  1. Confirm this machine publishes the dotfiles, since only the repository's owner can push:
    chezmoi execute-template '{{ .publishDotfiles }}'
    prints
    true
    ,
    git push --dry-run
    succeeds, and
    gh auth status
    shows
    seven7thirty3five5
    as the active account (gh watches the workflows).
  2. Start in sync. With
    git status
    clean and
    chezmoi verify --exclude=scripts
    passing,
    chezmoi update
    pulls and applies the latest commits; then
    main
    must match
    origin/main
    .
  3. Read
    README.md
    : its Design section explains how the setup works and where each kind of change belongs. Then read the files your change touches. For each chezmoi feature you use, read its page in chezmoi's reference: https://www.chezmoi.io/reference/.
When a check fails or the machine is out of sync, stop before editing and show the user what you found: uncommitted work, edits to deployed files and unpushed commits are theirs to settle. Done when every check passes and you can name the owner of each thing your change touches.
  1. 确认这台机器负责发布 dotfiles,因为只有仓库所有者才能推送:
    chezmoi execute-template '{{ .publishDotfiles }}'
    输出
    true
    ,
    git push --dry-run
    成功,并且
    gh auth status
    显示当前活动账户为
    seven7thirty3five5
    (gh 会监控各个 workflow)。
  2. 从同步状态开始。当
    git status
    干净且
    chezmoi verify --exclude=scripts
    通过时,
    chezmoi update
    会拉取并应用最新提交;随后
    main
    必须与
    origin/main
    保持一致。
  3. 阅读
    README.md
    :其中的 Design 部分会说明整个配置的工作方式,以及不同类型的变更 应放在哪里。然后阅读此次变更涉及的文件。对于使用的每个 chezmoi 功能,阅读 chezmoi reference 中对应的页面: https://www.chezmoi.io/reference/。
如果某项检查失败或机器状态不同步,请在编辑前停止,并向用户展示发现的问题:未提交的 工作、对已部署文件的修改以及未推送的提交都应由用户自行处理。只有当所有检查均通过, 并且你能明确说明此次变更涉及的每项内容由谁负责时,才算完成。

2. Change

2. 变更

Edit the repository's files:
chezmoi apply
deploys them, replacing edits made in the home folder (
chezmoi source-path FILE
names a deployed file's source). Make every change work on macOS and Linux, with and without sudo. Follow the README's Design section and the gotchas below, and write like the file you are editing: plain comments that explain each command, option and template function, and why, for a reader new to the tool.
Done when
git grep
finds nothing in the README, comments or checks that your change made untrue.
编辑仓库中的文件:
chezmoi apply
会部署这些文件,并覆盖 home folder 中手动进行的 修改(
chezmoi source-path FILE
可用于确定已部署文件的源文件)。确保每项变更都能在 macOS 和 Linux 上工作,并同时兼容有 sudo 和无 sudo 的环境。遵循 README 的 Design 部分以及下面的注意事项,并按照正在编辑的文件的风格编写:使用简洁注释解释每个命令、 选项和模板函数及其原因,让初次接触该工具的读者也能理解。
当
git grep
无法在 README、注释或检查项中找到因此次变更而不再准确的内容时,才算完成。

3. Verify

3. 验证

  1. python3 scripts/check-lint.py
    and
    python3 scripts/check-shell.py
    pass.
  2. chezmoi diff
    shows only the changes you intended, including the setup scripts it will run. Then run
    chezmoi apply
    .
  1. python3 scripts/check-lint.py
    和
    python3 scripts/check-shell.py
    均通过。
  2. chezmoi diff
    仅显示预期中的变更,包括将要运行的设置脚本。然后运行
    chezmoi apply
    。

4. Ship

4. 交付

  1. Commit in the style of
    git log
    .
  2. sh scripts/check-install.sh
    passes; it checks the applied machine and needs a clean tree.
  3. Push, and watch each workflow on the pushed commit until it finishes (
    gh run watch
    ); Bootstrap takes about ten minutes. When one fails, fix it and ship again.
Done when every workflow passes and the machine is in sync. Report what changed, and anything the user must do by hand on other machines.
  1. 按照
    git log
    中现有的风格提交。
  2. sh scripts/check-install.sh
    通过;该脚本会检查已应用配置的机器,并且要求工作树 保持干净。
  3. 推送提交,并监控该提交上的每个 workflow,直到全部完成(
    gh run watch
    );Bootstrap 大约需要十分钟。如果某个 workflow 失败,请修复后再次交付。
当所有 workflow 均通过且机器保持同步时才算完成。报告具体变更,以及用户是否还需要在 其他机器上手动执行某些操作。

Gotchas

注意事项

  • On this machine, chezmoi commits and pushes each source change it makes (
    chezmoi add
    ,
    chezmoi edit
    ), before your checks run. Create and edit source files yourself, with chezmoi's names (
    dot_
    ,
    private_
    ,
    executable_
    ,
    .tmpl
    ).
  • When chezmoi stops managing a file, it leaves the file in place on every machine.
  • update
    upgrades everything on the machine: run it when the user asks, and test a changed part of it on its own.
  • 在这台机器上,chezmoi 会在执行检查之前,自动提交并推送它所做的每项源文件变更 (
    chezmoi add
    、
    chezmoi edit
    )。请自行创建和编辑源文件,并使用 chezmoi 的命名规则 (
    dot_
    、
    private_
    、
    executable_
    、
    .tmpl
    )。
  • 当 chezmoi 停止管理某个文件时,该文件仍会保留在每台机器上。
  • update
    会升级机器上的全部配置:仅在用户提出要求时运行,并单独测试其中发生变更的 部分。