diff options
Diffstat (limited to 'src/api')
| -rw-r--r-- | src/api/schema/common.rs | 7 | ||||
| -rw-r--r-- | src/api/schema/panes.rs | 3 | ||||
| -rw-r--r-- | src/api/schema/tests.rs | 3 | ||||
| -rw-r--r-- | src/api/subscriptions.rs | 1 | ||||
| -rw-r--r-- | src/api/wait.rs | 1 |
5 files changed, 15 insertions, 0 deletions
diff --git a/src/api/schema/common.rs b/src/api/schema/common.rs index e22fa1b3..7313002c 100644 --- a/src/api/schema/common.rs +++ b/src/api/schema/common.rs @@ -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, )] diff --git a/src/api/schema/panes.rs b/src/api/schema/panes.rs index 097b6366..647f7446 100644 --- a/src/api/schema/panes.rs +++ b/src/api/schema/panes.rs @@ -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)] diff --git a/src/api/schema/tests.rs b/src/api/schema/tests.rs index 16894dbf..5fe6dd27 100644 --- a/src/api/schema/tests.rs +++ b/src/api/schema/tests.rs @@ -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] diff --git a/src/api/subscriptions.rs b/src/api/subscriptions.rs index 7bcc7b77..8d2f84ec 100644 --- a/src/api/subscriptions.rs +++ b/src/api/subscriptions.rs @@ -557,6 +557,7 @@ fn pane_read( lines, format: crate::api::schema::ReadFormat::Text, strip_ansi, + intent: crate::api::schema::ReadIntent::Passive, }), }, api_tx, diff --git a/src/api/wait.rs b/src/api/wait.rs index 4b9c853e..7da9b7a9 100644 --- a/src/api/wait.rs +++ b/src/api/wait.rs @@ -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 = |
