Skip to content

Commit 6ac1a0f

Browse files
factorydroidechobt
authored andcommitted
fix(cli): allow --changelog flag without specifying version
Fixes bounty issue #1385 When running 'cortex upgrade --changelog' without specifying a version, the command would exit early if the user was already on the latest version, before displaying the changelog. This fix moves the early exit check to after the changelog display, so the changelog is always shown when requested regardless of whether an upgrade is available.
1 parent 5bea172 commit 6ac1a0f

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

cortex-cli/src/upgrade_cmd.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,9 @@ impl UpgradeCli {
168168
match comparison {
169169
VersionCompare::Same => {
170170
println!("\n✓ You are already on the latest version (v{target_version}).");
171-
if !self.force {
172-
return Ok(());
171+
if self.force {
172+
println!(" (forcing reinstall due to --force flag)");
173173
}
174-
println!(" (forcing reinstall due to --force flag)");
175174
}
176175
VersionCompare::Newer => {
177176
println!("\n→ Update available: v{current_version} → v{target_version}");
@@ -191,6 +190,11 @@ impl UpgradeCli {
191190
}
192191
}
193192

193+
// If already on latest version and not forcing, stop here after showing changelog
194+
if comparison == VersionCompare::Same && !self.force {
195+
return Ok(());
196+
}
197+
194198
// If check-only mode, stop here
195199
if self.check {
196200
println!("\nRun `Cortex upgrade` to install this version.");

0 commit comments

Comments
 (0)