fmt: allow fmt to be run on directories (#6613)

pull/6502/head^2
Enzo 2020-10-13 21:03:53 +02:00 committed by GitHub
parent ee0baf62ad
commit a2fba05218
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -83,6 +83,11 @@ fn main() {
}
mut files := []string{}
for file in possible_files {
if os.is_dir(file) {
files << os.walk_ext(file, '.v')
files << os.walk_ext(file, '.vsh')
continue
}
if !file.ends_with('.v') && !file.ends_with('.vv') && !file.ends_with('.vsh') {
verror('v fmt can only be used on .v files.\nOffending file: "$file"')
continue