Skip to content

Commit 9cb4384

Browse files
committed
Make REPL work with stdin --- thanks a lot to @gwenn!
1 parent c51fc54 commit 9cb4384

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

jaq/src/repl.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,13 @@ fn eval(code: String, input: Val) -> Result<(), Error> {
2525
}
2626

2727
fn repl_with(f: impl Fn(String)) -> Result<(), ReadlineError> {
28-
use rustyline::config::{Behavior, Configurer};
28+
use rustyline::config::{Behavior, Config};
2929
use yansi::Paint;
30-
let mut rl = DefaultEditor::new()?;
31-
rl.set_auto_add_history(true);
32-
rl.set_behavior(Behavior::PreferTerm);
30+
let config = Config::builder()
31+
.behavior(Behavior::PreferTerm)
32+
.auto_add_history(true)
33+
.build();
34+
let mut rl = DefaultEditor::with_config(config)?;
3335
let prompt = "> ".bold().to_string();
3436
loop {
3537
match rl.readline(&prompt) {

0 commit comments

Comments
 (0)