diff options
| author | Svilen Ivanov <isvilen@applicata.bg> | 2024-05-13 13:03:40 +0300 |
|---|---|---|
| committer | Svilen Ivanov <isvilen@applicata.bg> | 2024-05-14 14:54:25 +0300 |
| commit | 947ebf993818f7135e12d4b0da6f5b05ba790c14 (patch) | |
| tree | b0f81270f68977ac27a2deb07413be7adc071df2 /test-project | |
| parent | e54bbae8c4c2af580b5721ad5ac151f2ad19293e (diff) | |
| download | rust-mode-947ebf993818f7135e12d4b0da6f5b05ba790c14.tar.gz | |
Support running interactive programs
Diffstat (limited to 'test-project')
| -rw-r--r-- | test-project/src/main.rs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test-project/src/main.rs b/test-project/src/main.rs new file mode 100644 index 0000000..4d22e98 --- /dev/null +++ b/test-project/src/main.rs @@ -0,0 +1,25 @@ +use std::{env, io}; + +fn main() { + let mut args = env::args(); + + if args.len() == 1 { + println!("***run not interactive"); + } else { + match args.nth(1).unwrap().as_str() { + "interactive" => { + let mut line = String::new(); + + io::stdin() + .read_line(&mut line) + .expect("Failed to read line"); + + println!("***run interactive: {line}"); + } + + _ => { + panic!("unexpected argument"); + } + } + } +} |
