Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
parent
b01543a8b9
commit
b3aedfb411
@ -79,7 +79,7 @@ impl Cli {
|
||||
}
|
||||
|
||||
async fn add_project_commands(self) -> anyhow::Result<Self> {
|
||||
if let Some(project) = self.cuddle.state.project.as_ref() {
|
||||
if let Some(_project) = self.cuddle.state.project.as_ref() {
|
||||
// Add project level commands
|
||||
}
|
||||
|
||||
@ -87,7 +87,7 @@ impl Cli {
|
||||
}
|
||||
|
||||
async fn add_plan_commands(self) -> anyhow::Result<Self> {
|
||||
if let Some(plan) = self.cuddle.state.plan.as_ref() {
|
||||
if let Some(_plan) = self.cuddle.state.plan.as_ref() {
|
||||
// Add plan level commands
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,6 @@ pub struct RawPlanConfigSection {
|
||||
#[serde(untagged)]
|
||||
pub enum RawPlanSchema {
|
||||
Nickel { nickel: PathBuf },
|
||||
JsonSchema { jsonschema: String },
|
||||
}
|
||||
|
||||
pub struct Plan {}
|
||||
@ -200,28 +199,4 @@ mod tests {
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_can_parse_json_schema() -> anyhow::Result<()> {
|
||||
let plan = RawPlan::from_file(
|
||||
r##"
|
||||
[plan]
|
||||
schema = {jsonschema = "schema.json"}
|
||||
"##,
|
||||
&PathBuf::new(),
|
||||
)?;
|
||||
|
||||
assert_eq!(
|
||||
RawPlanConfig {
|
||||
plan: RawPlanConfigSection {
|
||||
schema: Some(RawPlanSchema::JsonSchema {
|
||||
jsonschema: "schema.json".into()
|
||||
}),
|
||||
}
|
||||
},
|
||||
plan.config,
|
||||
);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
@ -7,9 +7,8 @@ use serde::Deserialize;
|
||||
|
||||
pub const CUDDLE_PROJECT_FILE: &str = "cuddle.toml";
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct RawProject {
|
||||
config: RawConfig,
|
||||
pub config: RawConfig,
|
||||
pub root: PathBuf,
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,6 @@ impl SchemaValidator {
|
||||
RawPlanSchema::Nickel { nickel } => Ok(Some(NickelSchemaValidator::validate(
|
||||
plan, project, nickel,
|
||||
)?)),
|
||||
RawPlanSchema::JsonSchema { jsonschema } => todo!("jsonschema not implemented yet"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ use toml::Table;
|
||||
use crate::project::CUDDLE_PROJECT_FILE;
|
||||
|
||||
pub struct Project {
|
||||
value: Value,
|
||||
pub value: Value,
|
||||
pub root: PathBuf,
|
||||
}
|
||||
|
||||
@ -23,7 +23,6 @@ impl Project {
|
||||
|
||||
pub fn from_file(content: &str, root: &Path) -> anyhow::Result<Self> {
|
||||
let table: Table = toml::from_str(content)?;
|
||||
let config = Config::default();
|
||||
|
||||
let project = table
|
||||
.get("project")
|
||||
@ -47,11 +46,6 @@ impl Project {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
struct Config {
|
||||
project: BTreeMap<String, Value>,
|
||||
}
|
||||
|
||||
pub enum Value {
|
||||
String(String),
|
||||
Bool(bool),
|
||||
|
Loading…
Reference in New Issue
Block a user