mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-12-11 15:40:24 +00:00
e5d9b68d36
Bumps the golang-dependencies group with 1 update: [golang.org/x/crypto](https://github.com/golang/crypto). Updates `golang.org/x/crypto` from 0.16.0 to 0.17.0 - [Commits](https://github.com/golang/crypto/compare/v0.16.0...v0.17.0) --- updated-dependencies: - dependency-name: golang.org/x/crypto dependency-type: direct:production update-type: version-update:semver-minor dependency-group: golang-dependencies ... Signed-off-by: dependabot[bot] <support@github.com>
43 lines
1.1 KiB
Go
43 lines
1.1 KiB
Go
package reference
|
|
|
|
import "path"
|
|
|
|
// IsNameOnly returns true if reference only contains a repo name.
|
|
func IsNameOnly(ref Named) bool {
|
|
if _, ok := ref.(NamedTagged); ok {
|
|
return false
|
|
}
|
|
if _, ok := ref.(Canonical); ok {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
// FamiliarName returns the familiar name string
|
|
// for the given named, familiarizing if needed.
|
|
func FamiliarName(ref Named) string {
|
|
if nn, ok := ref.(normalizedNamed); ok {
|
|
return nn.Familiar().Name()
|
|
}
|
|
return ref.Name()
|
|
}
|
|
|
|
// FamiliarString returns the familiar string representation
|
|
// for the given reference, familiarizing if needed.
|
|
func FamiliarString(ref Reference) string {
|
|
if nn, ok := ref.(normalizedNamed); ok {
|
|
return nn.Familiar().String()
|
|
}
|
|
return ref.String()
|
|
}
|
|
|
|
// FamiliarMatch reports whether ref matches the specified pattern.
|
|
// See [path.Match] for supported patterns.
|
|
func FamiliarMatch(pattern string, ref Reference) (bool, error) {
|
|
matched, err := path.Match(pattern, FamiliarString(ref))
|
|
if namedRef, isNamed := ref.(Named); isNamed && !matched {
|
|
matched, _ = path.Match(pattern, FamiliarName(namedRef))
|
|
}
|
|
return matched, err
|
|
}
|