Skip to content

Commit

Permalink
feat(cli): ✨ Add circuit module with copy_circuit_file function
Browse files Browse the repository at this point in the history
  • Loading branch information
SpiralOutDotEu committed Oct 30, 2023
1 parent 9d65b39 commit e010ba0
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/commands/circuit.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
use std::env;
use std::fs::File;
use std::io::{self, Write};
use std::path::Path;

/// Copies a circuit file template to the current directory.
/// This function is called when the `circuit` subcommand is used.
pub fn copy_circuit_file() -> io::Result<()> {
let current_dir = env::current_dir()?;
let circuit_path = Path::new(&current_dir).join("circuit.circom");
let mut file = File::create(circuit_path)?;
file.write_all(include_bytes!("../templates/circuit.circom"))?;
Ok(())
}

0 comments on commit e010ba0

Please sign in to comment.