From 806e8da4eee4d8dfcd5baf32cc4e7c945e32d910 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20Wo=C5=BAniak?= Date: Thu, 5 Aug 2021 10:27:00 +0200 Subject: [PATCH] Reveerse comand namespace --- src/main.rs | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/src/main.rs b/src/main.rs index 1113874..9c1725a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -61,14 +61,6 @@ pub enum FanMode { Automatic, } -#[derive(Options)] -pub enum Command { - #[options(help = "GPU card fan control")] - Fan(fan::FanCommand), - #[options(help = "Overclock GPU card")] - Voltage(voltage::VoltageCommand), -} - #[derive(Options)] pub struct Opts { #[options(help = "Help message")] @@ -76,7 +68,7 @@ pub struct Opts { #[options(help = "Print version")] version: bool, #[options(command)] - command: Option, + command: Option, } fn main() -> std::io::Result<()> { @@ -100,15 +92,15 @@ fn main() -> std::io::Result<()> { match opts.command { None => fan::service::run(config), - Some(Command::Fan(fan::FanCommand::Monitor(monitor))) => fan::monitor::run(monitor, config), - Some(Command::Fan(fan::FanCommand::Service(_))) => fan::service::run(config), - Some(Command::Fan(fan::FanCommand::SetAutomatic(switcher))) => { + Some(fan::FanCommand::Monitor(monitor)) => fan::monitor::run(monitor, config), + Some(fan::FanCommand::Service(_)) => fan::service::run(config), + Some(fan::FanCommand::SetAutomatic(switcher)) => { fan::change_mode::run(switcher, FanMode::Automatic, config) } - Some(Command::Fan(fan::FanCommand::SetManual(switcher))) => { + Some(fan::FanCommand::SetManual(switcher)) => { fan::change_mode::run(switcher, FanMode::Manual, config) } - Some(Command::Fan(fan::FanCommand::Available(_))) => { + Some(fan::FanCommand::Available(_)) => { println!("Available cards"); utils::controllers(&config, false)? .into_iter() @@ -121,8 +113,5 @@ fn main() -> std::io::Result<()> { }); Ok(()) } - Some(Command::Voltage(voltage::VoltageCommand::Placeholder(_))) => { - unimplemented!() - } } }