From ad4061e0b5ce9db7198a17d24182c16fb5148c4f Mon Sep 17 00:00:00 2001 From: Avery Harnish Date: Mon, 8 Jul 2019 15:32:03 -0500 Subject: [PATCH] fix #277: use rust template for rust project --- src/main.rs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/main.rs b/src/main.rs index c77524e33..89b38f502 100644 --- a/src/main.rs +++ b/src/main.rs @@ -15,6 +15,7 @@ mod installer; mod settings; mod terminal; +use crate::settings::project::ProjectType; use terminal::emoji; fn main() -> Result<(), failure::Error> { @@ -167,12 +168,18 @@ fn main() -> Result<(), failure::Error> { } else if let Some(matches) = matches.subcommand_matches("generate") { let name = matches.value_of("name").unwrap_or("worker"); let project_type = match matches.value_of("type") { - Some(s) => Some(settings::project::ProjectType::from_str(&s.to_lowercase())?), + Some(s) => Some(ProjectType::from_str(&s.to_lowercase())?), None => None, }; - let template = matches - .value_of("template") - .unwrap_or("https://github.com/cloudflare/worker-template"); + + let template = matches.value_of("template").unwrap_or(match project_type { + Some(ref pt) => match pt { + ProjectType::Rust => "https://github.com/cloudflare/rustwasm-worker-template", + _ => "https://github.com/cloudflare/worker-template", + }, + _ => "https://github.com/cloudflare/worker-template", + }); + info!( "Generate command called with template {}, and name {}", template, name