Moved chmod module to mode; Added some types to mode

This commit is contained in:
Nathan Fisher 2023-01-15 01:13:18 -05:00
parent c6e162ebc8
commit 68a4c08fe9
3 changed files with 39 additions and 2 deletions

View File

@ -1 +0,0 @@
//! Functions for parsing and managing permissions

View File

@ -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

38
src/mode/mod.rs Normal file
View File

@ -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,
}