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)]
25#[allow(clippy::doc_markdown)]
26pub struct QgroupCommand {
27 #[clap(subcommand)]
28 pub subcommand: QgroupSubcommand,
29}
30
31impl Runnable for QgroupCommand {
32 fn run(&self, format: Format, dry_run: bool) -> Result<()> {
33 match &self.subcommand {
34 QgroupSubcommand::Assign(cmd) => cmd.run(format, dry_run),
35 QgroupSubcommand::Remove(cmd) => cmd.run(format, dry_run),
36 QgroupSubcommand::Create(cmd) => cmd.run(format, dry_run),
37 QgroupSubcommand::Destroy(cmd) => cmd.run(format, dry_run),
38 QgroupSubcommand::Show(cmd) => cmd.run(format, dry_run),
39 QgroupSubcommand::Limit(cmd) => cmd.run(format, dry_run),
40 QgroupSubcommand::ClearStale(cmd) => cmd.run(format, dry_run),
41 }
42 }
43}
44
45#[derive(Parser, Debug)]
46pub enum QgroupSubcommand {
47 Assign(QgroupAssignCommand),
48 Remove(QgroupRemoveCommand),
49 Create(QgroupCreateCommand),
50 Destroy(QgroupDestroyCommand),
51 Show(QgroupShowCommand),
52 Limit(QgroupLimitCommand),
53 #[command(name = "clear-stale")]
54 ClearStale(QgroupClearStaleCommand),
55}