Skip to main content

hanzo_protocol/
parse_command.rs

1use schemars::JsonSchema;
2use serde::Deserialize;
3use serde::Serialize;
4use std::path::PathBuf;
5use ts_rs::TS;
6
7#[derive(Debug, Clone, PartialEq, Eq, Deserialize, Serialize, JsonSchema, TS)]
8#[serde(tag = "type", rename_all = "snake_case")]
9pub enum ParsedCommand {
10    ReadCommand {
11        cmd: String,
12    },
13    Read {
14        cmd: String,
15        name: String,
16        /// (Best effort) Path to the file being read by the command. When
17        /// possible, this is an absolute path, though when relative, it should
18        /// be resolved against the `cwd`` that will be used to run the command
19        /// to derive the absolute path.
20        path: PathBuf,
21    },
22    ListFiles {
23        cmd: String,
24        path: Option<String>,
25    },
26    Search {
27        cmd: String,
28        query: Option<String>,
29        path: Option<String>,
30    },
31    Unknown {
32        cmd: String,
33    },
34}