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, fuzz::FuzzArgs, geiger, generate, init::InitArgs, inspect, install::InstallArgs,
5 lint::LintArgs, remappings::RemappingArgs, remove::RemoveArgs, selectors::SelectorsSubcommands,
6 snapshot, 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: https://getfoundry.sh/forge/overview",
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 Fuzz(FuzzArgs),
41
42 Script(ScriptArgs),
44
45 Coverage(coverage::CoverageArgs),
47
48 #[command(alias = "bi")]
50 Bind(BindArgs),
51
52 #[command(visible_aliases = ["b", "compile"])]
54 Build(BuildArgs),
55
56 Clone(CloneArgs),
58
59 #[command(visible_alias = "u")]
63 Update(update::UpdateArgs),
64
65 #[command(visible_aliases = ["i", "add"])]
69 Install(InstallArgs),
70
71 #[command(visible_alias = "rm")]
73 Remove(RemoveArgs),
74
75 #[command(visible_alias = "re")]
77 Remappings(RemappingArgs),
78
79 #[command(visible_alias = "v")]
81 VerifyContract(VerifyArgs),
82
83 #[command(visible_alias = "vc")]
85 VerifyCheck(VerifyCheckArgs),
86
87 #[command(visible_alias = "vb")]
89 VerifyBytecode(VerifyBytecodeArgs),
90
91 #[command(visible_alias = "c")]
93 Create(CreateArgs),
94
95 Init(InitArgs),
97
98 #[command(visible_alias = "com")]
100 Completions {
101 #[arg(value_enum)]
102 shell: foundry_cli::clap::Shell,
103 },
104
105 #[command(visible_alias = "cl")]
107 Clean {
108 #[arg(long, value_hint = ValueHint::DirPath, value_name = "PATH")]
113 root: Option<PathBuf>,
114 },
115
116 Cache(CacheArgs),
118
119 #[command(visible_alias = "s")]
121 Snapshot(snapshot::GasSnapshotArgs),
122
123 #[command(visible_alias = "co")]
125 Config(config::ConfigArgs),
126
127 #[command(visible_alias = "f")]
129 Flatten(flatten::FlattenArgs),
130
131 Fmt(FmtArgs),
133
134 #[command(visible_alias = "l")]
136 Lint(LintArgs),
137
138 #[command(visible_alias = "in")]
140 Inspect(inspect::InspectArgs),
141
142 #[command(visible_alias = "tr")]
144 Tree(tree::TreeArgs),
145
146 Geiger(geiger::GeigerArgs),
150
151 Doc(DocArgs),
153
154 #[command(visible_alias = "se")]
156 Selectors {
157 #[command(subcommand)]
158 command: SelectorsSubcommands,
159 },
160
161 #[command(hide = true)]
163 Generate(generate::GenerateArgs),
164
165 Compiler(CompilerArgs),
167
168 Soldeer(soldeer::SoldeerArgs),
170
171 Eip712(eip712::Eip712Args),
173
174 BindJson(bind_json::BindJsonArgs),
176}
177
178#[cfg(test)]
179mod tests {
180 use super::*;
181 use clap::CommandFactory;
182
183 #[test]
184 fn verify_cli() {
185 Forge::command().debug_assert();
186 }
187}