Merge pull request #366 from rhatdan/transports

Give more useful help when explaining usage
This commit is contained in:
Antonio Murdaca 2017-06-20 17:02:22 +02:00 committed by GitHub
commit 3b9ee4f322
4 changed files with 53 additions and 20 deletions

View File

@ -4,8 +4,10 @@ import (
"errors" "errors"
"fmt" "fmt"
"os" "os"
"strings"
"github.com/containers/image/copy" "github.com/containers/image/copy"
"github.com/containers/image/transports"
"github.com/containers/image/transports/alltransports" "github.com/containers/image/transports/alltransports"
"github.com/containers/image/types" "github.com/containers/image/types"
"github.com/urfave/cli" "github.com/urfave/cli"
@ -63,8 +65,17 @@ func copyHandler(context *cli.Context) error {
} }
var copyCmd = cli.Command{ var copyCmd = cli.Command{
Name: "copy", Name: "copy",
Usage: "Copy an image from one location to another", Usage: "Copy an IMAGE-NAME from one location to another",
Description: fmt.Sprintf(`
Container "IMAGE-NAME" uses a "transport":"details" format.
Supported transports:
%s
See skopeo(1) section "IMAGE NAMES" for the expected format
`, strings.Join(transports.ListNames(), ", ")),
ArgsUsage: "SOURCE-IMAGE DESTINATION-IMAGE", ArgsUsage: "SOURCE-IMAGE DESTINATION-IMAGE",
Action: copyHandler, Action: copyHandler,
// FIXME: Do we need to namespace the GPG aspect? // FIXME: Do we need to namespace the GPG aspect?

View File

@ -3,7 +3,9 @@ package main
import ( import (
"errors" "errors"
"fmt" "fmt"
"strings"
"github.com/containers/image/transports"
"github.com/containers/image/transports/alltransports" "github.com/containers/image/transports/alltransports"
"github.com/urfave/cli" "github.com/urfave/cli"
) )
@ -29,8 +31,16 @@ func deleteHandler(context *cli.Context) error {
} }
var deleteCmd = cli.Command{ var deleteCmd = cli.Command{
Name: "delete", Name: "delete",
Usage: "Delete image IMAGE-NAME", Usage: "Delete image IMAGE-NAME",
Description: fmt.Sprintf(`
Delete an "IMAGE_NAME" from a transport
Supported transports:
%s
See skopeo(1) section "IMAGE NAMES" for the expected format
`, strings.Join(transports.ListNames(), ", ")),
ArgsUsage: "IMAGE-NAME", ArgsUsage: "IMAGE-NAME",
Action: deleteHandler, Action: deleteHandler,
Flags: []cli.Flag{ Flags: []cli.Flag{

View File

@ -9,6 +9,7 @@ import (
"github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/containers/image/docker" "github.com/containers/image/docker"
"github.com/containers/image/manifest" "github.com/containers/image/manifest"
"github.com/containers/image/transports"
"github.com/opencontainers/go-digest" "github.com/opencontainers/go-digest"
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/urfave/cli" "github.com/urfave/cli"
@ -29,8 +30,16 @@ type inspectOutput struct {
} }
var inspectCmd = cli.Command{ var inspectCmd = cli.Command{
Name: "inspect", Name: "inspect",
Usage: "Inspect image IMAGE-NAME", Usage: "Inspect image IMAGE-NAME",
Description: fmt.Sprintf(`
Return low-level information about "IMAGE-NAME" in a registry/transport
Supported transports:
%s
See skopeo(1) section "IMAGE NAMES" for the expected format
`, strings.Join(transports.ListNames(), ", ")),
ArgsUsage: "IMAGE-NAME", ArgsUsage: "IMAGE-NAME",
Flags: []cli.Flag{ Flags: []cli.Flag{
cli.StringFlag{ cli.StringFlag{

View File

@ -12,26 +12,29 @@ It also allows you to copy container images between various registries, possibly
## IMAGE NAMES ## IMAGE NAMES
Most commands refer to container images, using a _transport_`:`_details_ format. The following formats are supported: Most commands refer to container images, using a _transport_`:`_details_ format. The following formats are supported:
**atomic:**_namespace_**/**_stream_**:**_tag_ **atomic:**_hostname_**/**_namespace_**/**_stream_**:**_tag_
An image in the current project of the current default Atomic An image served by an OpenShift(Atomic) Registry server. The current OpenShift project and OpenShift Registry instance are by default read from `$HOME/.kube/config`, which is set e.g. using `(oc login)`.
Registry. The current project and Atomic Registry instance are by
default read from `$HOME/.kube/config`, which is set e.g. using **containers-storage://**_docker-reference_
`(oc login)`. An image located in a local containers/storage image store. Location and image store specified in /etc/containers/storage.conf
**dir:**_path_ **dir:**_path_
An existing local directory _path_ storing the manifest, layer An existing local directory _path_ storing the manifest, layer tarballs and signatures as individual files. This is a non-standardized format, primarily useful for debugging or noninvasive container inspection.
tarballs and signatures as individual files. This is a
non-standardized format, primarily useful for debugging or
noninvasive container inspection.
**docker://**_docker-reference_ **docker://**_docker-reference_
An image in a registry implementing the "Docker Registry HTTP API V2". An image in a registry implementing the "Docker Registry HTTP API V2". By default, uses the authorization state in `$HOME/.docker/config.json`, which is set e.g. using `(docker login)`.
By default, uses the authorization state in `$HOME/.docker/config.json`,
which is set e.g. using `(docker login)`. **docker-archive:**_path_[**:**_docker-reference_]
An image is stored in the `docker save` formated file. _docker-reference_ is only used when creating such a file, and it must not contain a digest.
**docker-daemon:**_docker-reference_
An image _docker-reference_ stored in the docker daemon internal storage. _docker-reference_ must contain either a tag or a digest. Alternatively, when reading images, the format can also be docker-daemon:algo:digest (an image ID).
**oci:**_path_**:**_tag_ **oci:**_path_**:**_tag_
An image _tag_ in a directory compliant with "Open Container Image An image _tag_ in a directory compliant with "Open Container Image Layout Specification" at _path_.
Layout Specification" at _path_.
**ostree:**_image_[**@**_/absolute/repo/path_]
An image in local OSTree repository. _/absolute/repo/path_ defaults to _/ostree/repo_.
# OPTIONS # OPTIONS