Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove duplicated name option in nargo new #2183

Merged
merged 1 commit into from
Aug 4, 2023
Merged
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
fix: remove duplicated name option in nargo new
TomAFrench committed Aug 4, 2023
commit 8cf2d7a3b3bc8e2f487478e9aa24115d9392d710
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;
@@ -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>(
@@ -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(())
}