diff --git a/src/chmod/mod.rs b/src/chmod/mod.rs deleted file mode 100644 index 1af9b14..0000000 --- a/src/chmod/mod.rs +++ /dev/null @@ -1 +0,0 @@ -//! Functions for parsing and managing permissions diff --git a/src/lib.rs b/src/lib.rs index 3acdb72..a21defb 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,10 +1,10 @@ #![warn(clippy::all, clippy::pedantic)] use std::{env, path::PathBuf, process, string::ToString}; -pub mod chmod; mod cmd; pub use cmd::Cmd; pub mod math; +pub mod mode; pub mod pw; /// Defines the location relative to the binary where a command will be installed diff --git a/src/mode/mod.rs b/src/mode/mod.rs new file mode 100644 index 0000000..0215d18 --- /dev/null +++ b/src/mode/mod.rs @@ -0,0 +1,38 @@ +//! Functions for parsing and managing permissions + +#[derive(Debug, PartialEq)] +pub enum Bits { + Suid = 0o4000, + Sgid = 0o2000, + Sticky = 0o1000, + URead = 0o400, + UWrite = 0o200, + UExec = 0o100, + GRead = 0o40, + GWrite = 0o20, + GExec = 0o10, + ORead = 0o4, + OWrite = 0o2, + OExec = 0o1, +} + +#[derive(Debug, PartialEq)] +pub enum Op { + Add, + Remove, + Equals, +} + +#[derive(Debug, PartialEq)] +pub enum Who { + User, + Group, + Other, + All, +} + +pub struct Parser { + mode: u32, + op: Op, + who: Who, +}