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

Commit

Permalink
Add error when template is passed to generate site
Browse files Browse the repository at this point in the history
  • Loading branch information
EverlastingBugstopper committed Oct 21, 2019
1 parent 20dc165 commit 8dca047
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -390,17 +390,21 @@ fn run() -> Result<(), failure::Error> {
} else if let Some(matches) = matches.subcommand_matches("generate") {
let name = matches.value_of("name").unwrap_or("worker");
let site = matches.is_present("site");
let template_value = matches.value_of("template");
let mut target_type = None;

let template = if site {
if template_value.is_some() {
failure::bail!("You cannot specify a template when generating a Workers Site. If you want to generate site boilerplate, run wrangler generate --site")
}
"https://github.com/cloudflare/worker-sites-template"
} else {
if let Some(type_value) = matches.value_of("type") {
target_type = Some(TargetType::from_str(&type_value.to_lowercase())?);
}

let default_template = "https://github.com/cloudflare/worker-template";
let template = matches.value_of("template").unwrap_or(match target_type {
let template = template_value.unwrap_or(match target_type {
Some(ref pt) => match pt {
TargetType::Rust => "https://github.com/cloudflare/rustwasm-worker-template",
_ => default_template,
Expand Down

0 comments on commit 8dca047

Please sign in to comment.