From 5a881877a8e756198187167443d3ec32f4167e68 Mon Sep 17 00:00:00 2001 From: Arsenii Kulikov Date: Wed, 10 Jul 2024 18:30:46 +0400 Subject: [PATCH] add out arg --- crates/forge/bin/cmd/bind_json.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/forge/bin/cmd/bind_json.rs b/crates/forge/bin/cmd/bind_json.rs index 78419e16224f2..ee8b334c94f8b 100644 --- a/crates/forge/bin/cmd/bind_json.rs +++ b/crates/forge/bin/cmd/bind_json.rs @@ -1,5 +1,5 @@ use super::eip712::Resolver; -use clap::Parser; +use clap::{Parser, ValueHint}; use eyre::{Ok, Result}; use foundry_cli::{opts::CoreBuildArgs, utils::LoadConfig}; use foundry_common::{compile::with_compilation_reporter, fs}; @@ -28,6 +28,10 @@ foundry_config::impl_figment_convert!(BindJsonArgs, opts); /// CLI arguments for `forge bind-json`. #[derive(Clone, Debug, Parser)] pub struct BindJsonArgs { + /// The path to write bindings to. + #[arg(value_hint = ValueHint::FilePath, value_name = "PATH")] + pub out: Option, + #[command(flatten)] opts: CoreBuildArgs, } @@ -58,7 +62,7 @@ impl BindJsonArgs { let config = self.try_load_config_emit_warnings()?; let project = config.create_project(false, true)?; - let target_path = config.root.0.join(&config.bind_json.out); + let target_path = config.root.0.join(self.out.as_ref().unwrap_or(&config.bind_json.out)); let sources = project.paths.read_input_files()?; let graph = Graph::::resolve_sources(&project.paths, sources)?;