Skip to content

Commit

Permalink
Remove hasPrefix
Browse files Browse the repository at this point in the history
  • Loading branch information
vuon9 committed Oct 26, 2021
1 parent 6ef43d5 commit f260068
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions cointop/search.go
Expand Up @@ -93,26 +93,20 @@ func (ct *Cointop) Search(q string) error {
ct.State.lastSearchQuery = q
}

hasPrefix := false
canSearchSymbol := true
canSearchName := true
if strings.HasPrefix(q, "s:") {
canSearchSymbol = true
canSearchName = false
hasPrefix = true
q = q[2:]
log.Debug("Search, by keyword")
}

if strings.HasPrefix(q, "n:") {
canSearchSymbol = false
canSearchName = true
hasPrefix = true
log.Debug("Search, by name")
}

if hasPrefix {
q = q[2:]
log.Debugf("Search, truncated query '%s'", q)
log.Debug("Search, by name")
}

idx := -1
Expand Down

0 comments on commit f260068

Please sign in to comment.