@@ -88,7 +88,7 @@ func root(c *cobra.Command, args []string) {
88
88
name := formatPackageName (isTerminal , channel , pkg .AttrName )
89
89
fmt .Print (name )
90
90
if len (pkg .Programs ) != 0 {
91
- programs := formatDependencies (isTerminal , query , pkg .Programs )
91
+ programs := formatDependencies (isTerminal , input , pkg .Programs )
92
92
fmt .Print (": " , programs )
93
93
}
94
94
fmt .Println ()
@@ -145,13 +145,13 @@ func formatPackageName(isTerminal bool, channel, attrName string) string {
145
145
return attrName
146
146
}
147
147
148
- func formatDependencies (isTerminal bool , query string , programs []string ) string {
148
+ func formatDependencies (isTerminal bool , input nixsearch. Input , programs []string ) string {
149
149
if isTerminal {
150
150
var matches []string
151
151
var others []string
152
152
// Dim all the programs that aren't what you searched for
153
153
for _ , program := range programs {
154
- if isMatch (query , program ) {
154
+ if isMatch (input , program ) {
155
155
matches = append (matches , color .New (color .Bold ).Sprint (program ))
156
156
} else {
157
157
others = append (others , color .New (color .Faint ).Sprint (program ))
@@ -165,8 +165,11 @@ func formatDependencies(isTerminal bool, query string, programs []string) string
165
165
return strings .Join (programs , " " )
166
166
}
167
167
168
- func isMatch (a , b string ) bool {
169
- return a == b
168
+ func isMatch (input nixsearch.Input , program string ) bool {
169
+ return (input .Program == program ||
170
+ input .Advanced == program ||
171
+ input .Name == program ||
172
+ input .Default == program )
170
173
}
171
174
172
175
func main () {
0 commit comments