diff --git a/main.go b/main.go index 7b8576d..6a5bb0d 100644 --- a/main.go +++ b/main.go @@ -269,6 +269,16 @@ func main() { close(deprecatedMessagesCh) if _, ok := reviser.IsDir(originPath); ok { + if *listFileName { + unformattedFiles, err := reviser.NewSourceDir(originProjectName, originPath, *isRecursive, excludes).Find(options...) + if err != nil { + log.Fatalf("Failed to find unformatted files %s: %+v\n", originPath, err) + } + for _, file := range unformattedFiles { + fmt.Printf("%s\n", file) + } + return + } err := reviser.NewSourceDir(originProjectName, originPath, *isRecursive, excludes).Fix(options...) if err != nil { log.Fatalf("Failed to fix directory %s: %+v\n", originPath, err) diff --git a/reviser/dir_test.go b/reviser/dir_test.go index a2d265a..e88fc2d 100644 --- a/reviser/dir_test.go +++ b/reviser/dir_test.go @@ -226,7 +226,7 @@ func main() { assert.NoError(tt, err) var want []string for _, w := range test.want { - want = append(want, rootPath+"/"+w) + want = append(want, filepath.Join(rootPath, w)) } assert.Equal(tt, want, files) return nil