From 14f8209be30309e6177040e5a70fbe11f68d5be6 Mon Sep 17 00:00:00 2001 From: "Hatter Jiang@Pixelbook" Date: Sun, 26 Jul 2020 11:07:47 +0800 Subject: [PATCH] feat: add script config struct --- src/script.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/script.rs b/src/script.rs index 5288cca..755d462 100644 --- a/src/script.rs +++ b/src/script.rs @@ -1,5 +1,27 @@ use std::fs; use std::path::PathBuf; +use serde::{ Deserialize, Serialize }; + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct ScriptDescription { + pub name: String, + pub version: String, + pub hash: String, + pub repo: String, + #[serde(rename = "gitHash")] + pub git_hash: String, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct ScriptConfig { + pub repo: String, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct ScriptLocalConfig { + #[serde(rename = "indexPath")] + pub index_path: String, +} pub fn _get_script_base_path(base: &PathBuf, file_name: &str) -> PathBuf { let mut fn_chars = file_name.chars().take_while(|c| *c != '.');