This commit is contained in:
2026-04-16 10:17:03 -06:00
parent c6c10b5e24
commit 883ac659b2
82 changed files with 14886 additions and 3310 deletions
+10 -8
View File
@@ -1,28 +1,30 @@
use crate::config::GlobalConfig;
use crate::config::RequestContext;
use parking_lot::RwLock;
use reedline::{Prompt, PromptHistorySearch, PromptHistorySearchStatus};
use std::borrow::Cow;
use std::sync::Arc;
#[derive(Clone)]
pub struct ReplPrompt {
config: GlobalConfig,
ctx: Arc<RwLock<RequestContext>>,
}
impl ReplPrompt {
pub fn new(config: &GlobalConfig) -> Self {
Self {
config: config.clone(),
}
pub fn new(ctx: Arc<RwLock<RequestContext>>) -> Self {
Self { ctx }
}
}
impl Prompt for ReplPrompt {
fn render_prompt_left(&self) -> Cow<'_, str> {
Cow::Owned(self.config.read().render_prompt_left())
let ctx = self.ctx.read();
Cow::Owned(ctx.render_prompt_left(ctx.app.config.as_ref()))
}
fn render_prompt_right(&self) -> Cow<'_, str> {
Cow::Owned(self.config.read().render_prompt_right())
let ctx = self.ctx.read();
Cow::Owned(ctx.render_prompt_right(ctx.app.config.as_ref()))
}
fn render_prompt_indicator(&self, _prompt_mode: reedline::PromptEditMode) -> Cow<'_, str> {