Skip to content

Commit

Permalink
Rename StripRepository function for clarity
Browse files Browse the repository at this point in the history
Rename StripRepository -> FormatRepositoryForDisplay
  • Loading branch information
amisevsk committed Mar 1, 2024
1 parent 001fc4a commit 07389dc
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pkg/cmd/export/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func runCommand(opts *exportOptions) func(*cobra.Command, []string) {
}
store, err := getStoreForRef(cmd.Context(), opts)
if err != nil {
ref := repo.StripRepository(opts.modelRef.String())
ref := repo.FormatRepositoryForDisplay(opts.modelRef.String())
output.Fatalf("Failed to find reference %s: %s", ref, err)
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/list/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func getManifestInfoLine(repository string, desc ocispec.Descriptor, manifest *o
}

// Strip localhost from repo if present, since we added it
repository = repo.StripRepository(repository)
repository = repo.FormatRepositoryForDisplay(repository)
if repository == "" {
repository = "<none>"
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/lib/repo/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ func DefaultReference() *registry.Reference {
}
}

// StripRepository removes default values from a repository string to avoid surfacing defaulted fields
// FormatRepositoryForDisplay removes default values from a repository string to avoid surfacing defaulted fields
// when displaying references, which may be confusing.
func StripRepository(repo string) string {
func FormatRepositoryForDisplay(repo string) string {
repo = strings.TrimPrefix(repo, DefaultRegistry+"/")
repo = strings.TrimPrefix(repo, DefaultRepository)
return repo
Expand Down

0 comments on commit 07389dc

Please sign in to comment.