feat(pkg): show full repo names in search results
All checks were successful
Security Scan / security (push) Successful in 16s
All checks were successful
Security Scan / security (push) Successful in 16s
Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
parent
04d244425b
commit
4c072f9463
2 changed files with 8 additions and 2 deletions
|
|
@ -231,6 +231,7 @@ func TestRenderPkgSearchResults_ShowsMetadata(t *testing.T) {
|
||||||
out := capturePkgOutput(t, func() {
|
out := capturePkgOutput(t, func() {
|
||||||
renderPkgSearchResults([]ghRepo{
|
renderPkgSearchResults([]ghRepo{
|
||||||
{
|
{
|
||||||
|
FullName: "host-uk/core-alpha",
|
||||||
Name: "core-alpha",
|
Name: "core-alpha",
|
||||||
Description: "Alpha package",
|
Description: "Alpha package",
|
||||||
Visibility: "private",
|
Visibility: "private",
|
||||||
|
|
@ -243,7 +244,7 @@ func TestRenderPkgSearchResults_ShowsMetadata(t *testing.T) {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
assert.Contains(t, out, "core-alpha")
|
assert.Contains(t, out, "host-uk/core-alpha")
|
||||||
assert.Contains(t, out, "Alpha package")
|
assert.Contains(t, out, "Alpha package")
|
||||||
assert.Contains(t, out, "42 stars")
|
assert.Contains(t, out, "42 stars")
|
||||||
assert.Contains(t, out, "Go")
|
assert.Contains(t, out, "Go")
|
||||||
|
|
|
||||||
|
|
@ -213,6 +213,11 @@ func renderPkgSearchResults(repos []ghRepo) {
|
||||||
fmt.Print(i18n.T("cmd.pkg.search.found_repos", map[string]int{"Count": len(repos)}) + "\n\n")
|
fmt.Print(i18n.T("cmd.pkg.search.found_repos", map[string]int{"Count": len(repos)}) + "\n\n")
|
||||||
|
|
||||||
for _, r := range repos {
|
for _, r := range repos {
|
||||||
|
displayName := strings.TrimSpace(r.FullName)
|
||||||
|
if displayName == "" {
|
||||||
|
displayName = r.Name
|
||||||
|
}
|
||||||
|
|
||||||
visibility := ""
|
visibility := ""
|
||||||
if r.Visibility == "private" {
|
if r.Visibility == "private" {
|
||||||
visibility = dimStyle.Render(" " + i18n.T("cmd.pkg.search.private_label"))
|
visibility = dimStyle.Render(" " + i18n.T("cmd.pkg.search.private_label"))
|
||||||
|
|
@ -226,7 +231,7 @@ func renderPkgSearchResults(repos []ghRepo) {
|
||||||
desc = dimStyle.Render(i18n.T("cmd.pkg.no_description"))
|
desc = dimStyle.Render(i18n.T("cmd.pkg.no_description"))
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Printf(" %s%s\n", repoNameStyle.Render(r.Name), visibility)
|
fmt.Printf(" %s%s\n", repoNameStyle.Render(displayName), visibility)
|
||||||
fmt.Printf(" %s\n", desc)
|
fmt.Printf(" %s\n", desc)
|
||||||
|
|
||||||
if meta := formatPkgSearchMetadata(r); meta != "" {
|
if meta := formatPkgSearchMetadata(r); meta != "" {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue