os: Implement a read-all for STDIN

pull/1297/head
AtjonTV 2019-07-24 18:14:13 +02:00 committed by Alexander Medvednikov
parent 505f784047
commit 99355ae8b2
1 changed files with 28 additions and 0 deletions

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 { pub fn user_os() string {
$if linux { $if linux {
return 'linux' return 'linux'