feat(mise): add mise configuration options for bump and interactive modes (#1546)

This commit is contained in:
Rubin Bhandari
2025-11-20 22:13:13 +05:45
committed by GitHub
parent 2d40f7bdb3
commit 9bb5a680ac
3 changed files with 50 additions and 1 deletions

View File

@@ -291,6 +291,16 @@
# (default: 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]
# Use sudo if the NPM directory isn't owned by the current user
# use_sudo = true

View File

@@ -173,6 +173,14 @@ pub struct Chezmoi {
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)]
#[serde(deny_unknown_fields)]
#[allow(clippy::upper_case_acronyms)]
@@ -471,6 +479,9 @@ pub struct ConfigFile {
#[merge(strategy = crate::utils::merge_strategies::inner_merge_opt)]
chezmoi: Option<Chezmoi>,
#[merge(strategy = crate::utils::merge_strategies::inner_merge_opt)]
mise: Option<Mise>,
#[merge(strategy = crate::utils::merge_strategies::inner_merge_opt)]
yarn: Option<Yarn>,
@@ -1804,6 +1815,22 @@ impl Config {
.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> {
let vscode_cfg = self.config_file.vscode.as_ref()?;
let profile = vscode_cfg.profile.as_ref()?;

View File

@@ -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<()> {