-
Notifications
You must be signed in to change notification settings - Fork 56
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
Conversation
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
There was a problem hiding this 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.
Sure thing, I updated the code with that (and some musings about possible other approaches). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
imagefilter: add
SupportedFilter()
that returns knownprefixes
This commit adds a new
SupportedFilter()
function that returnsthe 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