1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

vet: hide skipped file messages behind verbose flag (#9823)

This commit is contained in:
Lukas Neubert
2021-04-20 16:20:50 +02:00
committed by GitHub
parent 16e79bc3ca
commit 0b0a5de9e5
2 changed files with 16 additions and 19 deletions

View File

@@ -27,16 +27,17 @@ struct Options {
use_color bool
}
const vet_options = cmdline.options_after(os.args, ['vet'])
const term_colors = term.can_show_color_on_stderr()
fn main() {
vet_options := cmdline.options_after(os.args, ['vet'])
mut vt := Vet{
opt: Options{
is_force: '-force' in vet_options
is_werror: '-W' in vet_options
is_verbose: '-verbose' in vet_options || '-v' in vet_options
show_warnings: '-hide-warnings' !in vet_options
use_color: should_use_color()
show_warnings: '-hide-warnings' !in vet_options && '-w' !in vet_options
use_color: '-color' in vet_options || (term_colors && '-nocolor' !in vet_options)
}
}
mut paths := cmdline.only_non_options(vet_options)
@@ -88,7 +89,7 @@ fn (mut vt Vet) vet_file(path string) {
// skip all /tests/ files, since usually their content is not
// important enough to be documented/vetted, and they may even
// contain intentionally invalid code.
eprintln("skipping test file: '$path' ...")
vt.vprintln("skipping test file: '$path' ...")
return
}
vt.file = path
@@ -252,14 +253,3 @@ fn (mut vt Vet) warn(msg string, line int, fix vet.FixKind) {
vt.warns << w
}
}
fn should_use_color() bool {
mut color := term.can_show_color_on_stderr()
if '-nocolor' in vet_options {
color = false
}
if '-color' in vet_options {
color = true
}
return color
}