mirror of
https://github.com/aaif-goose/goose.git
synced 2026-07-03 14:10:03 +02:00
Newline in cli (#485)
This commit is contained in:
@@ -9,7 +9,7 @@ use super::{
|
||||
use anyhow::Result;
|
||||
use cliclack::spinner;
|
||||
use goose::message::Message;
|
||||
use rustyline::DefaultEditor;
|
||||
use rustyline::{DefaultEditor, EventHandler, KeyCode, KeyEvent, Modifiers};
|
||||
|
||||
const PROMPT: &str = "\x1b[1m\x1b[38;5;30m( O)> \x1b[0m";
|
||||
|
||||
@@ -31,7 +31,11 @@ impl RustylinePrompt {
|
||||
Box::new(bash_dev_system_renderer),
|
||||
);
|
||||
|
||||
let editor = DefaultEditor::new().expect("Failed to create editor");
|
||||
let mut editor = DefaultEditor::new().expect("Failed to create editor");
|
||||
editor.bind_sequence(
|
||||
KeyEvent(KeyCode::Char('j'), Modifiers::CTRL),
|
||||
EventHandler::Simple(rustyline::Cmd::Newline),
|
||||
);
|
||||
|
||||
RustylinePrompt {
|
||||
spinner: spinner(),
|
||||
@@ -118,6 +122,7 @@ impl Prompt for RustylinePrompt {
|
||||
println!("/t - Toggle Light/Dark theme");
|
||||
println!("/? | /help - Display this help message");
|
||||
println!("Ctrl+C - Interrupt goose (resets the interaction to before the interrupted user request)");
|
||||
println!("Ctrl+j - Adds a newline");
|
||||
println!("Use Up/Down arrow keys to navigate through command history");
|
||||
return Ok(Input {
|
||||
input_type: InputType::AskAgain,
|
||||
|
||||
Reference in New Issue
Block a user