mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
repl: hide temp filename from output
This commit is contained in:
parent
f30b0f1017
commit
65426821c4
@ -145,10 +145,7 @@ pub fn run_repl() []string {
|
||||
rerror(err)
|
||||
return []string
|
||||
}
|
||||
vals := s.output.split('\n')
|
||||
for i:=0; i < vals.len; i++ {
|
||||
println(vals[i])
|
||||
}
|
||||
print_output(s)
|
||||
}
|
||||
else {
|
||||
mut temp_line := r.line
|
||||
@ -161,6 +158,7 @@ pub fn run_repl() []string {
|
||||
temp_source_code := r.functions.join('\n') + r.lines.join('\n') + '\n' + r.temp_lines.join('\n') + '\n' + temp_line
|
||||
os.write_file(temp_file, temp_source_code)
|
||||
s := os.exec('"$vexe" run $temp_file -repl') or {
|
||||
println("SDFSDF")
|
||||
rerror(err)
|
||||
return []string
|
||||
}
|
||||
@ -178,15 +176,25 @@ pub fn run_repl() []string {
|
||||
r.temp_lines.delete(0)
|
||||
}
|
||||
}
|
||||
vals := s.output.split('\n')
|
||||
for i:=0; i<vals.len; i++ {
|
||||
println(vals[i])
|
||||
}
|
||||
print_output(s)
|
||||
}
|
||||
}
|
||||
return r.lines
|
||||
}
|
||||
|
||||
fn print_output(s os.Result) {
|
||||
lines := s.output.split('\n')
|
||||
for line in lines {
|
||||
if line.starts_with('.vrepl_temp.v') {
|
||||
// Hide the temporary file name
|
||||
println(line[line.index(' ') + 1 .. ])
|
||||
} else {
|
||||
println(line)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fn main() {
|
||||
if os.args.len < 2 || !os.file_exists(os.args[1]) {
|
||||
println('Usage:')
|
||||
|
Loading…
Reference in New Issue
Block a user