Skip to content

Commit 4cd8db8

Browse files
committed
fix filter
1 parent 9125731 commit 4cd8db8

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

main.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import (
3333
"fmt"
3434
"log"
3535
"os"
36+
"path/filepath"
3637
"strings"
3738

3839
"github.com/coreos/protodoc/parse"
@@ -127,7 +128,14 @@ func CommandFunc(cmd *cobra.Command, args []string) error {
127128
} else {
128129
for k, opts := range targetDirectories {
129130
log.Println("opening", k)
130-
proto, err := parse.ReadDir(k, messageOnlyFromThisFile)
131+
c1 := filepath.Base(filepath.Dir(messageOnlyFromThisFile))
132+
c2 := filepath.Base(k)
133+
bs := ""
134+
if c1 == c2 {
135+
bs = messageOnlyFromThisFile
136+
log.Println("message only from this file:", messageOnlyFromThisFile)
137+
}
138+
proto, err := parse.ReadDir(k, bs)
131139
if err != nil {
132140
return err
133141
}

0 commit comments

Comments
 (0)