diff options
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/podman/search.go | 30 | ||||
-rw-r--r-- | cmd/podman/start.go | 2 |
2 files changed, 23 insertions, 9 deletions
diff --git a/cmd/podman/search.go b/cmd/podman/search.go index 064badec8..15dc1df11 100644 --- a/cmd/podman/search.go +++ b/cmd/podman/search.go @@ -7,6 +7,7 @@ import ( "strings" "github.com/containers/image/docker" + "github.com/docker/distribution/reference" "github.com/pkg/errors" "github.com/projectatomic/libpod/cmd/podman/formats" "github.com/projectatomic/libpod/cmd/podman/libpodruntime" @@ -43,10 +44,6 @@ var ( Name: "no-trunc", Usage: "do not truncate the output", }, - cli.StringSliceFlag{ - Name: "registry", - Usage: "specific registry to search", - }, cli.BoolTFlag{ Name: "tls-verify", Usage: "require HTTPS and verify certificates when contacting registries (default: true)", @@ -98,6 +95,15 @@ func searchCmd(c *cli.Context) error { } term := args[0] + // Check if search term has a registry in it + registry, err := getRegistry(term) + if err != nil { + return errors.Wrapf(err, "error getting registry from %q", term) + } + if registry != "" { + term = term[len(registry)+1:] + } + if err := validateFlags(c, searchFlags); err != nil { return err } @@ -116,7 +122,7 @@ func searchCmd(c *cli.Context) error { filter: c.StringSlice("filter"), authfile: c.String("authfile"), } - regAndSkipTLS, err := getRegistriesAndSkipTLS(c) + regAndSkipTLS, err := getRegistriesAndSkipTLS(c, registry) if err != nil { return err } @@ -158,7 +164,7 @@ func (s *searchParams) headerMap() map[string]string { } // A function for finding which registries can skip TLS -func getRegistriesAndSkipTLS(c *cli.Context) (map[string]bool, error) { +func getRegistriesAndSkipTLS(c *cli.Context, registry string) (map[string]bool, error) { // Variables for setting up Registry and TLSVerify tlsVerify := c.BoolT("tls-verify") forceSecure := false @@ -168,8 +174,8 @@ func getRegistriesAndSkipTLS(c *cli.Context) (map[string]bool, error) { } var registries []string - if len(c.StringSlice("registry")) > 0 { - registries = c.StringSlice("registry") + if registry != "" { + registries = append(registries, registry) } else { var err error registries, err = sysreg.GetRegistries() @@ -343,3 +349,11 @@ func matchesOfficialFilter(filter searchFilterParams, result docker.SearchResult } return true } + +func getRegistry(image string) (string, error) { + imgRef, err := reference.Parse(image) + if err != nil { + return "", err + } + return reference.Domain(imgRef.(reference.Named)), nil +} diff --git a/cmd/podman/start.go b/cmd/podman/start.go index e10d338d8..00528d04e 100644 --- a/cmd/podman/start.go +++ b/cmd/podman/start.go @@ -129,7 +129,7 @@ func startCmd(c *cli.Context) error { lastError = errors.Wrapf(err, "unable to start container %q", container) continue } - fmt.Println(ctr.ID()) + fmt.Println(container) } return lastError |