Skip to content

Commit

Permalink
tools: improve output of v bug file.v, fix `v bug /long/abs/path/fi…
Browse files Browse the repository at this point in the history
…le.v` too
  • Loading branch information
spytheman committed Jan 5, 2025
1 parent 6eb1408 commit 738f847
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions cmd/tools/vbug.v
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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?**
Expand Down

0 comments on commit 738f847

Please sign in to comment.