From 0042430a36ca75728fbcd0e4716447af59e225e1 Mon Sep 17 00:00:00 2001 From: Matt Hunzinger Date: Tue, 6 Aug 2024 16:52:33 -0400 Subject: [PATCH] Add new crate to workspace members (#2775) * Add new crate to workspace members * Replace DioxusCrate with cargo metadata * Skip initializing git repo in already existing workspace * Fix init in workspace * Fix naming issues with new packages Changes how we parse names so `dx new packages/blah`creates a subdirectory instead --------- Co-authored-by: Jonathan Kelley --- packages/cli/src/cli/create.rs | 94 ++++++++++++++++++++++++++++++---- packages/cli/src/cli/init.rs | 9 +++- 2 files changed, 92 insertions(+), 11 deletions(-) diff --git a/packages/cli/src/cli/create.rs b/packages/cli/src/cli/create.rs index f5cba2f93..c859aa1ff 100644 --- a/packages/cli/src/cli/create.rs +++ b/packages/cli/src/cli/create.rs @@ -1,5 +1,7 @@ use super::*; use cargo_generate::{GenerateArgs, TemplatePath}; +use cargo_metadata::Metadata; +use std::path::Path; pub(crate) static DEFAULT_TEMPLATE: &str = "gh:dioxuslabs/dioxus-template"; @@ -8,26 +10,70 @@ pub(crate) static DEFAULT_TEMPLATE: &str = "gh:dioxuslabs/dioxus-template"; pub struct Create { /// Project name (required when `--yes` is used) name: Option, + + /// Generate the template directly at the given path. + #[arg(long, value_parser)] + destination: Option, + + /// Generate the template directly into the current dir. No subfolder will be created and no vcs is initialized. + #[arg(long, action)] + init: bool, + /// Template path #[clap(default_value = DEFAULT_TEMPLATE, short, long)] template: String, + /// Pass