fix(cli): make incident list --channel match sibling list verbs - #160
Merged
Conversation
incident list was the only list verb that filtered by channel via --channel-id (a single int64), while alert list, alert-event list, and change list all use --channel (a comma-separated string parsed into multiple channel IDs). The underlying API (ListIncidentsRequest.ChannelIDs []int64) already supports multiple channel IDs, so incident list's flag was an unnecessary outlier rather than a capability gap. Add --channel string to incident list, parsed with the same parseIntSlice helper alert list and change list already use, and forward it as ChannelIDs. Keep --channel-id working as a deprecated, hidden single-ID alias via cobra's MarkDeprecated so existing scripts do not break; --channel wins when both are set. internal/skilldoc/build.go's command() walked every flag via Flags().VisitAll without skipping hidden ones, so the generated skill card for incident list would have kept showing the now-hidden --channel-id. Filter out hidden flags there, matching the existing hidden/deprecated skip one level up for commands themselves, then regenerate skills/flashduty/reference/incident.md via 'make gen-cards'. Verified: - go build ./... and go test ./... pass - 'incident list --help' shows --channel and no longer shows --channel-id - 'incident list --channel-id 1 --help' still exits 0 and prints pflag's deprecation notice on stderr - 'make check-cards' passes, confirming the skill card and CLI flag set are back in lockstep
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
incident listwas the onlylistverb whose channel filter used--channel-id <int64>(a single channel ID). Every otherlistverb —alert list,alert-event list,change list— filters by channel via--channel <comma-separated IDs>. A user or script that learned the--channelconvention from any of those commands and then triedincident list --channel <id>gotunknown flag: --channel.The API this command calls already supports multiple channel IDs
(
ListIncidentsRequest.ChannelIDs []int64), so this was a naminginconsistency in the CLI, not a capability gap in the backend.
Fix
incident listnow takes--channel <string>, comma-separated channelIDs, parsed with the same
parseIntSlicehelperalert listandchange listalready use, and forwarded asChannelIDs.--channel-idis kept working as a deprecated, hidden single-ID alias(
cobra'sMarkDeprecated, which also hides it from--help) soexisting scripts that pass
--channel-idkeep working.--channelwins if both are passed.
internal/skilldoc/build.go's flag walk (used to generate theskills/flashdutycommand reference cards) did not skip hidden flags,so the generated card for
incident listwould have kept documentingthe now-hidden
--channel-id. Added a one-line filter to skip hiddenflags, matching the existing hidden/deprecated skip that already
applies one level up, to commands themselves. Regenerated
skills/flashduty/reference/incident.mdviamake gen-cards.Verification