mirror of
https://github.com/containers/skopeo.git
synced 2025-06-01 19:25:29 +00:00
22 lines
535 B
Go
22 lines
535 B
Go
package skopeo
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
|
|
"github.com/codegangsta/cli"
|
|
"github.com/projectatomic/skopeo/types"
|
|
)
|
|
|
|
// ParseImage converts image URL-like string to an initialized handler for that image.
|
|
func ParseImage(c *cli.Context) (types.Image, error) {
|
|
imgName := c.Args().First()
|
|
switch {
|
|
case strings.HasPrefix(imgName, types.DockerPrefix):
|
|
return parseDockerImage(strings.TrimPrefix(imgName, types.DockerPrefix))
|
|
//case strings.HasPrefix(img, appcPrefix):
|
|
//
|
|
}
|
|
return nil, fmt.Errorf("no valid prefix provided")
|
|
}
|