Skip to content

Commit

Permalink
remove default template, specify options
Browse files Browse the repository at this point in the history
  • Loading branch information
Lochlan Wansbrough committed Oct 14, 2024
1 parent eab7de8 commit b5db455
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ members = [
]

[workspace.package]
version = "0.1.8"
version = "0.1.9"
authors = ["Lochlan Wansbrough"]
edition = "2021"
rust-version = "1.80.0"

[workspace.dependencies]
rune = { path = "crates/rune", version = "0.1.8" }
rune = { path = "crates/rune", version = "0.1.9" }
5 changes: 3 additions & 2 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub struct Cli {
pub enum CliCommand {
/// View Rune API documentation
Docs,
/// Create a new Rune project, optionally specifying a template
/// Create a new Rune project, specifying a template
#[command(subcommand)]
New(NewSubcommand),
// /// Pushes a new release candidate for an unreleased version. Will NOT publish
Expand Down Expand Up @@ -63,7 +63,8 @@ pub enum NewSubcommand {
identifier: Option<String>,
#[clap(long, short = 'n', value_name = "NAME")]
name: Option<String>,
/// One of: hello-js, hello-rust, cube-rust
#[clap(long, short = 't', value_name = "TEMPLATE")]
template: Option<String>,
template: String,
},
}
6 changes: 3 additions & 3 deletions src/commands/new/game.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ use liquid::Object;
pub async fn game(
identifier: &Option<String>,
name: &Option<String>,
template: &Option<String>,
template: &String,
) -> Result<()> {
let identifier = identifier.clone().unwrap_or("my-game".to_owned());
let name = name.clone().unwrap_or("My Game".to_owned());
let template_key = template.clone().unwrap_or("hello-js".to_owned());
let template_key = template.clone();

let paths = Templates::iter()
.filter(|p| p.starts_with(&format!("game/{template_key}")))
Expand Down Expand Up @@ -120,5 +120,5 @@ fn to_snake_case(input: &str) -> String {
}

// Replace spaces with underscores
snake_case.replace(" ", "_")
snake_case.replace(" ", "_").replace("-", "_")
}

0 comments on commit b5db455

Please sign in to comment.