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

os: add os.input(prompt)

This commit is contained in:
Delyan Angelov 2020-04-25 22:03:51 +03:00
parent c73d91a8fe
commit 86ba1645b0

View File

@ -662,6 +662,13 @@ pub fn file_name(path string) string {
return path.all_after(path_separator) return path.all_after(path_separator)
} }
// input returns a one-line string from stdin, after printing a prompt
pub fn input(prompt string) string {
print(prompt)
flush()
return get_line()
}
// get_line returns a one-line string from stdin // get_line returns a one-line string from stdin
pub fn get_line() string { pub fn get_line() string {
str := get_raw_line() str := get_raw_line()