1use crate::{Format, Runnable};
2use anyhow::Result;
3use clap::Parser;
4
5mod dump_super;
6mod dump_tree;
7mod inode_resolve;
8mod list_chunks;
9mod logical_resolve;
10mod map_swapfile;
11mod min_dev_size;
12mod print_super;
13mod print_tree;
14mod rootid;
15mod subvolid_resolve;
16mod tree_stats;
17
18pub use self::{
19 dump_super::*, dump_tree::*, inode_resolve::*, list_chunks::*,
20 logical_resolve::*, map_swapfile::*, min_dev_size::*, rootid::*,
21 subvolid_resolve::*, tree_stats::*,
22};
23
24#[derive(Parser, Debug)]
32#[allow(clippy::doc_markdown)]
33pub struct InspectCommand {
34 #[clap(subcommand)]
35 pub subcommand: InspectSubcommand,
36}
37
38#[derive(Parser, Debug)]
39pub enum InspectSubcommand {
40 Rootid(RootidCommand),
41 InodeResolve(InodeResolveCommand),
42 LogicalResolve(LogicalResolveCommand),
43 SubvolidResolve(SubvolidResolveCommand),
44 MapSwapfile(MapSwapfileCommand),
45 MinDevSize(MinDevSizeCommand),
46 DumpTree(DumpTreeCommand),
47 DumpSuper(DumpSuperCommand),
48 TreeStats(TreeStatsCommand),
49 ListChunks(ListChunksCommand),
50}
51
52impl Runnable for InspectCommand {
53 fn run(&self, format: Format, dry_run: bool) -> Result<()> {
54 match &self.subcommand {
55 InspectSubcommand::Rootid(cmd) => cmd.run(format, dry_run),
56 InspectSubcommand::InodeResolve(cmd) => cmd.run(format, dry_run),
57 InspectSubcommand::LogicalResolve(cmd) => cmd.run(format, dry_run),
58 InspectSubcommand::SubvolidResolve(cmd) => cmd.run(format, dry_run),
59 InspectSubcommand::MapSwapfile(cmd) => cmd.run(format, dry_run),
60 InspectSubcommand::MinDevSize(cmd) => cmd.run(format, dry_run),
61 InspectSubcommand::DumpTree(cmd) => cmd.run(format, dry_run),
62 InspectSubcommand::DumpSuper(cmd) => cmd.run(format, dry_run),
63 InspectSubcommand::TreeStats(cmd) => cmd.run(format, dry_run),
64 InspectSubcommand::ListChunks(cmd) => cmd.run(format, dry_run),
65 }
66 }
67}