chronic
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseChronic
Chronic
chronicmoreutilschronicmoreutilsInstallation
安装
Ensure is available before use:
chronicbash
undefined使用前请确保已可用:
chronicbash
undefinedNixOS / nix
NixOS / nix
nix-shell -p moreutils --run "chronic ..."
nix-shell -p moreutils --run "chronic ..."
or add moreutils to system/devshell packages
或者将moreutils添加到系统/开发环境包中
Debian/Ubuntu
Debian/Ubuntu
apt install moreutils
apt install moreutils
macOS
macOS
brew install moreutils
If the project uses `flake.nix`, `devbox.json`, or `devenv.nix`, add `moreutils` there.brew install moreutils
如果项目使用`flake.nix`、`devbox.json`或`devenv.nix`,请在其中添加`moreutils`。When to Add chronic
何时添加chronic
Wrap a command with when all of these are true:
chronic- The command produces output on success that neither you nor the user need to read
- The command's failure output is sufficient for diagnosing problems
- The command is invoked repeatedly (in Justfiles, Makefiles, CI, or interactive sessions)
Common candidates: linters, formatters, type checkers, static analysis, compilation, dependency installation, database migrations, deploy scripts.
当满足以下所有条件时,使用包装命令:
chronic- 命令成功时产生的输出对你和用户来说都无阅读必要
- 命令失败时的输出足以用于诊断问题
- 该命令会被重复调用(如在Justfile、Makefile、CI或交互式会话中)
常见适用场景:代码检查工具、格式化工具、类型检查器、静态分析、编译、依赖安装、数据库迁移、部署脚本。
Examples
示例
makefile
undefinedmakefile
undefinedBefore — noisy on every run
之前——每次运行都会产生大量输出
check:
eslint src/
tsc --noEmit
check:
eslint src/
tsc --noEmit
After — silent on success, verbose on failure
之后——成功时静默,失败时显示详细输出
check:
chronic eslint src/
chronic tsc --noEmit
```justcheck:
chronic eslint src/
chronic tsc --noEmit
```justJustfile
Justfile
check:
chronic cargo clippy --all-targets
chronic cargo fmt -- --check
When running ad-hoc commands in the terminal:
```bash
chronic npm install
chronic terraform plan -detailed-exitcodecheck:
chronic cargo clippy --all-targets
chronic cargo fmt -- --check
在终端中运行临时命令时:
```bash
chronic npm install
chronic terraform plan -detailed-exitcodeWhen to Remove chronic
何时移除chronic
Remove from a command when any of these are true:
chronic- The output contains information the user needs even on success (e.g., build artifacts paths, deploy URLs, generated file lists, timing/performance data)
- The command is interactive or streams progress that the user wants to monitor
- You or the user are debugging — temporarily remove chronic to see full output, then restore it after the issue is resolved. But also consider adding an extra command for that
- The command's exit code doesn't reliably reflect success/failure (some tools exit 0 on warnings)
Do not bypass chronic by calling the underlying command directly (e.g., running instead of to avoid chronic). Instead, remove chronic from the wrapper (Justfile/Makefile) for that specific command.
cargo clippyjust check当满足以下任一条件时,从命令中移除:
chronic- 命令成功时的输出包含用户需要的信息(如构建产物路径、部署URL、生成文件列表、计时/性能数据等)
- 命令是交互式的,或会输出用户需要监控的进度信息
- 你或用户正在调试——临时移除chronic以查看完整输出,问题解决后再恢复。也可以考虑为此添加一个额外的命令
- 命令的退出码无法可靠反映成功/失败状态(部分工具即使有警告也会返回0)
请勿通过直接调用底层命令绕过chronic(例如,为了避开chronic而直接运行而非)。相反,应从包装器(Justfile/Makefile)中移除该特定命令的chronic。
cargo clippyjust checkFlags
选项
- — on failure, labels stdout vs stderr and shows the return code. Use when diagnosing which stream contains the error.
chronic -v - — triggers output when stderr is non-empty, even if exit code is 0. Use for commands that print warnings to stderr but still exit 0.
chronic -e
- —— 失败时,标记stdout和stderr并显示返回码。用于诊断错误来自哪个输出流。
chronic -v - —— 即使退出码为0,只要stderr非空就触发输出。适用于那些会在stderr输出警告但仍返回0的命令。
chronic -e
Continuous Optimization
持续优化
Adopt chronic incrementally and adjust based on experience:
- Start without chronic for new/unfamiliar commands until their output patterns are understood
- Add chronic once a command is confirmed to be noisy-on-success and informative-on-failure
- Remove chronic when output turns out to be useful — don't hesitate, this is expected and healthy
- Re-add chronic after debugging is complete
When you notice a command producing output that nobody reads, suggest adding chronic. When chronic is hiding something useful, suggest removing it. Mention these suggestions naturally, not as a separate concern.
逐步采用chronic并根据使用经验调整:
- 初始不使用chronic:对于新的或不熟悉的命令,先了解其输出模式后再决定是否使用
- 添加chronic:确认命令在成功时冗余、失败时信息充足后,再添加chronic
- 移除chronic:当发现输出实际有用时,不要犹豫移除——这是正常且合理的调整
- 重新添加chronic:调试完成后恢复使用chronic
当你注意到某个命令产生无人阅读的冗余输出时,建议添加chronic;当chronic隐藏了有用内容时,建议移除它。自然地提出这些建议,不要将其作为单独的问题。