diff --git a/cmd/grepfunc/main.go b/cmd/grepfunc/main.go index fff4b6b..e66db19 100644 --- a/cmd/grepfunc/main.go +++ b/cmd/grepfunc/main.go @@ -21,6 +21,8 @@ func main() { `input Go file with pattern function`) pattern := flag.String("pattern", "_pattern", `function to be interpreted as a pattern`) + verbose := flag.Bool("v", false, + `turn on debug output`) flag.Parse() if *input == "" { @@ -52,6 +54,10 @@ func main() { s = strings.TrimPrefix(s, "{") s = strings.TrimSuffix(s, "}") + if *verbose { + fmt.Println(s) + } + gogrepArgs := []string{"-x", s} gogrepArgs = append(gogrepArgs, targets...) out, err := exec.Command("gogrep", gogrepArgs...).CombinedOutput()