How to parse chmod values with Clap
⚓ Rust 📅 2025-07-04 👤 surdeus 👁️ 19I have construction like that:
#[cfg(any(target_os = "linux", target_os = "macos"))]
{
use std::{fs::Permissions, os::unix::fs::PermissionsExt};
fs::set_permissions(target, Permissions::from_mode(0o644))?;
}
How can I parse 0o644 value from the clap argument properly?
Not sure I should use u32 data type like that:
#[arg(long, default_value_t = 0o644)]
pub chmod: u32,
3 posts - 3 participants
🏷️ rust_feed