Browse Source

Merge pull request #100 from cafkafk/cafkdev-compressed-files

feat(filetype): add compressed type
Christina Sørensen 2 years ago
parent
commit
36f83f7f5c
2 changed files with 37 additions and 21 deletions
  1. 32 18
      src/info/filetype.rs
  2. 5 3
      src/output/icons.rs

+ 32 - 18
src/info/filetype.rs

@@ -51,6 +51,7 @@ impl FileExtensions {
                     | "Gruntfile.coffee"
                     | "Gruntfile.js"
                     | "Justfile"
+                    | "justfile"
                     | "Makefile"
                     | "makefile"
                     | "Makefile.in"
@@ -107,6 +108,7 @@ impl FileExtensions {
             "pnm",
             "ppm",
             "ps",
+            "pxm",
             "raw",
             "stl",
             "svg",
@@ -200,31 +202,40 @@ impl FileExtensions {
 
     fn is_compressed(&self, file: &File<'_>) -> bool {
         file.extension_is_one_of( &[
-            "zip",
-            "tar",
-            "Z",
-            "z",
-            "gz",
-            "bz2",
+            "7z",
             "a",
             "ar",
-            "7z",
-            "iso",
+            "bz",
+            "bz2",
+            "bz3",
+            "cpio",
+            "deb",
             "dmg",
-            "tc",
-            "rar",
-            "par",
-            "tgz",
-            "xz",
-            "txz",
+            "gz",
+            "iso",
             "lz",
-            "tlz",
+            "lz4",
+            "lzh",
             "lzma",
-            "deb",
+            "lzo",
+            "par",
+            "rar",
             "rpm",
+            "tar",
+            "taz",
+            "tbz",
+            "tbz2",
+            "tc",
+            "tgz",
+            "tlz",
+            "txz",
+            "tz",
+            "tzo",
+            "xz",
+            "Z",
+            "z",
+            "zip",
             "zst",
-            "lz4",
-            "cpio",
         ])
     }
 
@@ -296,6 +307,9 @@ impl FileIcon for FileExtensions {
         else if self.is_video(file) {
             Some(Icons::Video.value())
         }
+        else if self.is_compressed(file) {
+            Some(Icons::Compressed.value())
+        }
         else {
             None
         }

+ 5 - 3
src/output/icons.rs

@@ -16,14 +16,16 @@ pub enum Icons {
     Audio,
     Image,
     Video,
+    Compressed,
 }
 
 impl Icons {
     pub fn value(self) -> char {
         match self {
-            Self::Audio  => '\u{f001}',
-            Self::Image  => '\u{f1c5}',
-            Self::Video  => '\u{f03d}',
+            Self::Audio  => '\u{f001}', // 
+            Self::Image  => '\u{f1c5}', // 
+            Self::Video  => '\u{f03d}', // 
+            Self::Compressed => '\u{f410}', // 
         }
     }
 }