mirror of https://github.com/cheat/cheat.git
chore: deprecates line numbers in search
Removes line numbers from search result output as part of the refactoring effort.
This commit is contained in:
parent
e0c35a74d4
commit
e24ac2b385
|
@ -78,7 +78,7 @@ func cmdSearch(opts map[string]interface{}, conf config.Config) {
|
|||
if len(matches) > 0 {
|
||||
fmt.Printf("%s:\n", sheet.Title)
|
||||
for _, m := range matches {
|
||||
fmt.Printf(" %d: %s\n", m.Line, m.Text)
|
||||
fmt.Printf(" %s\n", m.Text)
|
||||
}
|
||||
fmt.Print("\n")
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ func (s *Sheet) Search(reg *regexp.Regexp) []Match {
|
|||
// search through the cheatsheet's text line by line
|
||||
// TODO: searching line-by-line is surely the "naive" approach. Revisit this
|
||||
// later with an eye for performance improvements.
|
||||
for linenum, line := range strings.Split(s.Text, "\n") {
|
||||
for _, line := range strings.Split(s.Text, "\n") {
|
||||
|
||||
// exit early if the line doesn't match the regex
|
||||
if !reg.MatchString(line) {
|
||||
|
@ -24,7 +24,6 @@ func (s *Sheet) Search(reg *regexp.Regexp) []Match {
|
|||
|
||||
// init the match
|
||||
m := Match{
|
||||
Line: linenum + 1,
|
||||
Text: strings.TrimSpace(line),
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue