Add --format option to skopeo inspect

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
Daniel J Walsh
2020-11-17 09:03:48 -05:00
parent 82e461ff9d
commit 5d73dea577
11 changed files with 479 additions and 34 deletions

View File

@@ -0,0 +1,27 @@
package report
import (
"io"
"text/tabwriter"
)
// Writer aliases tabwriter.Writer to provide Podman defaults
type Writer struct {
*tabwriter.Writer
}
// NewWriter initializes a new report.Writer with given values
func NewWriter(output io.Writer, minwidth, tabwidth, padding int, padchar byte, flags uint) (*Writer, error) {
t := tabwriter.NewWriter(output, minwidth, tabwidth, padding, padchar, flags)
return &Writer{t}, nil
}
// NewWriterDefault initializes a new report.Writer with Podman defaults
func NewWriterDefault(output io.Writer) (*Writer, error) {
return NewWriter(output, 12, 2, 2, ' ', 0)
}
// Flush any output left in buffers
func (w *Writer) Flush() error {
return w.Writer.Flush()
}