From f0656954498875f46a005953b07a41e0f7592a6d Mon Sep 17 00:00:00 2001 From: Libby Horacek Date: Tue, 24 Oct 2023 23:40:00 -0400 Subject: [PATCH] Setting up nix is optional --- src/cli.rs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/cli.rs b/src/cli.rs index 5d8143bdd..a869a9f08 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -212,6 +212,10 @@ pub enum HcScaffold { /// Name of the example to scaffold. One of ['hello-world', 'forum']. example: Option, + #[structopt(long)] + /// Whether to setup the holonix development environment for this web-app + setup_nix: Option, + #[structopt(short, long)] /// The template to scaffold the example for /// Must be an option from the built-in templates: "vanilla", "vue", "lit", "svelte" @@ -702,7 +706,7 @@ Collection "{}" scaffolded! println!("{}", i); } } - HcScaffold::Example { example, template } => { + HcScaffold::Example { example, template, setup_nix } => { let example = match example { Some(e) => e, None => choose_example()?, @@ -914,11 +918,13 @@ Collection "{}" scaffolded! file_tree.build(&app_dir)?; // set up nix - if let Err(err) = setup_nix_developer_environment(&app_dir) { - fs::remove_dir_all(&app_dir)?; + if setup_nix == Some(true) || setup_nix == None { + if let Err(err) = setup_nix_developer_environment(&app_dir) { + fs::remove_dir_all(&app_dir)?; - return Err(err)?; - } + return Err(err)?; + } + }; setup_git_environment(&app_dir)?;