Skip to content

Commit e0d05f5

Browse files
committed
tools/vquest: bug-[issue_id].md; clean up .md files
1 parent 939ad8b commit e0d05f5

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

‎cmd/tools/vquest.v‎

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ fn main() {
8181
},
8282
cli.Command{
8383
name: 'solve'
84-
description: 'Find a random bug reproducible on your OS, print it to stdout and save to current_bug.md.'
84+
description: 'Find a random bug reproducible on your OS, print it to stdout and save to bug-<issue_id>.md.'
8585
flags: solve_flags.clone()
8686
execute: run_solve
8787
},
@@ -143,11 +143,11 @@ const solve_flags = [
143143
default_value: ['-1']
144144
},
145145
cli.Flag{
146-
description: 'Output file for the bug report (default: current_bug.md).'
146+
description: 'Output file for the bug report (default: bug-<issue_id>.md).'
147147
flag: .string
148148
name: 'output'
149149
abbrev: 'O'
150-
default_value: ['current_bug.md']
150+
default_value: ['']
151151
},
152152
]
153153

@@ -164,9 +164,14 @@ fn run_implement(cmd cli.Command) ! {
164164
}
165165

166166
fn run_solve(cmd cli.Command) ! {
167+
// Clean up old bug report files
168+
for f in os.glob('bug-*.md') or { []string{} } {
169+
os.rm(f) or {}
170+
}
171+
167172
user_os := get_target_os(cmd)
168173
os_label := get_os_label(user_os)
169-
output_file := cmd.flags.get_string('output') or { 'current_bug.md' }
174+
output_override := cmd.flags.get_string('output') or { '' }
170175

171176
// Build query that excludes issues for other OSes
172177
// We look for open bugs that are NOT exclusive to other operating systems
@@ -194,6 +199,9 @@ fn run_solve(cmd cli.Command) ! {
194199
// Print to stdout
195200
println(report)
196201

202+
// Determine output filename (default: bug-<issue_id>.md)
203+
output_file := if output_override != '' { output_override } else { 'bug-${details.number}.md' }
204+
197205
// Write to file
198206
os.write_file(output_file, report) or {
199207
return error('failed to write to ${output_file}: ${err}')

0 commit comments

Comments
 (0)