Skip to content

fix(help): show command flags in 'fastly help <subcommand>' matching '--help' - #1972

Merged
philippschulte merged 3 commits into
fastly:mainfrom
Tyagiquamar:fix/950-help-subcommand-flags
Nov 17, 2026
Merged

philippschulte merged 3 commits into
fastly:mainfrom
Tyagiquamar:fix/950-help-subcommand-flags

Conversation

@Tyagiquamar

@Tyagiquamar Tyagiquamar commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Change summary

Running fastly <subcommand> --help displays command-specific flags under REQUIRED FLAGS and OPTIONAL FLAGS, followed by GLOBAL FLAGS. However, running fastly help <subcommand> (e.g. fastly help service create) only printed GLOBAL FLAGS and completely omitted the subcommand's required and optional flags, as well as its detailed description.

In pkg/app/usage.go, VerboseUsageTemplate (the template used when parsing Kingpin help commands via app.Parse("help ...")) only included blocks for SUBCOMMANDS and GLOBAL FLAGS. It lacked template directives to render .Context.SelectedCommand.Help as well as .Context.Flags|RequiredFlags and .Context.Flags|OptionalFlags.

This PR updates VerboseUsageTemplate in pkg/app/usage.go to render command descriptions and flags, and adds regression unit tests in pkg/app/run_test.go (TestHelpSubcommandFlags).

Fixes #950

All Submissions:

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

Changes to Core Features:

  • Have you written new tests for your core changes, as applicable?
  • Have you successfully run tests with your changes locally?

User Impact

Users executing fastly help <subcommand> now see the full command description, required flags, and optional flags matching <subcommand> --help.

Are there any considerations that need to be addressed for release?

None. No breaking changes.

@philippschulte

Copy link
Copy Markdown
Member

@Tyagiquamar please update the description by using our template. Thank you!

@Tyagiquamar

Copy link
Copy Markdown
Contributor Author

@philippschulte Done! I have updated the PR description using the repository template with the change summary and checklists. Thank you!

@philippschulte philippschulte left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution and for addressing this inconsistency!

@philippschulte
philippschulte merged commit c4b3e66 into fastly:main Nov 17, 2026
15 checks passed
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.

output for fastly subcommand help and fastly subcommand --help don't match

2 participants