diff --git a/config.example.toml b/config.example.toml index 7c0db353..e171263a 100644 --- a/config.example.toml +++ b/config.example.toml @@ -325,3 +325,9 @@ # extensions should be updated for. # (default: this won't be set by default) # profile = "" + +[pixi] +# Show the release notes of the latest pixi release +# during the pixi step +# (default: false) +# include_release_notes = false diff --git a/src/config.rs b/src/config.rs index 237739b3..a6174bb2 100644 --- a/src/config.rs +++ b/src/config.rs @@ -301,6 +301,13 @@ pub struct Flatpak { use_sudo: Option, } +#[derive(Deserialize, Default, Debug, Merge)] +#[serde(deny_unknown_fields)] +#[allow(clippy::upper_case_acronyms)] +pub struct Pixi { + include_release_notes: Option, +} + #[derive(Deserialize, Default, Debug, Merge)] #[serde(deny_unknown_fields)] pub struct Brew { @@ -560,6 +567,9 @@ pub struct ConfigFile { #[merge(strategy = crate::utils::merge_strategies::inner_merge_opt)] flatpak: Option, + #[merge(strategy = crate::utils::merge_strategies::inner_merge_opt)] + pixi: Option, + #[merge(strategy = crate::utils::merge_strategies::inner_merge_opt)] distrobox: Option, @@ -1345,6 +1355,15 @@ impl Config { .unwrap_or("") } + /// Show release notes of latest pixi release + pub fn show_pixi_release_notes(&self) -> bool { + self.config_file + .pixi + .as_ref() + .and_then(|s| s.include_release_notes) + .unwrap_or(false) + } + /// Show news on Arch Linux pub fn show_arch_news(&self) -> bool { self.config_file diff --git a/src/steps/generic.rs b/src/steps/generic.rs index 24d04406..5d712a5f 100644 --- a/src/steps/generic.rs +++ b/src/steps/generic.rs @@ -590,14 +590,21 @@ pub fn run_pixi_update(ctx: &ExecutionContext) -> Result<()> { // Check if `pixi --help` mentions self-update, if yes, self-update must be enabled. // pixi self-update --help works regardless of whether the feature is enabled. - let output = ctx.run_type().execute(&pixi).arg("--help").output_checked()?; + let top_level_help_output = ctx.run_type().execute(&pixi).arg("--help").output_checked_utf8()?; - if String::from_utf8(output.stdout)?.contains("self-update") { - ctx.run_type() + if top_level_help_output.stdout.contains("self-update") { + let self_update_help_output = ctx + .run_type() .execute(&pixi) - .args(["self-update"]) - .status_checked() - .ok(); + .args(["self-update", "--help"]) + .output_checked_utf8()?; + let mut cmd = ctx.run_type().execute(&pixi); + cmd.arg("self-update"); + // check if help mentions --no-release-note to check if it is supported + if self_update_help_output.stdout.contains("--no-release-note") && !ctx.config().show_pixi_release_notes() { + cmd.arg("--no-release-note"); + } + cmd.status_checked()?; } ctx.run_type()