1use crate::{Format, Runnable};
2use anyhow::Result;
3use clap::Parser;
4
5mod disable;
6mod enable;
7mod rescan;
8mod status;
9
10use disable::QuotaDisableCommand;
11use enable::QuotaEnableCommand;
12use rescan::QuotaRescanCommand;
13use status::QuotaStatusCommand;
14
15#[derive(Parser, Debug)]
21pub struct QuotaCommand {
22 #[clap(subcommand)]
23 pub subcommand: QuotaSubcommand,
24}
25
26impl Runnable for QuotaCommand {
27 fn run(&self, format: Format, dry_run: bool) -> Result<()> {
28 match &self.subcommand {
29 QuotaSubcommand::Enable(cmd) => cmd.run(format, dry_run),
30 QuotaSubcommand::Disable(cmd) => cmd.run(format, dry_run),
31 QuotaSubcommand::Rescan(cmd) => cmd.run(format, dry_run),
32 QuotaSubcommand::Status(cmd) => cmd.run(format, dry_run),
33 }
34 }
35}
36
37#[derive(Parser, Debug)]
38pub enum QuotaSubcommand {
39 Enable(QuotaEnableCommand),
40 Disable(QuotaDisableCommand),
41 Rescan(QuotaRescanCommand),
42 Status(QuotaStatusCommand),
43}