Skip to content
Merged
Show file tree
Hide file tree
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
12 changes: 9 additions & 3 deletions crates/dodeca/src/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ pub fn available_templates() -> Vec<Template> {
}

/// Run the init command
pub async fn run_init(name: String, template_name: Option<String>) -> Result<()> {
pub async fn run_init(
name: String,
template_name: Option<String>,
initialise_git: bool,
) -> Result<()> {
let target_dir = Utf8PathBuf::from(&name);

// Check if directory already exists
Expand Down Expand Up @@ -102,8 +106,10 @@ pub async fn run_init(name: String, template_name: Option<String>) -> Result<()>
let strip_prefix = Utf8Path::new(template.name);
copy_template_dir(template_dir, &target_dir, &site_name, strip_prefix)?;

// Git init if not already in a repo
maybe_git_init(&target_dir);
if initialise_git {
// Git init if not already in a repo
maybe_git_init(&target_dir);
}

// Success message
println!("\n{} To get started:\n", "Done!".green().bold());
Expand Down
6 changes: 5 additions & 1 deletion crates/dodeca/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,10 @@ struct InitArgs {
/// Template to use (skips interactive selection)
#[facet(args::named, args::short = 't', default)]
template: Option<String>,

/// Skip initialising Git in the new directory
#[facet(args::named, rename = "skip-git-init", default)]
skip_git_init: bool,
}

/// Term command arguments
Expand Down Expand Up @@ -512,7 +516,7 @@ async fn async_main(command: Command) -> Result<()> {
// Initialize tracing early so errors are visible
logging::init_standard_tracing();

init::run_init(args.name, args.template).await
init::run_init(args.name, args.template, !args.skip_git_init).await
}
Command::Term(args) => run_term(args).await,
}
Expand Down
Loading