add support for yaml and json manifests

This commit is contained in:
Aiden McClelland
2021-07-19 13:50:21 -06:00
committed by Aiden McClelland
parent a14820087d
commit 48c33be14c
5 changed files with 38 additions and 17 deletions

View File

@@ -36,6 +36,12 @@ pub fn pack(#[context] ctx: EitherContext, #[arg] path: Option<PathBuf>) -> Resu
let mut s = String::new();
File::open(path.join("manifest.toml"))?.read_to_string(&mut s)?;
serde_toml::from_str(&s).with_kind(crate::ErrorKind::Deserialization)?
} else if path.join("manifest.yaml").exists() {
serde_yaml::from_reader(File::open(path.join("manifest.yaml"))?)
.with_kind(crate::ErrorKind::Deserialization)?
} else if path.join("manifest.json").exists() {
serde_json::from_reader(File::open(path.join("manifest.json"))?)
.with_kind(crate::ErrorKind::Deserialization)?
} else {
return Err(Error::new(
anyhow!("manifest not found"),