add cg ls, prepare for rc subcommands

This commit is contained in:
Mikaël Cluseau
2026-04-12 19:55:56 +02:00
parent 0f116e21b9
commit 33fcfbd197
8 changed files with 535 additions and 4 deletions

View File

@@ -3,6 +3,7 @@ use eyre::{format_err, Result};
use human_units::Duration;
use log::{debug, error};
use std::net::SocketAddr;
use std::path::PathBuf;
use tokio::fs;
#[derive(Parser)]
@@ -81,6 +82,21 @@ enum Command {
#[arg(long, default_value = "5s")]
timeout: Duration,
},
Cg {
#[command(subcommand)]
cmd: CgCmd,
},
}
#[derive(Subcommand)]
enum CgCmd {
Ls {
#[arg(long)]
root: Option<PathBuf>,
#[arg(long, short = 'X')]
exclude: Vec<String>,
},
}
#[tokio::main(flavor = "current_thread")]
@@ -157,6 +173,10 @@ async fn main() -> Result<()> {
.run()
.await
.map(|_| ())?),
C::Cg { cmd } => match cmd {
CgCmd::Ls { root, exclude } => Ok(dkl::cgroup::ls(root, &exclude).await?),
},
}
}