Skip to content

setup: plain-text help/non-tty banner (#195); warn on hand-written rc theme (#196) - #229

Merged
caomengxuan666 merged 1 commit into
masterfrom
fix/setup-help-ansi
Oct 9, 2026
Merged

caomengxuan666 merged 1 commit into
masterfrom
fix/setup-help-ansi

Conversation

@caomengxuan666

Copy link
Copy Markdown
Member

Summary

One PR closes two P3 issues.

#195 — niu setup --help printed raw ANSI art on non-tty stdout

  • niu setup --help / -h now answers with a plain-text usage block and exits, instead of launching the wizard (on a tty or off one — help is always readable).
  • The wizard's welcome banner (also hit by niu setup, niu setup --preset ... in pipes/CI) now checks stdout is_terminal(): on a tty the ANSI pixel-art logo is unchanged; when stdout is not a terminal the banner degrades to plain text (same welcome content, zero escape sequences).

#196 — theme belongs in plugins.toml, not a hand-written OSH_THEME in the rc

  • niu plugin sync now detects a hand-written OSH_THEME=/BASH_IT_THEME= (export optional) assignment outside the managed marker blocks and prints a one-shot stderr warning pointing at ~/.niubash/plugins.toml (theme = "..." on the source entry). The startup --bootstrap form stays silent, so shell boots are not nagged.
  • Docs: a "Setting the theme correctly" / 「正确设置主题」 section in README.md and README-zh.md, plus a warning note at the theme field docs in docs/plugins-guide.md.

Test plan

  • New tests/issue195_setup_help_plain.rs: setup --help / -h output contains no ANSI escapes; piped non-interactive niu setup output contains no ANSI escapes and still completes the wizard — all pass.
  • Unit test stray_theme_scan_sees_only_lines_outside_managed_blocks in plugins/assets.rs — passes.
  • Existing suites green: plugin_sources, plugin_assets, plugin_spec_sync, startup_files, smoke_1_3_0 (setup wizard journey included).
  • cargo fmt clean.
  • Manual: niu plugin sync with a stray export OSH_THEME=agnoster rc line prints the new warning and points at the spec.

closes #195
closes #196

…rc theme (#196)

#195: `niu setup --help`/`-h` now answers with a plain-text usage block
instead of running the wizard, and the non-tty wizard banner (pipes,
redirects, CI) drops the ANSI pixel-art logo while keeping the welcome
text. On a tty the art is unchanged.

#196: the supported theme channel is the `theme` field of a `[[sources]]`
entry in `~/.niubash/plugins.toml`; a hand-written `export OSH_THEME=...`
line in the rc is shadowed/dropped when sync rewrites the managed blocks.
`niu plugin sync` now detects stray hand-written theme assignments
outside the managed blocks and prints a one-shot stderr warning pointing
at the spec (startup `--bootstrap` form stays silent). READMEs and
docs/plugins-guide.md gain a "Setting the theme correctly" note.

Closes #195, closes #196.

Tests: tests/issue195_setup_help_plain.rs (3 asserts, all no-ESC),
unit test for the stray scan, existing setup/sync suites green.
@caomengxuan666
caomengxuan666 merged commit 68e4d09 into master Oct 9, 2026
9 checks passed
@caomengxuan666
caomengxuan666 deleted the fix/setup-help-ansi branch October 9, 2026 11:55
caomengxuan666 added a commit that referenced this pull request Oct 10, 2026
- Delete docs/eco-harvest-resume-wt97b.md: point-in-time lane resume/handoff snapshot; the harvest/test line now runs on GitHub Actions (eco-harvest-ci.yml) and the diagnosis lives in git history.
- CHANGELOG: add Unreleased entries for strip (#228), setup help/non-tty banner (#229), bundled niugit/ripgrep/fd + setup detection (#230/#231), PROMPT_COMMAND exit jump (#232), PS0 stderr (#233), bracketed paste (#234).

Co-authored-by: docs-audit <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant