feat: reorder CLI parameters

This commit is contained in:
Denis Benato
2026-01-26 20:49:41 +01:00
parent 37fad1741e
commit 7d55a2675b
3 changed files with 26 additions and 11 deletions

View File

@@ -8,7 +8,7 @@ use rog_aura::{AuraEffect, AuraModeNum, AuraZone, Colour, Direction, Speed};
#[derive(FromArgs, Debug, Clone)]
#[argh(
subcommand,
name = "aura-power-old",
name = "power-tuf",
description = "aura power (old ROGs and TUF laptops)"
)]
pub struct LedPowerCommand1 {
@@ -38,7 +38,7 @@ pub struct LedPowerCommand1 {
}
#[derive(FromArgs, Debug, Clone)]
#[argh(subcommand, name = "aura-power", description = "aura power")]
#[argh(subcommand, name = "power", description = "aura power")]
pub struct LedPowerCommand2 {
#[argh(subcommand)]
pub command: Option<SetAuraZoneEnabled>,

View File

@@ -18,9 +18,7 @@ pub struct CliStart {
#[derive(FromArgs, Debug)]
#[argh(subcommand)]
pub enum CliCommand {
Aura(LedModeCommand),
AuraPowerOld(LedPowerCommand1),
AuraPower(LedPowerCommand2),
Aura(AuraCommand),
Brightness(BrightnessCommand),
Profile(ProfileCommand),
FanCurve(FanCurveCommand),
@@ -99,7 +97,7 @@ pub struct ProfileSetCommand {
}
#[derive(FromArgs, Debug, Default)]
#[argh(subcommand, name = "aura", description = "led mode commands")]
#[argh(subcommand, name = "effect", description = "led mode commands")]
pub struct LedModeCommand {
#[argh(switch, description = "switch to next aura mode")]
pub next_mode: bool,
@@ -111,6 +109,21 @@ pub struct LedModeCommand {
pub command: Option<SetAuraBuiltin>,
}
#[derive(FromArgs, Debug)]
#[argh(subcommand, name = "aura", description = "aura device commands")]
pub struct AuraCommand {
#[argh(subcommand)]
pub command: AuraSubCommand,
}
#[derive(FromArgs, Debug)]
#[argh(subcommand)]
pub enum AuraSubCommand {
Power(LedPowerCommand2),
PowerTuf(LedPowerCommand1),
Effect(LedModeCommand),
}
#[derive(FromArgs, Debug, Default)]
#[argh(
subcommand,

View File

@@ -186,9 +186,11 @@ fn do_parsed(
conn: Connection,
) -> Result<(), Box<dyn std::error::Error>> {
match &parsed.command {
CliCommand::Aura(mode) => handle_led_mode(mode)?,
CliCommand::AuraPowerOld(pow) => handle_led_power1(pow)?,
CliCommand::AuraPower(pow) => handle_led_power2(pow)?,
CliCommand::Aura(a) => match &a.command {
crate::cli_opts::AuraSubCommand::Effect(mode) => handle_led_mode(mode)?,
crate::cli_opts::AuraSubCommand::PowerTuf(pow) => handle_led_power1(pow)?,
crate::cli_opts::AuraSubCommand::Power(pow) => handle_led_power2(pow)?,
},
CliCommand::Brightness(cmd) => handle_brightness(cmd)?,
CliCommand::Profile(cmd) => handle_throttle_profile(&conn, supported_properties, cmd)?,
CliCommand::FanCurve(cmd) => handle_fan_curve(&conn, cmd)?,
@@ -720,7 +722,7 @@ fn handle_led_power1(power: &LedPowerCommand1) -> Result<(), Box<dyn std::error:
&& !power.keyboard
&& !power.lightbar
{
println!("Missing arg or command; run 'asusctl aura-power-old --help' for usage");
println!("Missing arg or command; run 'asusctl aura power-tuf --help' for usage");
return Ok(());
}
@@ -773,7 +775,7 @@ fn handle_led_power2(power: &LedPowerCommand2) -> Result<(), Box<dyn std::error:
}
if power.command.is_none() {
println!("Missing arg or command; run 'asusctl aura-power --help' for usage");
println!("Missing arg or command; run 'asusctl aura power --help' for usage");
println!("Commands available");
return Ok(());
}