From 68f5887f9083e8194a9252d09ee0af363ffffa03 Mon Sep 17 00:00:00 2001 From: Tom French <15848336+TomAFrench@users.noreply.github.com> Date: Fri, 4 Aug 2023 19:10:01 +0100 Subject: [PATCH] fix: remove duplicated `name` option in `nargo new` (#2183) --- crates/nargo_cli/src/cli/new_cmd.rs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/crates/nargo_cli/src/cli/new_cmd.rs b/crates/nargo_cli/src/cli/new_cmd.rs index e67a046293..85e2522a5a 100644 --- a/crates/nargo_cli/src/cli/new_cmd.rs +++ b/crates/nargo_cli/src/cli/new_cmd.rs @@ -1,9 +1,6 @@ use crate::errors::CliError; -use super::{ - init_cmd::{initialize_project, InitCommand}, - NargoConfig, -}; +use super::{init_cmd::initialize_project, NargoConfig}; use acvm::Backend; use clap::Args; use nargo::package::PackageType; @@ -19,8 +16,13 @@ pub(crate) struct NewCommand { #[clap(long)] name: Option, - #[clap(flatten)] - init_config: InitCommand, + /// Use a library template + #[arg(long, conflicts_with = "bin")] + pub(crate) lib: bool, + + /// Use a binary template [default] + #[arg(long, conflicts_with = "lib")] + pub(crate) bin: bool, } pub(crate) fn run( @@ -37,8 +39,7 @@ pub(crate) fn run( let package_name = args.name.unwrap_or_else(|| args.path.file_name().unwrap().to_str().unwrap().to_owned()); - let package_type = - if args.init_config.lib { PackageType::Library } else { PackageType::Binary }; + let package_type = if args.lib { PackageType::Library } else { PackageType::Binary }; initialize_project(package_dir, &package_name, package_type); Ok(()) }