mirror of
https://github.com/herdrdev/herdr.git
synced 2026-09-23 08:01:09 +00:00
fix: read alternate-screen agent history
This commit is contained in:
@@ -66,6 +66,13 @@ pub enum ReadSource {
|
||||
Detection,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
|
||||
pub(crate) enum ReadIntent {
|
||||
#[default]
|
||||
Interactive,
|
||||
Passive,
|
||||
}
|
||||
|
||||
#[derive(
|
||||
Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, schemars::JsonSchema, Default,
|
||||
)]
|
||||
|
||||
@@ -258,6 +258,9 @@ pub struct PaneReadParams {
|
||||
pub format: ReadFormat,
|
||||
#[serde(default = "super::default_true")]
|
||||
pub strip_ansi: bool,
|
||||
#[serde(skip)]
|
||||
#[schemars(skip)]
|
||||
pub(crate) intent: super::common::ReadIntent,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, schemars::JsonSchema)]
|
||||
|
||||
@@ -412,10 +412,13 @@ fn pane_read_defaults_to_text_format() {
|
||||
"#;
|
||||
|
||||
let request: Request = serde_json::from_str(json).unwrap();
|
||||
let serialized = serde_json::to_value(&request).unwrap();
|
||||
assert!(serialized["params"].get("intent").is_none());
|
||||
let Method::PaneRead(params) = request.method else {
|
||||
panic!("wrong method parsed");
|
||||
};
|
||||
assert_eq!(params.format, ReadFormat::Text);
|
||||
assert_eq!(params.intent, ReadIntent::Interactive);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -557,6 +557,7 @@ fn pane_read(
|
||||
lines,
|
||||
format: crate::api::schema::ReadFormat::Text,
|
||||
strip_ansi,
|
||||
intent: crate::api::schema::ReadIntent::Passive,
|
||||
}),
|
||||
},
|
||||
api_tx,
|
||||
|
||||
@@ -64,6 +64,7 @@ pub(super) fn wait_for_output(
|
||||
lines: params.lines,
|
||||
format: crate::api::schema::ReadFormat::Text,
|
||||
strip_ansi: params.strip_ansi,
|
||||
intent: crate::api::schema::ReadIntent::Passive,
|
||||
}),
|
||||
};
|
||||
let response =
|
||||
|
||||
Reference in New Issue
Block a user