use std::collections::HashSet;
use std::sync::LazyLock;
pub const DIRECTORY: &str = "directory";
pub const SYMLINK: &str = "symlink";
pub const SOCKET: &str = "socket";
pub const FILE: &str = "file";
pub const EXECUTABLE: &str = "executable";
pub const NON_EXECUTABLE: &str = "non-executable";
pub const TEXT: &str = "text";
pub const BINARY: &str = "binary";
pub type TagSet = HashSet<&'static str>;
#[inline]
pub fn tags_from_array(tags: &[&'static str]) -> TagSet {
tags.iter().copied().collect()
}
pub static TYPE_TAGS: LazyLock<TagSet> =
LazyLock::new(|| HashSet::from([DIRECTORY, FILE, SYMLINK, SOCKET]));
pub static MODE_TAGS: LazyLock<TagSet> =
LazyLock::new(|| HashSet::from([EXECUTABLE, NON_EXECUTABLE]));
pub static ENCODING_TAGS: LazyLock<TagSet> = LazyLock::new(|| HashSet::from([BINARY, TEXT]));
pub fn is_type_tag(tag: &str) -> bool {
matches!(tag, DIRECTORY | FILE | SYMLINK | SOCKET)
}
pub fn is_mode_tag(tag: &str) -> bool {
matches!(tag, EXECUTABLE | NON_EXECUTABLE)
}
pub fn is_encoding_tag(tag: &str) -> bool {
matches!(tag, BINARY | TEXT)
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum FileKind {
Regular,
Directory,
Symlink,
Socket,
}