feat: add script config struct

This commit is contained in:
2020-07-26 11:07:47 +08:00
parent db51056cd1
commit 14f8209be3

View File

@@ -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 != '.');