Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

imagefilter: improve supported filters discoverability #1198

Merged
merged 3 commits into from
Feb 10, 2025

Conversation

mvo5
Copy link
Contributor

@mvo5 mvo5 commented Feb 6, 2025

imagefilter: add SupportedFilter() that returns known
prefixes

This commit adds a new SupportedFilter() function that returns
the available filter prefixes.

See osbuild/image-builder-cli#104


imagefilter: show supported filters when giving one

This commit tweaks the error message for unsupported filter prefixes
to include what is actually supported.

See osbuild/image-builder-cli#104

mvo5 added 2 commits February 6, 2025 13:06
This commit tweaks the error message for unsupported filter prefixes
to include what is actually supported.

See osbuild/image-builder-cli#104
This commit adds a new `SupportedFilter()` function that returns
the available filter prefixes.

See osbuild/image-builder-cli#104
@mvo5 mvo5 requested a review from ondrejbudai February 6, 2025 12:15
@mvo5 mvo5 requested a review from a team as a code owner February 6, 2025 12:15
supakeen
supakeen previously approved these changes Feb 10, 2025
Copy link
Member

@supakeen supakeen left a comment

Choose a reason for hiding this comment

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

I'd probably prefer enums maybe but not really a blocker either.

This commit moves the "loose" strings for the filtering into
consts. Thanks to Simon for the suggestion.

Fwiw, we could also move this [0] into a
```go
var supportedFilters map[string]prefixMatchFunc{
    "distro": matcherFuncDistro,
    ...
}
```
which would mean the supportedFilters function and the actual
supported things can never go out of sync. The downside is that
we would still need to maintain the order of the supported filters
manually as some are just way more useful than others so naively
sorting goes not give the best user experience.

[0] See
osbuild@5e50e93
for a full version.
@mvo5
Copy link
Contributor Author

mvo5 commented Feb 10, 2025

I'd probably prefer enums maybe but not really a blocker either.

Sure thing, I updated the code with that (and some musings about possible other approaches).

@mvo5 mvo5 enabled auto-merge February 10, 2025 12:26
Copy link
Member

@ondrejbudai ondrejbudai left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@mvo5 mvo5 added this pull request to the merge queue Feb 10, 2025
Merged via the queue into osbuild:main with commit a79f2a5 Feb 10, 2025
18 checks passed
@mvo5 mvo5 deleted the expose-supported-filters branch February 10, 2025 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants