Improve permissions descriptions
This commit is contained in:
parent
b9b909c628
commit
17b0c665e7
2 changed files with 31 additions and 9 deletions
|
|
@ -104,9 +104,22 @@ open-with = Open with
|
||||||
owner = Owner
|
owner = Owner
|
||||||
group = Group
|
group = Group
|
||||||
other = Other
|
other = Other
|
||||||
read = Read
|
### Mode 0
|
||||||
write = Write
|
none = None
|
||||||
execute = Execute
|
### Mode 1 (unusual)
|
||||||
|
execute-only = Execute-only
|
||||||
|
### Mode 2 (unusual)
|
||||||
|
write-only = Write-only
|
||||||
|
### Mode 3 (unusual)
|
||||||
|
write-execute = Write and execute
|
||||||
|
### Mode 4
|
||||||
|
read-only = Read-only
|
||||||
|
### Mode 5
|
||||||
|
read-execute = Read and execute
|
||||||
|
### Mode 6
|
||||||
|
read-write = Read and write
|
||||||
|
### Mode 7
|
||||||
|
read-write-execute = Read, write, and execute
|
||||||
|
|
||||||
# Context Pages
|
# Context Pages
|
||||||
|
|
||||||
|
|
|
||||||
21
src/tab.rs
21
src/tab.rs
|
|
@ -343,30 +343,39 @@ fn format_permissions_owner(metadata: &Metadata, owner: PermissionOwner) -> Stri
|
||||||
}
|
}
|
||||||
|
|
||||||
fn format_permissions(metadata: &Metadata, owner: PermissionOwner) -> String {
|
fn format_permissions(metadata: &Metadata, owner: PermissionOwner) -> String {
|
||||||
let mut perms: Vec<String> = Vec::new();
|
let mut mode = 0;
|
||||||
if match owner {
|
if match owner {
|
||||||
PermissionOwner::Owner => metadata.permissions().readable_by_owner(),
|
PermissionOwner::Owner => metadata.permissions().readable_by_owner(),
|
||||||
PermissionOwner::Group => metadata.permissions().readable_by_group(),
|
PermissionOwner::Group => metadata.permissions().readable_by_group(),
|
||||||
PermissionOwner::Other => metadata.permissions().readable_by_other(),
|
PermissionOwner::Other => metadata.permissions().readable_by_other(),
|
||||||
} {
|
} {
|
||||||
perms.push(fl!("read"));
|
mode |= 4;
|
||||||
}
|
}
|
||||||
if match owner {
|
if match owner {
|
||||||
PermissionOwner::Owner => metadata.permissions().writable_by_owner(),
|
PermissionOwner::Owner => metadata.permissions().writable_by_owner(),
|
||||||
PermissionOwner::Group => metadata.permissions().writable_by_group(),
|
PermissionOwner::Group => metadata.permissions().writable_by_group(),
|
||||||
PermissionOwner::Other => metadata.permissions().writable_by_other(),
|
PermissionOwner::Other => metadata.permissions().writable_by_other(),
|
||||||
} {
|
} {
|
||||||
perms.push(fl!("write"));
|
mode |= 2;
|
||||||
}
|
}
|
||||||
if match owner {
|
if match owner {
|
||||||
PermissionOwner::Owner => metadata.permissions().executable_by_owner(),
|
PermissionOwner::Owner => metadata.permissions().executable_by_owner(),
|
||||||
PermissionOwner::Group => metadata.permissions().executable_by_group(),
|
PermissionOwner::Group => metadata.permissions().executable_by_group(),
|
||||||
PermissionOwner::Other => metadata.permissions().executable_by_other(),
|
PermissionOwner::Other => metadata.permissions().executable_by_other(),
|
||||||
} {
|
} {
|
||||||
perms.push(fl!("execute"));
|
mode |= 1;
|
||||||
|
}
|
||||||
|
match mode {
|
||||||
|
0 => fl!("none"),
|
||||||
|
1 => fl!("execute-only"),
|
||||||
|
2 => fl!("write-only"),
|
||||||
|
3 => fl!("write-execute"),
|
||||||
|
4 => fl!("read-only"),
|
||||||
|
5 => fl!("read-execute"),
|
||||||
|
6 => fl!("read-write"),
|
||||||
|
7 => fl!("read-write-execute"),
|
||||||
|
_ => unreachable!(),
|
||||||
}
|
}
|
||||||
|
|
||||||
perms.join(" ")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct FormatTime(SystemTime);
|
struct FormatTime(SystemTime);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue