Skip to content

Commit

Permalink
fix(generate): use structopt ya dingus
Browse files Browse the repository at this point in the history
  • Loading branch information
ashleygwilliams committed Apr 11, 2019
1 parent ca35b01 commit f3471a7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
5 changes: 1 addition & 4 deletions src/command/generate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,8 @@ use PBAR;

/// Executes the 'cargo-generate' command in the current directory
/// which generates a new rustwasm project from a template.
pub fn generate(template: Option<String>, name: Option<String>) -> result::Result<(), Error> {
pub fn generate(template: String, name: String) -> result::Result<(), Error> {
info!("Generating a new rustwasm project...");
let template =
template.unwrap_or_else(|| "https://github.com/rustwasm/wasm-pack-template".to_string());
let name = name.unwrap_or_else(|| "hello-wasm".to_string());
let download = install::install(
Tool::CargoGenerate,
&cache::get_wasm_pack_cache()?,
Expand Down
10 changes: 8 additions & 2 deletions src/command/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,15 @@ pub enum Command {
/// 🐑 create a new project with a template
Generate {
/// The URL to the template
template: Option<String>,
#[structopt(
long = "template",
short = "temp",
default_value = "https://github.com/rustwasm/wasm-pack-template"
)]
template: String,
/// The name of the project
name: Option<String>,
#[structopt(long = "name", short = "n", default_value = "hello-wasm")]
name: String,
},

#[structopt(name = "publish")]
Expand Down

0 comments on commit f3471a7

Please sign in to comment.