mirror of
https://github.com/zaphar/ucg.git
synced 2025-07-21 18:10:42 -04:00
DEV: Don't output the welcome message if we aren't interactive.
This commit is contained in:
parent
7e3e598423
commit
04a7ad0404
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -490,6 +490,7 @@ name = "ucg"
|
|||||||
version = "0.6.4"
|
version = "0.6.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"abortable_parser 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"abortable_parser 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"bencher 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"bencher 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"clap 2.26.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"clap 2.26.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -31,6 +31,7 @@ regex = "1"
|
|||||||
dirs = "1.0.4"
|
dirs = "1.0.4"
|
||||||
unicode-segmentation = "1.2.1"
|
unicode-segmentation = "1.2.1"
|
||||||
rustyline = "4.1.0"
|
rustyline = "4.1.0"
|
||||||
|
atty = "0.2"
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
walkdir = "2.2.7"
|
walkdir = "2.2.7"
|
||||||
|
@ -26,6 +26,8 @@ use std::rc::Rc;
|
|||||||
|
|
||||||
use rustyline;
|
use rustyline;
|
||||||
use rustyline::error::ReadlineError;
|
use rustyline::error::ReadlineError;
|
||||||
|
use atty;
|
||||||
|
use atty::Stream;
|
||||||
use simple_error;
|
use simple_error;
|
||||||
|
|
||||||
use crate::ast::*;
|
use crate::ast::*;
|
||||||
@ -215,9 +217,11 @@ where
|
|||||||
pub fn repl(&mut self, mut editor: rustyline::Editor<()>, config_home: PathBuf) -> BuildResult {
|
pub fn repl(&mut self, mut editor: rustyline::Editor<()>, config_home: PathBuf) -> BuildResult {
|
||||||
// loop
|
// loop
|
||||||
let mut lines = crate::io::StatementAccumulator::new();
|
let mut lines = crate::io::StatementAccumulator::new();
|
||||||
|
if atty::is(Stream::Stdin) {
|
||||||
println!("Welcome to the UCG repl. Ctrl-D to exit, Ctrl-C to abort expression.");
|
println!("Welcome to the UCG repl. Ctrl-D to exit, Ctrl-C to abort expression.");
|
||||||
println!("Type '#help' for help.");
|
println!("Type '#help' for help.");
|
||||||
println!("");
|
println!("");
|
||||||
|
}
|
||||||
// Initialize VM with an empty OpPointer
|
// Initialize VM with an empty OpPointer
|
||||||
let mut vm = VM::new(
|
let mut vm = VM::new(
|
||||||
self.strict,
|
self.strict,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user