Skip to content

Commit c951ec8

Browse files
committed
Fix spin new list offset error in the presence of add-only templates
Signed-off-by: itowlson <[email protected]>
1 parent e51d608 commit c951ec8

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/commands/new.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,10 +305,15 @@ async fn prompt_template(
305305
variant: &TemplateVariantInfo,
306306
tags: &[String],
307307
) -> anyhow::Result<Option<Template>> {
308-
let mut templates = match list_or_install_templates(template_manager, tags).await? {
308+
let templates = match list_or_install_templates(template_manager, tags).await? {
309309
Some(t) => t,
310310
None => return Ok(None),
311311
};
312+
let mut templates = templates
313+
.into_iter()
314+
.filter(|t| t.supports_variant(variant))
315+
.collect::<Vec<_>>();
316+
312317
if templates.is_empty() {
313318
if tags.len() == 1 {
314319
bail!("No templates matched '{}'", tags[0]);
@@ -319,7 +324,6 @@ async fn prompt_template(
319324

320325
let opts = templates
321326
.iter()
322-
.filter(|t| t.supports_variant(variant))
323327
.map(|t| format!("{} ({})", t.id(), t.description_or_empty()))
324328
.collect::<Vec<_>>();
325329
let noun = variant.prompt_noun();

0 commit comments

Comments
 (0)