From 21b686ba5ad8cd26c608b80dc6a42e45bc3e7cce Mon Sep 17 00:00:00 2001 From: jdx <216188+jdx@users.noreply.github.com> Date: Fri, 15 Nov 2024 21:54:23 -0600 Subject: [PATCH] feat: added `os` option to mise.toml --- mise.toml | 2 +- src/config/config_file/mise_toml.rs | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/mise.toml b/mise.toml index e804dd15ff..f18e68d2fc 100644 --- a/mise.toml +++ b/mise.toml @@ -9,7 +9,7 @@ shellcheck = "0.10" shfmt = "3" jq = "latest" cargo-binstall = "latest" -"cargo:cargo-edit" = "latest" +"cargo:cargo-edit" = {version = "latest", os=["linux", "macos"]} "cargo:cargo-show" = "latest" "cargo:cargo-insta" = "latest" "cargo:git-cliff" = "latest" diff --git a/src/config/config_file/mise_toml.rs b/src/config/config_file/mise_toml.rs index 9199b8c2f7..1efed34a10 100644 --- a/src/config/config_file/mise_toml.rs +++ b/src/config/config_file/mise_toml.rs @@ -62,6 +62,7 @@ pub struct MiseTomlToolList(Vec); #[derive(Debug, Clone)] pub struct MiseTomlTool { pub tt: ToolVersionType, + pub os: Option, pub options: Option, } @@ -777,11 +778,13 @@ impl<'de> de::Deserialize<'de> for MiseTomlToolList { where M: de::MapAccess<'de>, { - let mut options: BTreeMap = + let mut options: BTreeMap = de::Deserialize::deserialize(de::value::MapAccessDeserializer::new(map))?; + let os = options.remove("os"); let tt: ToolVersionType = options .remove("version") - .or_else(|| options.remove("path").map(|p| format!("path:{p}"))) + .map(|v| v.as_str().unwrap().to_string()) + .or_else(|| options.remove("path").map(|p| format!("path:{}", p.as_str().unwrap().to_string()))) .or_else(|| options.remove("prefix").map(|p| format!("prefix:{p}"))) .or_else(|| options.remove("ref").map(|p| format!("ref:{p}"))) .ok_or_else(|| de::Error::custom("missing version"))? @@ -789,6 +792,7 @@ impl<'de> de::Deserialize<'de> for MiseTomlToolList { .map_err(de::Error::custom)?; Ok(MiseTomlToolList(vec![MiseTomlTool { tt, + os, options: Some(options), }])) }