Skip to content

Commit

Permalink
fix: remove duplicated name option in nargo new (#2183)
Browse files Browse the repository at this point in the history
  • Loading branch information
TomAFrench authored Aug 4, 2023
1 parent afc473d commit 68f5887
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions crates/nargo_cli/src/cli/new_cmd.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -19,8 +16,13 @@ pub(crate) struct NewCommand {
#[clap(long)]
name: Option<String>,

#[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<B: Backend>(
Expand All @@ -37,8 +39,7 @@ pub(crate) fn run<B: Backend>(

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(())
}

0 comments on commit 68f5887

Please sign in to comment.