Skip to content

ux: group bare winuxcmd output into coreutils-style sections + i18n locale hint (#1155) - #1160

Merged
caomengxuan666 merged 1 commit into
mainfrom
ux/bare-output-i18n-hint
Oct 10, 2026
Merged

caomengxuan666 merged 1 commit into
mainfrom
ux/bare-output-i18n-hint

Conversation

@caomengxuan666

Copy link
Copy Markdown
Member

Summary

Bare winuxcmd printed 193 lines of registration-ordered command summaries (issue #1155). This PR restructures the bare output around GNU coreutils-style presentation groups and adds i18n discoverability.

Grouped bare output

  • All registered commands are grouped into nine real sections — File operations, Text processing, Compare & patch, Numeric operations, Search tools, Checksums & encoding, Shell utilities, System & process, Terminal & documentation — alphabetical inside each section.
  • A "Help and discovery" guide prints before the groups: winuxcmd <command> --help, winuxcmd help <command>, winuxcmd --list-all, wpm search <capability>.
  • New winuxcmd --list-all keeps the flat alphabetical listing for scripts and users who prefer it.
  • Commands missing from every category table fall into an "Other utilities" catch-all (a unit test currently guards that it stays empty), so adding a command never makes it invisible.

i18n / locale hint (#1151)

  • winux::i18n::system_locale() resolves the effective locale with an injection-friendly precedence: WINUX_LANG → LC_ALL → LC_MESSAGES → LANG → GetUserDefaultLocaleName, normalizing zh_CN.UTF-8-style values to zh-CN.
  • When the locale is non-English and the matching WPM i18n catalog is not installed, bare output gains one line:
    Tip: Chinese help is available - run 'wpm install winuxcmd-i18n-zh-cn' and set WINUX_LANG=zh-CN to enable it.
  • Silent when: locale is English/C/POSIX/unset, WINUX_LANG=off (explicit opt-out), or the catalog for the locale (including bare-language fallback) is already installed under .wpm/i18n/.

Compatibility

  • Command parsing and dispatch are untouched: a per-command --version loop over all 178 registered commands passes (0 fails, 0 timeouts) and the full unit suite is green apart from two pre-existing environment failures (grep symlink fixtures require symlink privilege, unrelated to this change).

Test plan

  • winuxcmd.* unit group: 36/36 passed, including 8 new tests — section grouping, alphabetical order inside sections, bare-vs---list-all command-set parity, flat listing shape, and the four locale-hint states (zh without catalog → hint; LANG=zh_CN.UTF-8 injection → hint; WINUX_LANG=en → silent; installed catalog → silent, help stays English / localized when WINUX_LANG=zh-CN).
  • Full unit suite: 2783 tests, only the 2 known symlink-privilege environment failures in grep fixtures (test-fixture create_directory_symlink needs elevation; fails before any dispatch).
  • Per-command dispatch loop: 178/178 registered commands dispatch with exit 0.
  • clang-format clean (scripts/format.sh); regenerated English catalog confirms all 16 new main.* keys are extractable (added to MANUAL_MESSAGES where helper-indirected).

Notes for reviewers

  • Per the cross-repo sync policy, the zh-CN translations for the new main.category.* / main.guide.* / main.i18n_hint keys should be added in unixwin/winuxcmd-i18n (with the mandatory VERSION bump) — the English fallbacks in this PR render fine meanwhile; missing keys fall back to English.
  • New published locales later: extend kLocalePackageHints in src/utils/i18n.cppm.

Closes #1155

…n locale hint (issue #1155)

Bare 'winuxcmd' printed 193 lines of registration-ordered command
summaries with no structure and no discovery guidance. Rework it:

- Group all registered commands into nine GNU coreutils-style sections
  (File operations, Text processing, Compare & patch, Numeric
  operations, Search tools, Checksums & encoding, Shell utilities,
  System & process, Terminal & documentation), alphabetical inside
  each section; uncategorized commands would fall into an 'Other
  utilities' catch-all so new commands stay visible.
- Print a discovery guide before the groups: 'winuxcmd <command>
  --help', 'winuxcmd help <command>', 'winuxcmd --list-all' and
  'wpm search <capability>'.
- Add 'winuxcmd --list-all' for the flat alphabetical listing.
- Detect the system locale with an injection-friendly precedence
  (WINUX_LANG > LC_ALL > LC_MESSAGES > LANG > GetUserDefaultLocaleName)
  and, when it is non-English and the matching WPM i18n catalog
  (#1151) is not installed, print one hint pointing at
  'wpm install winuxcmd-i18n-zh-cn' + WINUX_LANG=zh-CN. English
  locales, explicit WINUX_LANG=off and installed catalogs stay silent.

Command parsing and dispatch are untouched; all 178 registered
commands still dispatch (per-command --version loop green) and the
winuxcmd unit group passes 36/36, including new tests for section
grouping, alphabetical order, bare-vs-list-all parity, and the four
locale-hint states.
@caomengxuan666
caomengxuan666 merged commit d43215d into main Oct 10, 2026
4 checks passed
@caomengxuan666
caomengxuan666 deleted the ux/bare-output-i18n-hint branch October 10, 2026 06:40
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.

[ux] 裸 winuxcmd 无参输出 193 行平铺列表:分类分组 + i18n/locale 获取提示

1 participant