MCPcopy Create free account
hub / github.com/containers/image / familiarizeName

Function familiarizeName

docker/reference/normalize.go:112–126  ·  view source on GitHub ↗

familiarizeName returns a shortened version of the name familiar to the Docker UI. Familiar names have the default domain "docker.io" and "library/" repository prefix removed. For example, "docker.io/library/redis" will have the familiar name "redis" and "docker.io/dmcgowan/myapp" will be "dmcgowan/

(named namedRepository)

Source from the content-addressed store, hash-verified

110// name "redis" and "docker.io/dmcgowan/myapp" will be "dmcgowan/myapp".
111// Returns a familiarized named only reference.
112func familiarizeName(named namedRepository) repository {
113 repo := repository{
114 domain: named.Domain(),
115 path: named.Path(),
116 }
117
118 if repo.domain == defaultDomain {
119 repo.domain = ""
120 // Handle official repositories which have the pattern "library/<official repo name>"
121 if split := strings.Split(repo.path, "/"); len(split) == 2 && split[0] == officialRepoName {
122 repo.path = split[1]
123 }
124 }
125 return repo
126}
127
128func (r reference) Familiar() Named {
129 return reference{

Callers 4

FamiliarMethod · 0.85
FamiliarMethod · 0.85
FamiliarMethod · 0.85
FamiliarMethod · 0.85

Calls 2

DomainMethod · 0.65
PathMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…