lestrrat/peco — pull request #65 by mattn (2014-06-16 09:21:26+00:00)
Title: User CustomMatcher

This is a patch to be possible to make custom-filter.
For example,

### peco-cmigemo.go

```go
package main

import (
"bufio"
"fmt"
"os"
"os/exec"
"regexp"
"strings"
)

func main() {
if len(os.Args) != 2 {
os.Exit(1)
}

cmd := exec.Command("cmigemo", "-d", "c:/dev/peco-cmigemo/dict/migemo-dict", "-w", os.Args[1])
b, err := cmd.Output()
if err != nil {
os.Exit(1)
}
re, err := regexp.Compile(strings.TrimSpace(string(b)))
if err != nil {
os.Exit(1)
}
buf := bufio.NewReader(os.Stdin)
for {
b, _, err := buf.ReadLine()
if err != nil {
break
}
line := string(b)
if re.MatchString(line) {
fmt.Println(line)
}
}
}
```

### config.json
```json
{
"CustomMatcher": {
"C/Migemo": [
"c:/dev/peco-cmigemo/peco-cmigemo.exe",
"$WORD"
]
}
}
```

This `$WORD` is replated to the query. How about this?