-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(nargo): print-acir command (#1031)
feat(nargo) print-acir command
- Loading branch information
1 parent
2e38ab0
commit 408d9c0
Showing
2 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
use clap::Args; | ||
use noirc_driver::CompileOptions; | ||
use std::path::Path; | ||
|
||
use crate::cli::compile_cmd::compile_circuit; | ||
use crate::errors::CliError; | ||
|
||
use super::NargoConfig; | ||
|
||
/// Prints out the ACIR for a compiled circuit | ||
#[derive(Debug, Clone, Args)] | ||
pub(crate) struct PrintAcirCommand { | ||
#[clap(flatten)] | ||
compile_options: CompileOptions, | ||
} | ||
|
||
pub(crate) fn run(args: PrintAcirCommand, config: NargoConfig) -> Result<(), CliError> { | ||
print_acir_with_path(config.program_dir, &args.compile_options) | ||
} | ||
|
||
fn print_acir_with_path<P: AsRef<Path>>( | ||
program_dir: P, | ||
compile_options: &CompileOptions, | ||
) -> Result<(), CliError> { | ||
let compiled_program = compile_circuit(program_dir.as_ref(), compile_options)?; | ||
println!("{}", compiled_program.circuit); | ||
|
||
Ok(()) | ||
} |