feat(mise): add mise configuration options for bump and interactive modes (#1546)
This commit is contained in:
@@ -291,6 +291,16 @@
|
|||||||
# (default: false)
|
# (default: false)
|
||||||
# exclude_encrypted = false
|
# exclude_encrypted = false
|
||||||
|
|
||||||
|
[mise]
|
||||||
|
# Upgrades to the latest version available, bumping the version in mise.toml
|
||||||
|
# (default: false)
|
||||||
|
# bump = false
|
||||||
|
|
||||||
|
# Run interactively
|
||||||
|
# (default: false)
|
||||||
|
# interactive = false
|
||||||
|
|
||||||
|
|
||||||
[npm]
|
[npm]
|
||||||
# Use sudo if the NPM directory isn't owned by the current user
|
# Use sudo if the NPM directory isn't owned by the current user
|
||||||
# use_sudo = true
|
# use_sudo = true
|
||||||
|
|||||||
@@ -173,6 +173,14 @@ pub struct Chezmoi {
|
|||||||
exclude_encrypted: Option<bool>,
|
exclude_encrypted: Option<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Deserialize, Default, Debug, Merge)]
|
||||||
|
#[serde(deny_unknown_fields)]
|
||||||
|
#[allow(clippy::upper_case_acronyms)]
|
||||||
|
pub struct Mise {
|
||||||
|
bump: Option<bool>,
|
||||||
|
interactive: Option<bool>,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Default, Debug, Merge)]
|
#[derive(Deserialize, Default, Debug, Merge)]
|
||||||
#[serde(deny_unknown_fields)]
|
#[serde(deny_unknown_fields)]
|
||||||
#[allow(clippy::upper_case_acronyms)]
|
#[allow(clippy::upper_case_acronyms)]
|
||||||
@@ -471,6 +479,9 @@ pub struct ConfigFile {
|
|||||||
#[merge(strategy = crate::utils::merge_strategies::inner_merge_opt)]
|
#[merge(strategy = crate::utils::merge_strategies::inner_merge_opt)]
|
||||||
chezmoi: Option<Chezmoi>,
|
chezmoi: Option<Chezmoi>,
|
||||||
|
|
||||||
|
#[merge(strategy = crate::utils::merge_strategies::inner_merge_opt)]
|
||||||
|
mise: Option<Mise>,
|
||||||
|
|
||||||
#[merge(strategy = crate::utils::merge_strategies::inner_merge_opt)]
|
#[merge(strategy = crate::utils::merge_strategies::inner_merge_opt)]
|
||||||
yarn: Option<Yarn>,
|
yarn: Option<Yarn>,
|
||||||
|
|
||||||
@@ -1804,6 +1815,22 @@ impl Config {
|
|||||||
.unwrap_or(false)
|
.unwrap_or(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn mise_bump(&self) -> bool {
|
||||||
|
self.config_file
|
||||||
|
.mise
|
||||||
|
.as_ref()
|
||||||
|
.and_then(|mise| mise.bump)
|
||||||
|
.unwrap_or(false)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn mise_interactive(&self) -> bool {
|
||||||
|
self.config_file
|
||||||
|
.mise
|
||||||
|
.as_ref()
|
||||||
|
.and_then(|mise| mise.interactive)
|
||||||
|
.unwrap_or(false)
|
||||||
|
}
|
||||||
|
|
||||||
pub fn vscode_profile(&self) -> Option<&str> {
|
pub fn vscode_profile(&self) -> Option<&str> {
|
||||||
let vscode_cfg = self.config_file.vscode.as_ref()?;
|
let vscode_cfg = self.config_file.vscode.as_ref()?;
|
||||||
let profile = vscode_cfg.profile.as_ref()?;
|
let profile = vscode_cfg.profile.as_ref()?;
|
||||||
|
|||||||
@@ -824,7 +824,19 @@ pub fn run_mise(ctx: &ExecutionContext) -> Result<()> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.execute(&mise).arg("upgrade").status_checked()
|
let mut cmd = ctx.execute(&mise);
|
||||||
|
|
||||||
|
cmd.arg("upgrade");
|
||||||
|
|
||||||
|
if ctx.config().mise_interactive() {
|
||||||
|
cmd.arg("--interactive");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ctx.config().mise_bump() {
|
||||||
|
cmd.arg("--bump");
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd.status_checked()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn run_home_manager(ctx: &ExecutionContext) -> Result<()> {
|
pub fn run_home_manager(ctx: &ExecutionContext) -> Result<()> {
|
||||||
|
|||||||
Reference in New Issue
Block a user