Skip to content

Commit ea4968e

Browse files
committed
Update search.go
Users opened task inside Transifex for the source file to be in plural.
1 parent 13f2255 commit ea4968e

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

Diff for: cli/lib/search.go

+16-16
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ func runSearchCommand(cmd *cobra.Command, args []string) {
5959
feedback.Errorf(tr("Error creating instance: %v"), status)
6060
os.Exit(errorcodes.ErrGeneric)
6161
}
62-
62+
6363
if err := commands.UpdateLibrariesIndex(
6464
context.Background(),
6565
&rpc.UpdateLibrariesIndexRequest{Instance: inst},
@@ -68,23 +68,23 @@ func runSearchCommand(cmd *cobra.Command, args []string) {
6868
feedback.Errorf(tr("Error updating library index: %v"), err)
6969
os.Exit(errorcodes.ErrGeneric)
7070
}
71-
71+
7272
instance.Init(inst)
73-
73+
7474
searchResp, err := lib.LibrarySearch(context.Background(), &rpc.LibrarySearchRequest{
7575
Instance: inst,
7676
Query: (strings.Join(args, " ")),
7777
})
7878
if err != nil {
79-
feedback.Errorf(tr("Error searching for Library: %v"), err)
79+
feedback.Errorf(tr("Error searching for Libraries: %v"), err)
8080
os.Exit(errorcodes.ErrGeneric)
8181
}
82-
82+
8383
feedback.PrintResult(result{
8484
results: searchResp,
8585
namesOnly: namesOnly,
8686
})
87-
87+
8888
logrus.Info("Done")
8989
}
9090

@@ -104,18 +104,18 @@ func (res result) Data() interface{} {
104104
type NamesOnly struct {
105105
Libraries []LibName `json:"libraries"`
106106
}
107-
107+
108108
names := []LibName{}
109109
results := res.results.GetLibraries()
110110
for _, lib := range results {
111111
names = append(names, LibName{lib.Name})
112112
}
113-
113+
114114
return NamesOnly{
115115
names,
116116
}
117117
}
118-
118+
119119
return res.results
120120
}
121121

@@ -129,13 +129,13 @@ func (res result) String() string {
129129
sort.Slice(results, func(i, j int) bool {
130130
return results[i].Name < results[j].Name
131131
})
132-
132+
133133
var out strings.Builder
134-
134+
135135
if res.results.GetStatus() == rpc.LibrarySearchStatus_LIBRARY_SEARCH_STATUS_FAILED {
136136
out.WriteString(tr("No libraries matching your search.\nDid you mean...\n"))
137137
}
138-
138+
139139
for _, lib := range results {
140140
if res.results.GetStatus() == rpc.LibrarySearchStatus_LIBRARY_SEARCH_STATUS_SUCCESS {
141141
out.WriteString(tr(`Name: "%s"`, lib.Name) + "\n")
@@ -146,9 +146,9 @@ func (res result) String() string {
146146
out.WriteString(fmt.Sprintf("%s\n", lib.Name))
147147
continue
148148
}
149-
149+
150150
latest := lib.GetLatest()
151-
151+
152152
deps := []string{}
153153
for _, dep := range latest.GetDependencies() {
154154
if dep.GetVersionConstraint() == "" {
@@ -157,7 +157,7 @@ func (res result) String() string {
157157
deps = append(deps, dep.GetName()+" ("+dep.GetVersionConstraint()+")")
158158
}
159159
}
160-
160+
161161
out.WriteString(fmt.Sprintf(" "+tr("Author: %s")+"\n", latest.Author))
162162
out.WriteString(fmt.Sprintf(" "+tr("Maintainer: %s")+"\n", latest.Maintainer))
163163
out.WriteString(fmt.Sprintf(" "+tr("Sentence: %s")+"\n", latest.Sentence))
@@ -177,7 +177,7 @@ func (res result) String() string {
177177
out.WriteString(fmt.Sprintf(" "+tr("Dependencies: %s")+"\n", strings.Join(deps, ", ")))
178178
}
179179
}
180-
180+
181181
return out.String()
182182
}
183183

0 commit comments

Comments
 (0)