-
Notifications
You must be signed in to change notification settings - Fork 177
Support format option in docker app ls #743
Conversation
Using either plain JSON or a go template Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
Codecov Report
@@ Coverage Diff @@
## master #743 +/- ##
=======================================
Coverage 70.81% 70.81%
=======================================
Files 64 64
Lines 3663 3663
=======================================
Hits 2594 2594
Misses 748 748
Partials 321 321 Continue to review full report at Codecov.
|
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
Could we add a test for this? |
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
9da966a
to
f723638
Compare
default: | ||
return defaultImageTableFormat | ||
} | ||
} |
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 should have written it like:
if source == formatter.TableFormatKey {
if quiet {
return formatter.DefaultQuietFormat
}
if digest {
return defaultImageTableFormatWithDigest
}
return defaultImageTableFormat
}
I don't see the usage of switch
with only one case and switch
on different variables.
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.
Because this code was a (simplified) version of the original formatter from docker/cli. Wanted to keep implementations in sync
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.
OK, I understand.
type imageContext struct { | ||
formatter.HeaderContext | ||
trunc bool | ||
i imageDesc |
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.
Why not ?
i imageDesc | |
image imageDesc |
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.
same reason
d30c6d7
to
cc7360f
Compare
set by cli/command/formatter/formatter.go#postFromat Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
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
- What I did
Introduced
--format
experimental option fordocker app ls
Can either pass a Go template (jist like most docker CLI commands) or just "json" to enable json output.
- How I did it
with love
- How to verify it
docker app ls --format "{{(index . 0).Reference}}"
docker app ls --format "json"
- Description for the changelog
Introduced
--format
experimental option fordocker app ls
- A picture of a cute animal (not mandatory)