Files
sprout/src/actions/print.rs

19 lines
582 B
Rust
Raw Normal View History

use crate::context::SproutContext;
use anyhow::Result;
use serde::{Deserialize, Serialize};
2025-10-05 00:09:53 -07:00
use std::rc::Rc;
/// The configuration of the print action.
#[derive(Serialize, Deserialize, Default, Clone)]
pub struct PrintConfiguration {
/// The text to print to the console.
#[serde(default)]
pub text: String,
}
/// Executes the print action with the specified `configuration` inside the provided `context`.
pub fn print(context: Rc<SproutContext>, configuration: &PrintConfiguration) -> Result<()> {
2025-10-05 00:09:53 -07:00
println!("{}", context.stamp(&configuration.text));
Ok(())
2025-10-05 00:09:53 -07:00
}