From d776b95c7cd2c90722200d665402ae319629307d Mon Sep 17 00:00:00 2001 From: Rigellute Date: Sun, 20 Oct 2019 15:13:40 +0100 Subject: [PATCH] Hide "Unreleased" header in CHANGELOG for release --- src/ui/mod.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/ui/mod.rs b/src/ui/mod.rs index d5aa403f..2cf9bafd 100644 --- a/src/ui/mod.rs +++ b/src/ui/mod.rs @@ -704,14 +704,22 @@ where .border_style(get_color(highlight_state)) .render(f, layout_chunk); - let change_log = include_str!("../../CHANGELOG.md"); + let changelog = include_str!("../../CHANGELOG.md").to_string(); + + // If debug mode show the "Unreleased" header. Otherwise it is a release so there should be no + // unreleased features + let clean_changelog = if cfg!(debug_assertions) { + changelog + } else { + changelog.replace("\n## [Unreleased]\n", "") + }; let top_text = vec![ Text::styled(BANNER, Style::default().fg(Color::LightCyan)), Text::raw("\nPlease report any bugs or missing features to https://github.com/Rigellute/spotify-tui"), ]; - let bottom_text = vec![Text::raw(change_log)]; + let bottom_text = vec![Text::raw(clean_changelog)]; // Contains the banner Paragraph::new(top_text.iter())