Skip to content

docs(help): align minor-group description density with GNU (issue #1127 P2) - #1163

Merged
caomengxuan666 merged 1 commit into
mainfrom
feat/help-coverage-minor
Oct 10, 2026
Merged

caomengxuan666 merged 1 commit into
mainfrom
feat/help-coverage-minor

Conversation

@caomengxuan666

Copy link
Copy Markdown
Member

Closes the P2 minor 组 part of #1127 (MAJOR 组另行处理,本 PR 不动)。

变更

把 GNU 的多行描述措辞搬进 8 个 minor 组命令的 --help,只搬描述文案、不新增选项(遵守护栏:help 不得承诺未实现选项;GNU 描述里涉及本移植未实现选项的行被省略或收入 [DIFFERS] 段)。

命令 密度(ours/gnu) 前 → 后 说明
stat 0.24 → 0.94 文件/文件系统格式序列参考(--cached 仅提示、--terse 等价格式均按实现描述)
stty 0.25 → 1.05 全量 settings 参考;Windows 上仅接受不生效的设置明确标注 “validated and silently ignored / accepted only”
man 0.32 → 0.62 未实现的 man-db 选项集中列入 [DIFFERS];受红线限制这是诚实上限
top 0.37 → 1.15 描述性序言 + 逐选项说明(与 TOP_OPTIONS 一一对应)
numfmt 0.38 → 0.99 UNIT/FIELDS/FORMAT 参考与退出状态约定(--invalid=abort/fail/warn/ignore 按实现描述)
dd 0.39 → 1.09 operand/conv/flag 参考按实现描述(未实现的 conv=ascii/ebcdic/… 不出现;flag 括注按实际行为修正为 “only fullblock and nonblock affect input handling”)
date 0.42 → 0.84 全量序列、% 后标志、宽度与 E/O 修饰符参考(全部已实现,含 %N/%q/%:z)
time 0.45 → 0.68 real/user/sys 输出约定;-f/-o/-a/-v/-q 未实现,列入 [DIFFERS](受红线限制的诚实上限)

man 与 time 未到 0.8:两者 GNU help 的主要篇幅是本移植未实现的选项清单,按护栏省略,故密度封顶 —— 在此注明(issue 要求“省略该行并在 PR 注明”)。

审计数据

新增 tests/differential/help-coverage-audit.py(重跑 help-coverage-raw.json 的 ours 列,GNU 列沿用,--wsl 可重测),并用它全量重跑了审计:

  • 重跑结果:115/156 命令密度 ≥ 0.8。
  • minor 组 8 行的 ours/gnu 变化见上表。
  • 其余 75 行 ours 值同时变化:这些是 main 上已合并 help 变更的自然漂移 —— 审计上次再生于 c001700(2026-09-24),而 cksum 等命令的 help 在其后已扩展(部分甚至在 c001700 之前 3 天就已合并,说明入库时数据已陈旧)。本次重跑用同一二进制重新测量了全部行。

验证

  • winuxcmd-tests:2773/2775 通过;2 个失败为 grep.grep_r_skips_cross_junction_trees_without_crashing / grep.grep_R_warns_and_terminates_on_junction_cycle,原因是本机无符号链接权限(create_directory_symlink: A required privilege is not held by the client),与本次 help 文案无关、任何分支同环境均复现。
  • 红线核对:新增 help 文案逐一对照源码实现(stat 格式序列 switch、stty accepted 列表、man -P/-t/-T/-H 行为、dd operand/conv/flag 表、date 序列 switch、numfmt 选项与 --invalid 策略、top TOP_OPTIONS、time 仅 -p),未发现承诺未实现项。
  • GNU 对照(WSL Ubuntu coreutils)实测行数:stat 89、stty 160、man 73、top 27、numfmt 95、dd 74、date 110、time 44。
  • i18n:scripts/i18n_batch.py extract + validate 通过;zh-CN 同步在 unixwin/winuxcmd-i18n 提交 32ea517(VERSION 0.6.17 bump,符合“catalogs 变更必须同 PR bump VERSION”约定),WINUX_LANG=zh-CN 运行时渲染抽查通过。
  • clang-format(VS18 clang-format,scripts/format.py)已跑;范围外文件的历史格式漂移未纳入本 PR。

… P2)

Adopt the GNU multi-line description wording in --help for the eight
minor-group commands, without advertising unimplemented options:

  stat    0.24 -> 0.94  format-sequence reference (files + file systems)
  stty    0.25 -> 1.05  full settings reference; accepted-but-ignored
                        settings are marked as such (validated, no-op)
  man     0.32 -> 0.62  man-db options that stay unimplemented are listed
                        under [DIFFERS]; ceiling set by the red line
  top     0.37 -> 1.15  prose + per-option descriptions
  numfmt  0.38 -> 0.99  UNIT/FIELDS/FORMAT reference, exit-status contract
  dd      0.39 -> 1.09  operand/conv/flag reference as implemented
  date    0.42 -> 0.84  full sequence, flag, width/modifier reference
  time    0.45 -> 0.68  real/user/sys output contract; -f/-o/-a/-v/-q stay
                        under [DIFFERS] (ceiling set by the red line)

Lines of GNU help that document options this port does not implement are
omitted rather than promised, per the issue guardrail.

Add tests/differential/help-coverage-audit.py, which regenerates the
ours column of tests/differential/help-coverage-raw.json (GNU column is
carried over; --wsl re-measures it) and rerun it:
115/156 commands now measure at density >= 0.8. Rows outside the minor
group also move because the committed ours values predate merged help
changes on main (last regenerated at c001700, 2026-09-24); this rerun
re-measures every row against one binary.

i18n: zh-CN catalog synced in unixwin/winuxcmd-i18n (0.6.17).
@caomengxuan666
caomengxuan666 merged commit 211b190 into main Oct 10, 2026
4 checks passed
@caomengxuan666
caomengxuan666 deleted the feat/help-coverage-minor branch October 10, 2026 07:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant