tools.vet: print help when passing no files or --help/-help flag after vet command (#21108)

This commit is contained in:
Turiiya 2024-03-27 13:17:25 +01:00 committed by GitHub
parent bc68c87f21
commit 1e8d1a4d0b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -9,6 +9,7 @@ import v.pref
import v.parser
import v.token
import v.ast
import v.help
import term
struct Vet {
@ -50,6 +51,9 @@ fn main() {
// `v test-cleancode` passes also `-o tmpfolder` as well as all options in VFLAGS
paths = paths.filter(!it.starts_with(vtmp))
}
if paths.len == 0 || '-help' in vet_options || '--help' in vet_options {
help.print_and_exit('vet')
}
for path in paths {
if !os.exists(path) {
eprintln('File/folder ${path} does not exist')