mirror of
https://github.com/containers/skopeo.git
synced 2025-08-02 07:17:46 +00:00
Merge pull request #992 from rhatdan/inspect
Make InspectOutput an external object
This commit is contained in:
commit
c052ed7ec8
@ -5,35 +5,19 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/containers/image/v5/docker"
|
"github.com/containers/image/v5/docker"
|
||||||
"github.com/containers/image/v5/image"
|
"github.com/containers/image/v5/image"
|
||||||
"github.com/containers/image/v5/manifest"
|
"github.com/containers/image/v5/manifest"
|
||||||
"github.com/containers/image/v5/transports"
|
"github.com/containers/image/v5/transports"
|
||||||
"github.com/containers/image/v5/types"
|
"github.com/containers/image/v5/types"
|
||||||
digest "github.com/opencontainers/go-digest"
|
"github.com/containers/skopeo/cmd/skopeo/inspect"
|
||||||
v1 "github.com/opencontainers/image-spec/specs-go/v1"
|
v1 "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
// inspectOutput is the output format of (skopeo inspect), primarily so that we can format it with a simple json.MarshalIndent.
|
|
||||||
type inspectOutput struct {
|
|
||||||
Name string `json:",omitempty"`
|
|
||||||
Tag string `json:",omitempty"`
|
|
||||||
Digest digest.Digest
|
|
||||||
RepoTags []string
|
|
||||||
Created *time.Time
|
|
||||||
DockerVersion string
|
|
||||||
Labels map[string]string
|
|
||||||
Architecture string
|
|
||||||
Os string
|
|
||||||
Layers []string
|
|
||||||
Env []string
|
|
||||||
}
|
|
||||||
|
|
||||||
type inspectOptions struct {
|
type inspectOptions struct {
|
||||||
global *globalOptions
|
global *globalOptions
|
||||||
image *imageOptions
|
image *imageOptions
|
||||||
@ -164,7 +148,7 @@ func (opts *inspectOptions) run(args []string, stdout io.Writer) (retErr error)
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
outputData := inspectOutput{
|
outputData := inspect.Output{
|
||||||
Name: "", // Set below if DockerReference() is known
|
Name: "", // Set below if DockerReference() is known
|
||||||
Tag: imgInspect.Tag,
|
Tag: imgInspect.Tag,
|
||||||
// Digest is set below.
|
// Digest is set below.
|
||||||
|
23
cmd/skopeo/inspect/output.go
Normal file
23
cmd/skopeo/inspect/output.go
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
package inspect
|
||||||
|
|
||||||
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
|
digest "github.com/opencontainers/go-digest"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Output is the output format of (skopeo inspect),
|
||||||
|
// primarily so that we can format it with a simple json.MarshalIndent.
|
||||||
|
type Output struct {
|
||||||
|
Name string `json:",omitempty"`
|
||||||
|
Tag string `json:",omitempty"`
|
||||||
|
Digest digest.Digest
|
||||||
|
RepoTags []string
|
||||||
|
Created *time.Time
|
||||||
|
DockerVersion string
|
||||||
|
Labels map[string]string
|
||||||
|
Architecture string
|
||||||
|
Os string
|
||||||
|
Layers []string
|
||||||
|
Env []string
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user