func (c Cmds) Search(args []string) Cmds {
	query := commandWithHyphen(args)
	results := fuzzy.FindFrom(query, c)
	cmds := make(Cmds, results.Len())
	for i, r := range results {
		if guessHyphenCommand(args) {
			cmds[i] = c[r.Index]
		} else {
			cmdName := strings.ReplaceAll(c[r.Index].Name, "-", " ")
			c[r.Index].Name = cmdName
			cmds[i] = c[r.Index]
		}
	}
	return cmds
}
Search fuzzy search commands by query.
package tldr
import (
	"encoding/json"
	"fmt"
	"os"
	"strings"
	"github.com/sahilm/fuzzy"
)
type CmdInfo struct {
	Name      string     `json:"name"`
	Platforms []Platform `json:"platform"`
	Languages []string   `json:"language"`
}
type Cmds []*CmdInfo
type CmdsIndex struct {
	Commands Cmds `json:"commands"`
}
func (c Cmds) String(i int) string {
	return c[i].Name
}
func (c Cmds) Len() int {
	return len(c)
}