1use crate::{Format, Runnable};
2use anyhow::Result;
3use clap::Parser;
4
5mod assign;
6mod clear_stale;
7mod create;
8mod destroy;
9mod limit;
10mod remove;
11mod show;
12
13pub use self::{
14 assign::*, clear_stale::*, create::*, destroy::*, limit::*, remove::*,
15 show::*,
16};
17
18#[derive(Parser, Debug)]
25pub struct QgroupCommand {
26 #[clap(subcommand)]
27 pub subcommand: QgroupSubcommand,
28}
29
30impl Runnable for QgroupCommand {
31 fn run(&self, format: Format, dry_run: bool) -> Result<()> {
32 match &self.subcommand {
33 QgroupSubcommand::Assign(cmd) => cmd.run(format, dry_run),
34 QgroupSubcommand::Remove(cmd) => cmd.run(format, dry_run),
35 QgroupSubcommand::Create(cmd) => cmd.run(format, dry_run),
36 QgroupSubcommand::Destroy(cmd) => cmd.run(format, dry_run),
37 QgroupSubcommand::Show(cmd) => cmd.run(format, dry_run),
38 QgroupSubcommand::Limit(cmd) => cmd.run(format, dry_run),
39 QgroupSubcommand::ClearStale(cmd) => cmd.run(format, dry_run),
40 }
41 }
42}
43
44#[derive(Parser, Debug)]
45pub enum QgroupSubcommand {
46 Assign(QgroupAssignCommand),
47 Remove(QgroupRemoveCommand),
48 Create(QgroupCreateCommand),
49 Destroy(QgroupDestroyCommand),
50 Show(QgroupShowCommand),
51 Limit(QgroupLimitCommand),
52 #[command(name = "clear-stale")]
53 ClearStale(QgroupClearStaleCommand),
54}