Skip to content

fix: remove commands --sort flag when not unsupported - #1546

Closed
goransh-walia wants to merge 2 commits into
hetznercloud:mainfrom
goransh-walia:fix/issue-1536-240
Closed

goransh-walia wants to merge 2 commits into
hetznercloud:mainfrom
goransh-walia:fix/issue-1536-240

Conversation

@goransh-walia

Copy link
Copy Markdown

Fixes #1536

Summary

This PR prevents the --sort flag from appearing in the help text and documentation for list commands that do not support sorting.

Root cause

The ListCmd implementation unconditionally added the sort flag to the cobra command, regardless of whether the SortOption field was initialized.

Changes

  • Updated internal/cmd/base/list.go to wrap the --sort flag definition in a nil check for lc.SortOption.

Testing

  • Added a regression test in internal/cmd/base/list_test.go (not executed locally).
  • Relying on CI to confirm full test suite passing.

AI-assisted.

@goransh-walia
goransh-walia requested a review from a team as a code owner November 17, 2026 11:28
@jooola jooola changed the title Fix: List command: --sort shown where sorting is unsupported fix: remove commands --sort flag when not unsupported Nov 17, 2026
@jooola

jooola commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

We appreciate the intend, but the changes in this PR are not good enough. Next time, please run the tests locally, run the linter, and make sure the generated files are up to date.

Closing.

@jooola jooola closed this Nov 17, 2026
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.

List command: --sort shown where sorting is unsupported

2 participants