fix(cli-framework): show global options in subcommand --help#4424
Conversation
Globals like --json were only listed under `superset --help`, not in group/command help (e.g. `superset auth --help`, `superset tasks list --help`). The `_globals` param was underscored/unused. Render it.
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe PR exposes ChangesGlobal Options Help Rendering
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryThis PR fixes
Confidence Score: 4/5Safe to merge; the change is display-only and does not affect CLI behavior or option parsing. The fix is narrowly scoped to help text rendering. The one rough edge is that packages/cli-framework/src/help.ts — specifically the
|
| Filename | Overview |
|---|---|
| packages/cli-framework/src/help.ts | Renames unused _globals param to globals in generateGroupHelp and generateCommandHelp, then renders a "Global options:" block and a --help, -h line — matching the root help output. |
Comments Outside Diff (1)
-
packages/cli-framework/src/help.ts, line 124-126 (link)The usage line appends
[options]only when the command has local options, so a command with no local options but with globals will display a usage likeUsage: superset auth login— even though global options are now shown below it. A reader following the usage line wouldn't know options are accepted at all.Prompt To Fix With AI
This is a comment left during a code review. Path: packages/cli-framework/src/help.ts Line: 124-126 Comment: The usage line appends `[options]` only when the command has local options, so a command with no local options but with globals will display a usage like `Usage: superset auth login` — even though global options are now shown below it. A reader following the usage line wouldn't know options are accepted at all. How can I resolve this? If you propose a fix, please make it concise.
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 1
packages/cli-framework/src/help.ts:124-126
The usage line appends `[options]` only when the command has local options, so a command with no local options but with globals will display a usage like `Usage: superset auth login` — even though global options are now shown below it. A reader following the usage line wouldn't know options are accepted at all.
```suggestion
if (
(node.options && Object.keys(node.options).length > 0) ||
(globals && Object.keys(globals).length > 0)
) {
usage += " [options]";
}
```
Reviews (1): Last reviewed commit: "fix(cli-framework): show global options ..." | Re-trigger Greptile
🚀 Preview Deployment🔗 Preview Links
Preview updates automatically with new commits |
Changes since v0.2.14: - workspaces: `superset workspaces list` now accepts `--project` and `--search` filters, matching the desktop list view. (#4455) - cli-framework: `--help` on a subcommand now shows the global options (e.g. `--json`, `--quiet`, `--api-key`) instead of hiding them. (#4424) - host-service: attachment upload no longer rejects unknown mediaType values returned by some hosts. (#4439) - host-service: PR fetch is now per-branch, avoiding 504s on repos with large numbers of open PRs. (#4268) Push cli-v0.2.15 after this lands to fire the release pipeline.
…t-sh#4424) Globals like --json were only listed under `superset --help`, not in group/command help (e.g. `superset auth --help`, `superset tasks list --help`). The `_globals` param was underscored/unused. Render it.
Summary
--json,--quiet, and--api-keywere declared as globals incli.config.tsbut only rendered undersuperset --help—superset <group> --helpandsuperset <group> <cmd> --helpsilently dropped them becausegenerateGroupHelp/generateCommandHelptook_globals(underscored, unused).--help, -hline) in both group and command help, matching the root help format.Test plan
superset --helpstill shows Global options (unchanged behavior)superset auth --helpnow lists--json,--quiet,--api-keysuperset auth login --helpnow lists themsuperset tasks list --helpnow lists thembun run lintcleanbun run typecheck --filter @superset/cli-frameworkpassesSummary by cubic
Fixes CLI help so global options show for subcommands.
superset <group> --helpandsuperset <group> <cmd> --helpnow display the Global options section (--json,--quiet,--api-key) and a--help, -hline, matching the root help.Written for commit d65e847. Summary will update on new commits.
Summary by CodeRabbit