Radish alpha
r
Radicle CI broker
Radicle
Git (anonymous pull)
Log in to clone via SSH
refactor: rename *Cmd to *SubCmd, Counter/EventRun to *Cmd
Lars Wirzenius committed 1 year ago
commit 5f1ce255c01c8ae2bcafc01953262fdd9abeb381
parent d4cbcc81ed917d5244d23767195b55d33d93a4a4
1 file changed +24 -24
modified src/bin/cibtool.rs
@@ -72,30 +72,30 @@ impl Args {

#[derive(Parser)]
enum Cmd {
-
    Counter(Counter),
-
    Event(Event),
-
    Run(Run),
+
    Counter(CounterCmd),
+
    Event(EventCmd),
+
    Run(RunCmd),
}

#[derive(Parser)]
-
struct Counter {
+
struct CounterCmd {
    #[clap(subcommand)]
-
    cmd: CounterCmd,
+
    cmd: CounterSubCmd,
}

-
impl Counter {
+
impl CounterCmd {
    #[allow(clippy::result_large_err)]
    fn run(&self, args: &Args) -> Result<(), CibToolError> {
        match &self.cmd {
-
            CounterCmd::Show(x) => x.run(args)?,
-
            CounterCmd::Count(x) => x.run(args)?,
+
            CounterSubCmd::Show(x) => x.run(args)?,
+
            CounterSubCmd::Count(x) => x.run(args)?,
        }
        Ok(())
    }
}

#[derive(Parser)]
-
enum CounterCmd {
+
enum CounterSubCmd {
    Show(ShowCounter),
    Count(CountCounter),
}
@@ -165,28 +165,28 @@ impl CountCounter {
}

#[derive(Parser)]
-
struct Event {
+
struct EventCmd {
    #[clap(subcommand)]
-
    cmd: EventCmd,
+
    cmd: EventSubCmd,
}

-
impl Event {
+
impl EventCmd {
    #[allow(clippy::result_large_err)]
    fn run(&self, args: &Args) -> Result<(), CibToolError> {
        match &self.cmd {
-
            EventCmd::Add(x) => x.run(args)?,
-
            EventCmd::Shutdown(x) => x.run(args)?,
-
            EventCmd::List(x) => x.run(args)?,
-
            EventCmd::Count(x) => x.run(args)?,
-
            EventCmd::Show(x) => x.run(args)?,
-
            EventCmd::Remove(x) => x.run(args)?,
+
            EventSubCmd::Add(x) => x.run(args)?,
+
            EventSubCmd::Shutdown(x) => x.run(args)?,
+
            EventSubCmd::List(x) => x.run(args)?,
+
            EventSubCmd::Count(x) => x.run(args)?,
+
            EventSubCmd::Show(x) => x.run(args)?,
+
            EventSubCmd::Remove(x) => x.run(args)?,
        }
        Ok(())
    }
}

#[derive(Parser)]
-
enum EventCmd {
+
enum EventSubCmd {
    List(ListEvents),
    Count(CountEvents),
    Add(AddEvent),
@@ -444,23 +444,23 @@ impl Shutdown {
}

#[derive(Parser)]
-
struct Run {
+
struct RunCmd {
    #[clap(subcommand)]
-
    cmd: RunCmd,
+
    cmd: RunSubCmd,
}

-
impl Run {
+
impl RunCmd {
    #[allow(clippy::result_large_err)]
    fn run(&self, args: &Args) -> Result<(), CibToolError> {
        match &self.cmd {
-
            RunCmd::List(x) => x.run(args)?,
+
            RunSubCmd::List(x) => x.run(args)?,
        }
        Ok(())
    }
}

#[derive(Parser)]
-
enum RunCmd {
+
enum RunSubCmd {
    List(ListRuns),
}