1
Fork 0
mirror of https://github.com/RGBCube/superfreq synced 2025-07-29 01:47:44 +00:00

xtask: add completion generation

This commit is contained in:
RGBCube 2025-06-14 23:19:54 +03:00
parent a341d08c45
commit 0e07241280
Signed by: RGBCube
SSH key fingerprint: SHA256:CzqbPcfwt+GxFYNnFVCqoN5Itn4YFrshg1TrnACpA5M
6 changed files with 147 additions and 17 deletions

View file

@ -27,9 +27,8 @@ pub enum Command {
#[command(flatten)]
verbosity: clap_verbosity_flag::Verbosity,
/// The daemon config path.
#[arg(long, env = "WATT_CONFIG")]
config: Option<PathBuf>,
#[clap(flatten)]
command: WattCommand,
},
/// CPU metadata and modification utility.
@ -51,6 +50,13 @@ pub enum Command {
},
}
#[derive(clap::Parser, Debug)]
pub struct WattCommand {
/// The daemon config path.
#[arg(long, env = "WATT_CONFIG")]
config: Option<PathBuf>,
}
#[derive(clap::Parser, Debug)]
pub enum CpuCommand {
/// Modify CPU attributes.
@ -79,7 +85,10 @@ pub fn main() -> anyhow::Result<()> {
.init();
match cli.command {
Command::Watt { config, .. } => {
Command::Watt {
command: WattCommand { config },
..
} => {
let config = config::DaemonConfig::load_from(config.as_deref())
.context("failed to load daemon config")?;