Skip to main content

rusty_bubbletea/
raw.rs

1//! Cleanroom Rust port of upstream Go source file: `raw.go`
2//! Upstream Target Tag / Version: `v2.0.8`
3//!
4//! <public-docs>
5//! # Raw Command Output
6//!
7//! `raw` command sending raw escape sequences or queries to the terminal.
8//! </public-docs>
9
10use crate::model::Cmd;
11
12/// RawMsg contains raw data to send to terminal.
13#[derive(Debug, Clone, PartialEq, Eq)]
14pub struct RawMsg(pub String);
15
16/// Raw produces a command that prints the given string directly to stdout.
17pub fn raw(s: &str) -> Cmd {
18    let payload = s.to_string();
19    Some(Box::new(move || Some(Box::new(RawMsg(payload)))))
20}