Skip to content

cmd/snapd/cli: search all given sections instead of only the last one - #17414

Open
Basit-Balogun10 wants to merge 1 commit into
canonical:masterfrom
Basit-Balogun10:fix-lp1986425-section-repeat-flag
Open

cmd/snapd/cli: search all given sections instead of only the last one#17414
Basit-Balogun10 wants to merge 1 commit into
canonical:masterfrom
Basit-Balogun10:fix-lp1986425-section-repeat-flag

Conversation

@Basit-Balogun10

@Basit-Balogun10 Basit-Balogun10 commented Jul 27, 2026

Copy link
Copy Markdown

snap find --section=games --section=social silently searched only social, discarding games
with no error. Section is a scalar field on the CLI side (cmd_find.go), so repeated flags just
overwrote each other via go-flags' default behavior.

The store's /v2/find category parameter (which section is an alias for) already accepts a
comma-separated list and matches any of them (I also confirmed directly against the real store).

So we're basically making SectionName implement flags.Unmarshaler so repeated --section flags accumulate into one comma-separated value instead of overwriting, and then validate each requested section individually against the known list.


BEFORE (MULTIPLE SECTIONS SEARCH):

image

AFTER (MULTIPLE SECTIONS SEARCH):

6il0ATzNxuoS

BEFORE (INVALID SECTION NAMES):

image

AFTER (INVALID SECTION NAMES):

nGkWpugmZxa0

AI assistance: Claude Code helped diagnose and validate this.

Fixes: LP#1986425

snap find --section=games --section=social silently searched only
"social", discarding "games" with no error - Section is a scalar
field, so repeated flags just overwrote each other.

The store's /v2/find "category" parameter (section is an alias for
it) already accepts a comma-separated list and matches any of them -
confirmed directly against the real store. Make SectionName
implement flags.Unmarshaler so repeated --section flags, and
comma-separated values within a single occurrence, all flatten into
one combined comma-joined value instead of overwriting; validate
each requested section individually against the known list and list
all unrecognized ones, not just the first. No daemon or client
changes needed, since the comma-joined string flows through the
existing Section field unchanged.

Fixes: LP#1986425
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.

1 participant