Skip to main content

fur_cli/frs/
ast.rs

1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Serialize, Deserialize)]
4pub struct Thread {
5    pub title: String,
6    pub tags: Vec<String>,
7    pub items: Vec<ScriptItem>, // not only messages
8}
9
10#[derive(Debug, Serialize, Deserialize, Clone)]
11pub struct Message {
12    pub avatar: String,
13    pub text: Option<String>,
14    pub file: Option<String>,       // markdown only
15    pub attachment: Option<String>, // image or other binary
16    pub children: Vec<Message>,
17    pub branches: Vec<Vec<Message>>,
18}
19
20#[derive(Debug, Serialize, Deserialize)]
21pub enum ScriptItem {
22    Message(Message), // jot or branch
23    Command(Command), // timeline, tree, store...
24}
25
26#[derive(Debug, Serialize, Deserialize)]
27pub struct Command {
28    pub name: String,       // "timeline"
29    pub args: Vec<String>,  // ["--out", "TIMELINE_1.md", "--since", "35"]
30    pub line_number: usize, // useful for --since N referencing
31}