Browse Source

improve cmd search

pull/103/head
Unknown 12 years ago
parent
commit
dbf3023a67
  1. 13
      cmd/search.go

13
cmd/search.go

@ -64,8 +64,21 @@ func runSearch(cmd *Command, args []string) {
}
}
if len(pkgsCache) == 0 {
fmt.Printf("No result is available for keyword: %s.\n", args[0])
return
}
isWindws := runtime.GOOS == "windows"
var buf bytes.Buffer
// Print split line for more clear look.
splitLine := "<-----------------------------search results--------------------------->\n"
if !isWindws {
splitLine = strings.Replace(splitLine, "<", fmt.Sprintf(utils.PureStartColor, utils.Magenta)+"<", 1)
splitLine = strings.Replace(splitLine, ">", ">"+utils.EndColor, 1)
}
buf.WriteString(splitLine)
for k, v := range pkgsCache {
// Package import path.
buf.WriteString("-> " + k)

Loading…
Cancel
Save