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

os: Implement a read-all for STDIN

This commit is contained in:
AtjonTV 2019-07-24 18:14:13 +02:00 committed by Alexander Medvednikov
parent 505f784047
commit 99355ae8b2

View File

@ -546,6 +546,34 @@ pub fn get_raw_line() string {
}
}
pub fn get_lines() []string {
mut line := ''
mut inputstr := []string
for {
line = get_line()
if(line.len <= 0) {
break
}
line = line.trim_space()
inputstr << line
}
return inputstr
}
pub fn get_lines_joined() string {
mut line := ''
mut inputstr := ''
for {
line = get_line()
if(line.len <= 0) {
break
}
line = line.trim_space()
inputstr += line
}
return inputstr
}
pub fn user_os() string {
$if linux {
return 'linux'