option: add a Text-based presenter

Signed-off-by: Alfredo Deza <adeza@anchore.com>
This commit is contained in:
Alfredo Deza 2020-06-19 15:45:58 -04:00
parent 2cb7dad967
commit acbeea9800
5 changed files with 39 additions and 0 deletions

View File

@ -5,15 +5,18 @@ import "strings"
const (
UnknownPresenter Option = iota
JSONPresenter
TextPresenter
)
var optionStr = []string{
"UnknownPresenter",
"json",
"text",
}
var Options = []Option{
JSONPresenter,
TextPresenter,
}
type Option int
@ -22,6 +25,8 @@ func ParseOption(userStr string) Option {
switch strings.ToLower(userStr) {
case strings.ToLower(JSONPresenter.String()):
return JSONPresenter
case strings.ToLower(TextPresenter.String()):
return TextPresenter
default:
return UnknownPresenter
}

View File

@ -0,0 +1,4 @@
# Note: changes to this file will result in updating several test values. Consider making a new image fixture instead of editing this one.
FROM scratch
ADD file-1.txt /somefile-1.txt
ADD file-2.txt /somefile-2.txt

View File

@ -0,0 +1 @@
this file has contents

View File

@ -0,0 +1 @@
file-2 contents!

View File

@ -0,0 +1,28 @@
[Image]
Layer: 0
Digest: sha256:056c0789fa9ad629ceae6d09713fb035f84115af3c4a88a43aa60f13bc683053
Size: 22
MediaType: application/vnd.docker.image.rootfs.diff.tar.gzip
Layer: 1
Digest: sha256:b461c48116592c570a66fed71d5b09662a8172e168b7938cf317af47872cdc9b
Size: 16
MediaType: application/vnd.docker.image.rootfs.diff.tar.gzip
Layer: 2
Digest: sha256:00b80053e05c01da485015610d288ce3185fac00d251e2ada02b45a7a7c5f589
Size: 27
MediaType: application/vnd.docker.image.rootfs.diff.tar.gzip
[package-1]
Version: 1.0.1
Type: deb
Metadata: <nil>
Found by: dpkg
[package-2]
Version: 2.0.1
Type: deb
Metadata: {package-2 1.0.2}
Found by: dpkg