2025-08-15 12:44:40 -07:00
|
|
|
use serde::Deserialize;
|
|
|
|
|
use serde::Serialize;
|
2025-10-16 23:19:54 -07:00
|
|
|
use std::path::PathBuf;
|
2025-09-08 14:54:47 -07:00
|
|
|
use ts_rs::TS;
|
2025-08-15 12:44:40 -07:00
|
|
|
|
2025-09-08 14:54:47 -07:00
|
|
|
#[derive(Debug, Clone, PartialEq, Eq, Deserialize, Serialize, TS)]
|
2025-08-20 22:34:46 -07:00
|
|
|
#[serde(tag = "type", rename_all = "snake_case")]
|
2025-08-15 12:44:40 -07:00
|
|
|
pub enum ParsedCommand {
|
|
|
|
|
Read {
|
|
|
|
|
cmd: String,
|
|
|
|
|
name: String,
|
2025-10-16 23:19:54 -07:00
|
|
|
/// (Best effort) Path to the file being read by the command. When
|
|
|
|
|
/// possible, this is an absolute path, though when relative, it should
|
|
|
|
|
/// be resolved against the `cwd`` that will be used to run the command
|
|
|
|
|
/// to derive the absolute path.
|
|
|
|
|
path: PathBuf,
|
2025-08-15 12:44:40 -07:00
|
|
|
},
|
|
|
|
|
ListFiles {
|
|
|
|
|
cmd: String,
|
|
|
|
|
path: Option<String>,
|
|
|
|
|
},
|
|
|
|
|
Search {
|
|
|
|
|
cmd: String,
|
|
|
|
|
query: Option<String>,
|
|
|
|
|
path: Option<String>,
|
|
|
|
|
},
|
|
|
|
|
Unknown {
|
|
|
|
|
cmd: String,
|
|
|
|
|
},
|
|
|
|
|
}
|