fix(cli): remove FLAGS section from root --help (#1226)

Follow-up to #1223. The hand-written FLAGS block in `lark-cli --help`
restated leaf-command flags at the root level — flags that are not
registered on the root command (they error "unknown flag" there). Even
trimmed to an illustrative example list, it duplicated information Cobra's
per-command `--help` already renders authoritatively, and any static list
in root help drifts from the real per-command flag sets over time.

Drop the section entirely: Cobra's per-command `Flags:` output is the
single source of truth. `USAGE:`/`EXAMPLES:` still show flags in context,
and the `Flags:` block at the bottom of root help lists the actual root
flags. Also removes the now-obsolete TestRootLong_FlagsSectionPointsToCommandHelp.
This commit is contained in:
liangshuo-1
2026-06-02 20:31:45 +08:00
committed by GitHub
parent b0b163d0ef
commit b216363e63
2 changed files with 0 additions and 15 deletions

View File

@@ -48,10 +48,6 @@ EXAMPLES:
# Generic API call
lark-cli api GET /open-apis/calendar/v4/calendars
FLAGS:
e.g. --as, --format, -q/--jq, --dry-run ...
Run lark-cli <command> --help for the full list.
AI AGENT SKILLS:
lark-cli pairs with AI agent skills (Claude Code, etc.) that
teach the agent Lark API patterns, best practices, and workflows.

View File

@@ -83,17 +83,6 @@ func TestRootLong_AgentSkillsLinkTargetsReadmeSection(t *testing.T) {
}
}
func TestRootLong_FlagsSectionPointsToCommandHelp(t *testing.T) {
// The flags shown in root help live on leaf commands (api, service), not
// on the root command — every one errors "unknown flag" at the top level.
// So the FLAGS section may only list them as examples and must route to
// `<command> --help` for the full set, rather than re-list them as if they
// were global root flags (which both lies and drifts as flags change).
if !strings.Contains(rootLong, "lark-cli <command> --help") {
t.Fatalf("root help FLAGS section must point to `lark-cli <command> --help` for the flag list, got:\n%s", rootLong)
}
}
func TestConfigureFlagCompletions(t *testing.T) {
t.Cleanup(func() { cmdutil.SetFlagCompletionsEnabled(false) })