Skip to content

Commit

Permalink
feat: add filter version shortcut
Browse files Browse the repository at this point in the history
  • Loading branch information
Fatpandac committed Jan 10, 2025
1 parent 4399644 commit 65eeb16
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/commands/ls_remote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ use thiserror::Error;

#[derive(clap::Parser, Debug)]
pub struct LsRemote {
/// A version string. Filter versions by a user-defined version or a semver range
version: Option<UserVersion>,

/// Filter versions by a user-defined version or a semver range
#[arg(long)]
filter: Option<UserVersion>,
Expand Down Expand Up @@ -64,7 +67,7 @@ impl super::command::Command for LsRemote {
};
}

if let Some(filter) = &self.filter {
if let Some(filter) = &self.filter.as_ref().or(self.version.as_ref()) {
all_versions.retain(|v| filter.matches(&v.version, config));
}

Expand Down

0 comments on commit 65eeb16

Please sign in to comment.