Skip to content

Commit

Permalink
Move arg validation to a separate func
Browse files Browse the repository at this point in the history
  • Loading branch information
fmoletta committed Jan 18, 2024
1 parent cd3dbaf commit 9b0a7ae
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions cairo-vm-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,7 @@ impl FileWriter {
}
}

fn run(args: impl Iterator<Item = String>) -> Result<(), Error> {
let args = Args::try_parse_from(args)?;

fn validate_args(args: &Args) -> Result<(), Error> {
if args.air_public_input.is_some() && !args.proof_mode {
let error = Args::command().error(
clap::error::ErrorKind::ArgumentConflict,
Expand Down Expand Up @@ -155,6 +153,14 @@ fn run(args: impl Iterator<Item = String>) -> Result<(), Error> {
return Err(Error::Cli(error));
}

Ok(())
}

fn run(args: impl Iterator<Item = String>) -> Result<(), Error> {
let args = Args::try_parse_from(args)?;

validate_args(&args)?;

let trace_enabled = args.trace_file.is_some() || args.air_public_input.is_some();
let mut hint_executor = BuiltinHintProcessor::new_empty();
let cairo_run_config = cairo_run::CairoRunConfig {
Expand Down

0 comments on commit 9b0a7ae

Please sign in to comment.