tools: improve output of v bug file.v, fix v bug /long/abs/path/file.v too

This commit is contained in:
Delyan Angelov 2025-01-05 20:49:08 +02:00
parent 6eb14082b3
commit 738f847f89
No known key found for this signature in database
GPG key ID: 66886C0F12D595ED

View file

@ -11,6 +11,11 @@ fn olog(msg string) {
println(term.colorize(term.green, msg))
}
fn vversion() string {
vexe := os.getenv('VEXE')
return os.execute('${os.quoted_path(vexe)} version').output.trim_space()
}
// get output from `v doctor`
fn get_vdoctor_output(is_verbose bool) string {
vexe := os.getenv('VEXE')
@ -61,7 +66,7 @@ fn get_v_build_output(is_verbose bool, is_yes bool, file_path string, user_args
}
}
if result.exit_code == 0 {
real_generated_file := './' + generated_file
real_generated_file := os.real_path(generated_file)
defer {
os.rm(generated_file) or {
if is_verbose {
@ -160,13 +165,15 @@ fn main() {
// When updating this template, make sure to update `.github/ISSUE_TEMPLATE/bug_report.md` too
raw_body := '<!-- It is advisable to update all relevant modules using `v outdated` and `v install` -->
**V doctor:**
```
<details>
<summary>V version: ${vversion()}, press to see full `v doctor` output</summary>
${vdoctor_output}
```
</details>
**What did you do?**
`./v -g -o vdbg cmd/v && ./vdbg ${user_args} ${file_path} && ./${generated_file}`
`./v -g -o vdbg cmd/v && ./vdbg ${user_args} ${file_path} && ${os.real_path(generated_file)}`
{file_content}
**What did you see?**