chore: fix warnings
All checks were successful
continuous-integration/drone/push Build is passing

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
Kasper Juul Hermansen 2024-08-25 17:27:31 +02:00
parent b01543a8b9
commit b3aedfb411
Signed by: kjuulh
GPG Key ID: D85D7535F18F35FA
5 changed files with 4 additions and 37 deletions

View File

@ -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
}

View File

@ -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(())
}
}

View File

@ -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,
}

View File

@ -24,7 +24,6 @@ impl SchemaValidator {
RawPlanSchema::Nickel { nickel } => Ok(Some(NickelSchemaValidator::validate(
plan, project, nickel,
)?)),
RawPlanSchema::JsonSchema { jsonschema } => todo!("jsonschema not implemented yet"),
}
}
}

View File

@ -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),