This commit is contained in:
JMARyA 2023-11-01 22:43:04 +01:00
parent 2a268bb5cd
commit b2ae45131d
Signed by: jmarya
GPG key ID: 901B2ADDF27C2263
2 changed files with 18 additions and 11 deletions

12
Cargo.lock generated
View file

@ -947,9 +947,9 @@ dependencies = [
[[package]] [[package]]
name = "serde_json" name = "serde_json"
version = "1.0.107" version = "1.0.108"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65" checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b"
dependencies = [ dependencies = [
"itoa", "itoa",
"ryu", "ryu",
@ -1477,18 +1477,18 @@ dependencies = [
[[package]] [[package]]
name = "zerocopy" name = "zerocopy"
version = "0.7.18" version = "0.7.20"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ede7d7c7970ca2215b8c1ccf4d4f354c4733201dfaaba72d44ae5b37472e4901" checksum = "dd66a62464e3ffd4e37bd09950c2b9dd6c4f8767380fabba0d523f9a775bc85a"
dependencies = [ dependencies = [
"zerocopy-derive", "zerocopy-derive",
] ]
[[package]] [[package]]
name = "zerocopy-derive" name = "zerocopy-derive"
version = "0.7.18" version = "0.7.20"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4b27b1bb92570f989aac0ab7e9cbfbacdd65973f7ee920d9f0e71ebac878fd0b" checksum = "255c4596d41e6916ced49cfafea18727b24d67878fa180ddfd69b9df34fd1726"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",

View file

@ -87,13 +87,20 @@ fn main() {
.quit_on_error("Schema is not valid"); .quit_on_error("Schema is not valid");
let frontmatter = serde_yaml::from_str( let frontmatter = serde_yaml::from_str(
&get_frontmatter( &get_frontmatter(&std::fs::read_to_string(file).quit_on_error(&format!(
&std::fs::read_to_string(file).quit_on_error("Could not read markdown file"), "Could not read markdown file '{}'",
) Style::new().blue().apply_to(file)
)))
.ok_or(0) .ok_or(0)
.quit_on_error("Could not parse frontmatter"), .quit_on_error(&format!(
"Could not parse frontmatter '{}'",
Style::new().blue().apply_to(file)
)),
) )
.quit_on_error("Frontmatter is no valid yaml"); .quit_on_error(&format!(
"Frontmatter is no valid yaml '{}'",
Style::new().blue().apply_to(file)
));
let result = comp_schema.validate(&frontmatter); let result = comp_schema.validate(&frontmatter);