diff --git a/src/commands/ls_remote.rs b/src/commands/ls_remote.rs index 0fc6d5e..157ebd6 100644 --- a/src/commands/ls_remote.rs +++ b/src/commands/ls_remote.rs @@ -11,7 +11,7 @@ pub struct LsRemote { #[arg(long)] filter: Option, - /// Only show latest LTS versions + /// Show only LTS versions (optionally filter by LTS codename) #[arg(long)] lts: Option>, @@ -55,13 +55,8 @@ impl super::command::Command for LsRemote { all_versions.retain(|v| filter.matches(&v.version, config)); } - if all_versions.is_empty() { - eprintln!("{}", "No versions were found!".red()); - return Ok(()); - } - if self.latest { - all_versions = vec![all_versions.into_iter().next().unwrap()]; + all_versions.truncate(1); } all_versions.sort_by_key(|v| v.version.clone()); @@ -69,6 +64,11 @@ impl super::command::Command for LsRemote { all_versions.reverse(); } + if all_versions.is_empty() { + eprintln!("{}", "No versions were found!".red()); + return Ok(()); + } + for version in &all_versions { print!("{}", version.version); if let Some(lts) = &version.lts {