1use crate::cmd::{
2 bind::BindArgs, bind_json, build::BuildArgs, cache::CacheArgs, clone::CloneArgs,
3 compiler::CompilerArgs, config, coverage, create::CreateArgs, doc::DocArgs, eip712, flatten,
4 fmt::FmtArgs, geiger, generate, init::InitArgs, inspect, install::InstallArgs,
5 remappings::RemappingArgs, remove::RemoveArgs, selectors::SelectorsSubcommands, snapshot,
6 soldeer, test, tree, update,
7};
8use clap::{Parser, Subcommand, ValueHint};
9use forge_script::ScriptArgs;
10use forge_verify::{VerifyArgs, VerifyBytecodeArgs, VerifyCheckArgs};
11use foundry_cli::opts::GlobalArgs;
12use foundry_common::version::{LONG_VERSION, SHORT_VERSION};
13use std::path::PathBuf;
14
15#[derive(Parser)]
17#[command(
18 name = "forge",
19 version = SHORT_VERSION,
20 long_version = LONG_VERSION,
21 after_help = "Find more information in the book: http://book.getfoundry.sh/reference/forge/forge.html",
22 next_display_order = None,
23)]
24pub struct Forge {
25 #[command(flatten)]
27 pub global: GlobalArgs,
28
29 #[command(subcommand)]
30 pub cmd: ForgeSubcommand,
31}
32
33#[derive(Subcommand)]
34pub enum ForgeSubcommand {
35 #[command(visible_alias = "t")]
37 Test(test::TestArgs),
38
39 Script(ScriptArgs),
41
42 Coverage(coverage::CoverageArgs),
44
45 #[command(alias = "bi")]
47 Bind(BindArgs),
48
49 #[command(visible_aliases = ["b", "compile"])]
51 Build(BuildArgs),
52
53 Clone(CloneArgs),
55
56 #[command(visible_alias = "u")]
60 Update(update::UpdateArgs),
61
62 #[command(visible_alias = "i")]
66 Install(InstallArgs),
67
68 #[command(visible_alias = "rm")]
70 Remove(RemoveArgs),
71
72 #[command(visible_alias = "re")]
74 Remappings(RemappingArgs),
75
76 #[command(visible_alias = "v")]
78 VerifyContract(VerifyArgs),
79
80 #[command(visible_alias = "vc")]
82 VerifyCheck(VerifyCheckArgs),
83
84 #[command(visible_alias = "vb")]
86 VerifyBytecode(VerifyBytecodeArgs),
87
88 #[command(visible_alias = "c")]
90 Create(CreateArgs),
91
92 Init(InitArgs),
94
95 #[command(visible_alias = "com")]
97 Completions {
98 #[arg(value_enum)]
99 shell: clap_complete::Shell,
100 },
101
102 #[command(visible_alias = "fig")]
104 GenerateFigSpec,
105
106 #[command(visible_alias = "cl")]
108 Clean {
109 #[arg(long, value_hint = ValueHint::DirPath, value_name = "PATH")]
114 root: Option<PathBuf>,
115 },
116
117 Cache(CacheArgs),
119
120 #[command(visible_alias = "s")]
122 Snapshot(snapshot::GasSnapshotArgs),
123
124 #[command(visible_alias = "co")]
126 Config(config::ConfigArgs),
127
128 #[command(visible_alias = "f")]
130 Flatten(flatten::FlattenArgs),
131
132 Fmt(FmtArgs),
134
135 #[command(visible_alias = "in")]
137 Inspect(inspect::InspectArgs),
138
139 #[command(visible_alias = "tr")]
141 Tree(tree::TreeArgs),
142
143 Geiger(geiger::GeigerArgs),
145
146 Doc(DocArgs),
148
149 #[command(visible_alias = "se")]
151 Selectors {
152 #[command(subcommand)]
153 command: SelectorsSubcommands,
154 },
155
156 Generate(generate::GenerateArgs),
158
159 Compiler(CompilerArgs),
161
162 Soldeer(soldeer::SoldeerArgs),
164
165 Eip712(eip712::Eip712Args),
167
168 BindJson(bind_json::BindJsonArgs),
170}
171
172#[cfg(test)]
173mod tests {
174 use super::*;
175 use clap::CommandFactory;
176
177 #[test]
178 fn verify_cli() {
179 Forge::command().debug_assert();
180 }
181}