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

chore(nargo): migrate to clap 4 and use derived interface #842

Merged
merged 8 commits into from
Feb 17, 2023
Merged
Show file tree
Hide file tree
Changes from 4 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
181 changes: 136 additions & 45 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion crates/nargo/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[package]
name = "nargo"
description = "Noir's package manager"
version.workspace = true
authors.workspace = true
edition.workspace = true
Expand All @@ -23,7 +24,7 @@ cfg-if.workspace = true
toml.workspace = true
serde.workspace = true
thiserror.workspace = true
clap = "2.33.3"
clap = { version = "4.1.4", features = ["derive"]}
const_format = "0.2.30"
git-version = "0.3.5"
hex = "0.4.2"
Expand Down
20 changes: 11 additions & 9 deletions crates/nargo/src/cli/check_cmd.rs
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
use crate::{errors::CliError, resolver::Resolver};
use acvm::ProofSystemCompiler;
use clap::ArgMatches;
use clap::Args;
use iter_extended::btree_map;
use noirc_abi::{Abi, AbiParameter, AbiType};
use std::{
collections::BTreeMap,
path::{Path, PathBuf},
};

use super::{add_std_lib, write_to_file};
use super::{add_std_lib, write_to_file, NargoConfig};
use crate::constants::{PROVER_INPUT_FILE, VERIFIER_INPUT_FILE};

pub(crate) fn run(args: ArgMatches) -> Result<(), CliError> {
let args = args.subcommand_matches("check").unwrap();
let allow_warnings = args.is_present("allow-warnings");

let program_dir =
args.value_of("path").map_or_else(|| std::env::current_dir().unwrap(), PathBuf::from);
/// Checks the constraint system for errors
#[derive(Debug, Clone, Args)]
pub(crate) struct CheckCommand {
/// Issue a warning for each unused variable instead of an error
#[arg(short, long)]
allow_warnings: bool,
}

check_from_path(program_dir, allow_warnings)?;
pub(crate) fn run(args: CheckCommand, config: NargoConfig) -> Result<(), CliError> {
check_from_path(config.program_dir, args.allow_warnings)?;
println!("Constraint system successfully built!");
Ok(())
}
Expand Down
Loading