mirror of
https://github.com/vlang/v.git
synced 2025-09-13 14:32:26 +03:00
tools: add diagnostic in v repeat
for invalid combinations of -r, -i and -a flags
This commit is contained in:
parent
da228e93df
commit
b898987ece
1 changed files with 12 additions and 1 deletions
|
@ -362,7 +362,7 @@ fn (mut context Context) show_summary_title(line string) {
|
|||
if context.nmaxs > 0 {
|
||||
msg << 'discard maxs: ${context.nmaxs:2}'
|
||||
}
|
||||
if context.current_run > 0 {
|
||||
if context.repeats_count > 1 {
|
||||
msg << 'repeat: ${context.current_run:2}'
|
||||
}
|
||||
println(msg.join(', '))
|
||||
|
@ -407,6 +407,13 @@ fn (mut context Context) parse_options() ! {
|
|||
}
|
||||
context.commands = context.expand_all_commands(commands)
|
||||
context.reset_results()
|
||||
if context.nmins >= context.run_count {
|
||||
context.error_no_run_counts_to_report('${context.run_count - 1} bottom results with `-i ${context.nmins}`')
|
||||
} else if context.nmaxs >= context.run_count {
|
||||
context.error_no_run_counts_to_report('${context.run_count - 1} top results with `-a ${context.nmaxs}`')
|
||||
} else if context.nmaxs + context.nmins >= context.run_count {
|
||||
context.error_no_run_counts_to_report('${context.nmaxs + context.nmins - 1} results with `-i ${context.nmins}` and `-a ${context.nmaxs}`')
|
||||
}
|
||||
if context.use_newline {
|
||||
context.cline = '\n'
|
||||
context.cgoback = '\n'
|
||||
|
@ -416,6 +423,10 @@ fn (mut context Context) parse_options() ! {
|
|||
}
|
||||
}
|
||||
|
||||
fn (mut context Context) error_no_run_counts_to_report(detail string) {
|
||||
eprintln('${bold('Warning:')} discarding more than ${detail}, with only `-r ${context.run_count}` runs, will leave you with no results to report at all.')
|
||||
}
|
||||
|
||||
fn (mut context Context) reset_results() {
|
||||
context.results = []CmdResult{len: context.commands.len, cap: 20, init: CmdResult{
|
||||
outputs: []string{cap: 500}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue