This commit is contained in:
nora 2024-09-15 21:49:33 +02:00
parent f0ffa77500
commit e82f2076b8
10 changed files with 329 additions and 5 deletions

View file

@ -6,3 +6,4 @@ edition = "2021"
[dependencies]
clap = { version = "4.5.17", features = ["derive"] }
eyre.workspace = true
rustix = { version = "0.38.37", features = ["process"] }

26
coreutils/src/bin/user.rs Normal file
View file

@ -0,0 +1,26 @@
use clap::Parser;
use eyre::Result;
#[derive(Parser)]
struct Cmd {
#[command(subcommand)]
cmd: Subcommand,
}
#[derive(clap::Subcommand)]
enum Subcommand {
/// Get the current user's uid
Id,
}
fn main() -> Result<()> {
let args = Cmd::parse();
match args.cmd {
Subcommand::Id => {
println!("{}", rustix::process::getuid().as_raw());
}
}
Ok(())
}