Skip to content

feat: modern boxed help output for affine CLI#345

Open
dataCenter430 wants to merge 2 commits intoAffineFoundation:mainfrom
dataCenter430:feat/modern-cli-help-formatter
Open

feat: modern boxed help output for affine CLI#345
dataCenter430 wants to merge 2 commits intoAffineFoundation:mainfrom
dataCenter430:feat/modern-cli-help-formatter

Conversation

@dataCenter430
Copy link
Copy Markdown

@dataCenter430 dataCenter430 commented Apr 11, 2026

closes : #344

Summary

  • Add affine/cli/help.py with AffineHelpFormatter, AffineContext, and AffineGroup — a custom Click help formatter that renders fully-enclosed section boxes (┌─ Options ─┐ / │ ... │ / └───────────┘) with colored output on wide terminals (≥ 100 cols), and falls back to standard Click formatting on narrow terminals
  • Bold-yellow Usage: + program name, dimmed args — matching btcli/gitt CLI style
  • Cyan command/option names inside boxes
  • Patch click.Context.make_formatter globally so every command (af get-envs --help, af validate --help, etc.) picks up the formatter without needing per-decorator changes
  • Wire AffineGroup / AffineContext into main.py for the top-level cli and servers groups, and inject context_class into the imported db and miner_stats groups

Behaviour

Terminal width Output
< 100 cols Standard Click plain-text help (unchanged)
≥ 100 cols Boxed sections, colored names, yellow Usage line

Files changed

  • affine/cli/help.py — new file (formatter, context, group classes)
  • affine/cli/main.py — import + wire-up (7 lines changed)

Before:

image

Afer:

image image image

@dataCenter430
Copy link
Copy Markdown
Author

Hi, @angosr
Would you please review the PR when you have a chance?
Please provide me your feedback.

@dataCenter430
Copy link
Copy Markdown
Author

Hi, @angosr
Would you please review this PR?

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.

Improve help CLI output like modern CLI output - btcli and gitt CLI

1 participant