Skip to main content

forest/tool/subcommands/
mod.rs

1// Copyright 2019-2026 ChainSafe Systems
2// SPDX-License-Identifier: Apache-2.0, MIT
3
4pub(crate) mod api_cmd;
5pub(crate) mod archive_cmd;
6mod backup_cmd;
7mod benchmark_cmd;
8mod car_cmd;
9mod db_cmd;
10mod fetch_params_cmd;
11mod index_cmd;
12mod net_cmd;
13mod shed_cmd;
14mod snapshot_cmd;
15mod state_migration_cmd;
16
17use crate::cli_shared::cli::*;
18use crate::cli_shared::cli::{CompletionCommand, HELP_MESSAGE};
19use crate::utils::version::FOREST_VERSION_STRING;
20use clap::Parser;
21
22/// Command-line options for the `forest-tool` binary
23#[derive(Parser)]
24#[command(name = env!("CARGO_PKG_NAME"), bin_name = "forest-tool", author = env!("CARGO_PKG_AUTHORS"), version = FOREST_VERSION_STRING.as_str(), about = env!("CARGO_PKG_DESCRIPTION")
25)]
26#[command(help_template(HELP_MESSAGE))]
27pub struct Cli {
28    #[command(subcommand)]
29    pub cmd: Subcommand,
30}
31
32/// forest-tool sub-commands
33#[derive(clap::Subcommand)]
34#[allow(clippy::large_enum_variant)]
35pub enum Subcommand {
36    /// Create and restore backups
37    #[command(subcommand)]
38    Backup(backup_cmd::BackupCommands),
39
40    /// Benchmark various Forest subsystems
41    #[command(subcommand)]
42    Benchmark(benchmark_cmd::BenchmarkCommands),
43
44    /// State migration tools
45    #[command(subcommand)]
46    StateMigration(state_migration_cmd::StateMigrationCommands),
47
48    /// Manage snapshots
49    #[command(subcommand)]
50    Snapshot(snapshot_cmd::SnapshotCommands),
51
52    /// Download parameters for generating and verifying proofs for given size
53    #[command(name = "fetch-params")]
54    Fetch(fetch_params_cmd::FetchCommands),
55
56    /// Manage archives
57    #[command(subcommand)]
58    Archive(archive_cmd::ArchiveCommands),
59
60    /// Database management
61    #[command(subcommand)]
62    DB(db_cmd::DBCommands),
63
64    /// Index database management
65    #[command(subcommand)]
66    Index(index_cmd::IndexCommands),
67
68    /// Utilities for manipulating CAR files
69    #[command(subcommand)]
70    Car(car_cmd::CarCommands),
71
72    /// API tooling
73    #[command(subcommand)]
74    Api(api_cmd::ApiCommands),
75
76    /// Network utilities
77    #[command(subcommand)]
78    Net(net_cmd::NetCommands),
79
80    /// Miscellaneous, semver-exempt commands for developer use.
81    #[command(subcommand)]
82    Shed(shed_cmd::ShedCommands),
83
84    Completion(CompletionCommand),
85}