nom_config_in/entry/
echo.rs1use nom::{
2 branch::alt,
3 bytes::complete::tag,
4 character::complete::{line_ending, not_line_ending},
5 combinator::{eof, map},
6 sequence::terminated,
7 IResult,
8};
9use serde::Serialize;
10
11use crate::{util::ws, ConfigInInput};
12
13#[derive(Debug, Clone, Serialize, PartialEq)]
14pub struct Echo {
15 pub params: String,
16}
17
18pub fn parse_echo(input: ConfigInInput) -> IResult<ConfigInInput, Echo> {
19 let (input, _) = ws(tag("echo"))(input)?;
20 map(
21 ws(terminated(not_line_ending, alt((line_ending, eof)))),
22 |cmd: ConfigInInput| Echo {
23 params: cmd.to_string(),
24 },
25 )(input)
26}