aboutsummaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
Diffstat (limited to 'libpod')
-rw-r--r--libpod/image/parts.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/libpod/image/parts.go b/libpod/image/parts.go
index 1509005e5..9adf26fb9 100644
--- a/libpod/image/parts.go
+++ b/libpod/image/parts.go
@@ -22,6 +22,18 @@ func isRegistry(name string) bool {
return strings.ContainsAny(name, ".:") || name == "localhost"
}
+// GetImageBaseName uses decompose and string splits to obtain the base
+// name of an image. Doing this here because it beats changing the
+// imageParts struct names to be exported as well.
+func GetImageBaseName(input string) (string, error) {
+ decomposedImage, err := decompose(input)
+ if err != nil {
+ return "", err
+ }
+ splitImageName := strings.Split(decomposedImage.name, "/")
+ return splitImageName[len(splitImageName)-1], nil
+}
+
// decompose breaks an input name into an imageParts description
func decompose(input string) (imageParts, error) {
var (