feat: suppress pixi release notes by default (#1225)
Co-authored-by: Gideon <87426140+GideonBear@users.noreply.github.com>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -301,6 +301,13 @@ pub struct Flatpak {
|
||||
use_sudo: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Default, Debug, Merge)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
#[allow(clippy::upper_case_acronyms)]
|
||||
pub struct Pixi {
|
||||
include_release_notes: Option<bool>,
|
||||
}
|
||||
|
||||
#[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<Flatpak>,
|
||||
|
||||
#[merge(strategy = crate::utils::merge_strategies::inner_merge_opt)]
|
||||
pixi: Option<Pixi>,
|
||||
|
||||
#[merge(strategy = crate::utils::merge_strategies::inner_merge_opt)]
|
||||
distrobox: Option<Distrobox>,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user