Skip to content
This repository has been archived by the owner on Aug 3, 2023. It is now read-only.

Commit

Permalink
fix #277: use rust template for rust project
Browse files Browse the repository at this point in the history
  • Loading branch information
EverlastingBugstopper committed Jul 8, 2019
1 parent 04b8956 commit ad4061e
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ mod installer;
mod settings;
mod terminal;

use crate::settings::project::ProjectType;
use terminal::emoji;

fn main() -> Result<(), failure::Error> {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit ad4061e

Please sign in to comment.