| skipped 8 lines |
9 | 9 | | } |
10 | 10 | | |
11 | 11 | | #[derive(Deserialize, Debug)] |
| 12 | + | pub(crate) struct DomainCommandParam { |
| 13 | + | pub name: String, |
| 14 | + | } |
| 15 | + | |
| 16 | + | #[derive(Deserialize, Debug)] |
12 | 17 | | pub(crate) struct DomainCommand { |
13 | 18 | | pub name: String, |
| 19 | + | pub parameters: Option<Vec<DomainCommandParam>>, |
| 20 | + | } |
| 21 | + | |
| 22 | + | impl DomainCommand { |
| 23 | + | pub fn display(&self) -> String { |
| 24 | + | let args = match &self.parameters { |
| 25 | + | Some(params) => params |
| 26 | + | .iter() |
| 27 | + | .map(|p| p.name.to_owned()) |
| 28 | + | .collect::<Vec<String>>() |
| 29 | + | .join(", "), |
| 30 | + | None => "".to_owned(), |
| 31 | + | }; |
| 32 | + | format!(".{}({})", self.name, args) |
| 33 | + | } |
14 | 34 | | } |
15 | 35 | | |
16 | 36 | | #[derive(Deserialize, Debug)] |
| skipped 84 lines |