-
Notifications
You must be signed in to change notification settings - Fork 57
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
pkg/imagefilter/formatter: add shell
output
#1166
Conversation
681c2b3
to
b3db281
Compare
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.
This is very nice, thank you!
I would love a test as well, maybe something like
index c866d2a30..40640261a 100644
--- a/pkg/imagefilter/formatter_test.go
+++ b/pkg/imagefilter/formatter_test.go
@@ -65,6 +65,11 @@ func TestResultsFormatter(t *testing.T) {
},
`[{"distro":{"name":"test-distro-1"},"arch":{"name":"test_arch3"},"image_type":{"name":"qcow2"}},{"distro":{"name":"test-distro-1"},"arch":{"name":"test_arch"},"image_type":{"name":"test_type"}}]` + "\n",
},
+ {
+ "shell",
+ []string{"test-distro-1:qcow2:test_arch3"},
+ "test-distro-1 --type type:qcow2 --arch arch:test_arch3\n",
+ },
} {
res := make([]imagefilter.Result, len(tc.fakeResults))
for i, resultSpec := range tc.fakeResults {
(I did not test this) is already enough?
b3db281
to
82415d1
Compare
of course I missed the test 😭 sorry |
This should implement the initial idea of a copy'n'paste ready list of possibilities.
82415d1
to
16cb0bd
Compare
if len(errs) > 0 { | ||
return errors.Join(errs...) | ||
} | ||
|
||
return nil |
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 believe you can do return errors.Join(errs...)
directly here. errors.Join
discards nil-values
in errors and returns nil
when it only has nil
s in its arguments (or when called with an empty slice).
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.
Thank you for adding the test. This looks fine to me now.
This should implement the initial idea of a
copy'n'paste ready list of possibilities.