summaryrefslogtreecommitdiff
path: root/rust/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'rust/src/main.rs')
-rw-r--r--rust/src/main.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/rust/src/main.rs b/rust/src/main.rs
index b0e8ed9..8d52c46 100644
--- a/rust/src/main.rs
+++ b/rust/src/main.rs
@@ -1,16 +1,18 @@
use std::{
env::args,
- io::{stdin, stdout},
+ io::{stdin, stdout, IsTerminal},
};
-use lambda::io::{eval_file, repl};
+use lambda::io::{batch_eval, eval_file, repl};
fn main() {
if args().count() > 1 {
for file in args().skip(1) {
println!("{}", eval_file(&file));
}
- } else {
+ } else if stdin().is_terminal() {
repl(&mut stdin(), &mut stdout());
+ } else {
+ batch_eval(&mut stdin(), &mut stdout());
}
}