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:
parent
505f784047
commit
99355ae8b2
28
vlib/os/os.v
28
vlib/os/os.v
@ -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'
|
||||
|
Loading…
Reference in New Issue
Block a user