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

builder: support -o - to print the generated C/JS source to stdout

This commit is contained in:
Delyan Angelov
2021-07-18 15:46:02 +03:00
parent a5c784830b
commit a007dd5d22
2 changed files with 15 additions and 1 deletions

View File

@@ -479,6 +479,13 @@ fn (mut v Builder) cc() {
}
return
}
if v.pref.out_name.ends_with('/-') {
// output to stdout
content := os.read_file(v.out_name_c) or { panic(err) }
println(content)
os.rm(v.out_name_c) or {}
return
}
// whether to just create a .c or .js file and exit, for example: `v -o v.c cmd.v`
ends_with_c := v.pref.out_name.ends_with('.c')
ends_with_js := v.pref.out_name.ends_with('.js')