Skip to content

Commit 9010d85

Browse files
Merge pull request #1420 from nextstrain/fix/cli-tag-filter
2 parents d7dda43 + 18ac993 commit 9010d85

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

packages/nextclade-cli/src/cli/nextclade_dataset_get.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ pub fn dataset_http_get(http: &HttpClient, name: impl AsRef<str>, tag: &Option<S
5656
.filter(|dataset| -> bool {
5757
// If a concrete version `tag` is specified, we skip 'enabled', 'compatibility' and 'latest' checks
5858
if let Some(tag) = tag.as_ref() {
59-
dataset.is_tag(tag)
59+
dataset.has_tag(tag)
6060
} else {
6161
true
6262
}

packages/nextclade-cli/src/cli/nextclade_dataset_list.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ pub fn nextclade_dataset_list(
3535
.flat_map(|collection| collection.datasets)
3636
.filter(|dataset| -> bool {
3737
if let Some(tag) = tag.as_ref() {
38-
dataset.is_tag(tag)
38+
dataset.has_tag(tag)
3939
} else {
4040
let is_compatible = include_incompatible || dataset.is_cli_compatible(this_package_version());
4141
let is_not_deprecated = include_deprecated || !dataset.deprecated();

packages/nextclade/src/io/dataset.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,13 @@ impl Dataset {
151151
.map_or(true, |compat| compat.is_cli_compatible(cli_version))
152152
}
153153

154-
pub fn is_tag(&self, tag: impl AsRef<str>) -> bool {
154+
pub fn has_tag(&self, tag: impl AsRef<str>) -> bool {
155155
let tag = tag.as_ref();
156-
self.version.tag == tag
157-
|| (self.version.tag == "unreleased" && tag == "latest")
158-
|| (self.version.tag == "latest" && tag == "unreleased")
156+
self.versions.iter().any(|version| {
157+
version.tag == tag
158+
|| (version.tag == "unreleased" && tag == "latest")
159+
|| (version.tag == "latest" && tag == "unreleased")
160+
})
159161
}
160162
}
161163

0 commit comments

Comments
 (0)