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

Use rust template for rust project #309

Merged
merged 1 commit into from
Jul 11, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 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,19 @@ 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,
ashleymichal marked this conversation as resolved.
Show resolved Hide resolved
};
let template = matches
.value_of("template")
.unwrap_or("https://github.com/cloudflare/worker-template");

let default_template = "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",
_ => default_template,
},
_ => default_template,
});
ashleymichal marked this conversation as resolved.
Show resolved Hide resolved

info!(
"Generate command called with template {}, and name {}",
template, name
Expand Down