Add zigup step (#1030)
* feat: add zigup step * feat(zigup): add various configuration options * feat(zigup): add cleanup option * feat(zigup): multiple version support and cleanup * refactor(zigup): remove set_default and simplify execution * fix(zigup): always pass path args to zigup for consistent behaviour * refactor(zigup): use shellexpand to expand tildes
This commit is contained in:
committed by
GitHub
parent
4624f11ba5
commit
da270ae7d9
@@ -171,6 +171,7 @@ pub enum Step {
|
||||
Xcodes,
|
||||
Yadm,
|
||||
Yarn,
|
||||
Zigup,
|
||||
Zvm,
|
||||
}
|
||||
|
||||
@@ -461,6 +462,15 @@ pub struct JuliaConfig {
|
||||
startup_file: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Default, Debug, Merge)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct Zigup {
|
||||
target_versions: Option<Vec<String>>,
|
||||
install_dir: Option<String>,
|
||||
path_link: Option<String>,
|
||||
cleanup: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Default, Debug, Merge)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
/// Configuration file
|
||||
@@ -530,6 +540,9 @@ pub struct ConfigFile {
|
||||
|
||||
#[merge(strategy = crate::utils::merge_strategies::inner_merge_opt)]
|
||||
julia: Option<JuliaConfig>,
|
||||
|
||||
#[merge(strategy = crate::utils::merge_strategies::inner_merge_opt)]
|
||||
zigup: Option<Zigup>,
|
||||
}
|
||||
|
||||
fn config_directory() -> PathBuf {
|
||||
@@ -1667,6 +1680,36 @@ impl Config {
|
||||
.and_then(|julia| julia.startup_file)
|
||||
.unwrap_or(true)
|
||||
}
|
||||
|
||||
pub fn zigup_target_versions(&self) -> Vec<String> {
|
||||
self.config_file
|
||||
.zigup
|
||||
.as_ref()
|
||||
.and_then(|zigup| zigup.target_versions.clone())
|
||||
.unwrap_or(vec!["master".to_owned()])
|
||||
}
|
||||
|
||||
pub fn zigup_install_dir(&self) -> Option<&str> {
|
||||
self.config_file
|
||||
.zigup
|
||||
.as_ref()
|
||||
.and_then(|zigup| zigup.install_dir.as_deref())
|
||||
}
|
||||
|
||||
pub fn zigup_path_link(&self) -> Option<&str> {
|
||||
self.config_file
|
||||
.zigup
|
||||
.as_ref()
|
||||
.and_then(|zigup| zigup.path_link.as_deref())
|
||||
}
|
||||
|
||||
pub fn zigup_cleanup(&self) -> bool {
|
||||
self.config_file
|
||||
.zigup
|
||||
.as_ref()
|
||||
.and_then(|zigup| zigup.cleanup)
|
||||
.unwrap_or(false)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
Reference in New Issue
Block a user