From 118faab5339cdd02ef31a47057173a7cbe91534b Mon Sep 17 00:00:00 2001 From: Han Yeong-woo Date: Wed, 29 Mar 2023 20:29:08 +0900 Subject: [PATCH 1/5] Add icons for cjs, cts and mts --- CHANGELOG.md | 1 + src/theme/icon.rs | 3 +++ 2 files changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d0118bab..1707de9a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 on other platform the same as `--all` [#752](https://github.com/Peltoche/lsd/issues/752) - Add many icons from https://github.com/Peltoche/lsd/issues/764 [@TruncatedDinosour](https://ari-web.xyz/gh) - Add support for localization from [scarf](https://github.com/scarf005) +- Add icons for cjs, cts and mts from [Han Yeong-woo](https://github.com/nix6839) ### Fixed - Do not quote filename when piping into another program from [TeamTamoad](https://github.com/TeamTamoad) diff --git a/src/theme/icon.rs b/src/theme/icon.rs index 1c65b2127..4ecb182b0 100644 --- a/src/theme/icon.rs +++ b/src/theme/icon.rs @@ -317,6 +317,7 @@ impl IconTheme { ("bz2", "\u{f410}"), // "" ("cc", "\u{e61d}"), // "" ("cfg", "\u{e615}"), // "" + ("cjs", "\u{e74e}"), // "" ("class", "\u{e738}"), // "" ("cljs", "\u{e76a}"), // "" ("clj", "\u{e768}"), // "" @@ -333,6 +334,7 @@ impl IconTheme { ("cs", "\u{f81a}"), // "" ("csv", "\u{f1c3}"), // "" ("csx", "\u{f81a}"), // "" + ("cts", "\u{e628}"), // "" ("c++", "\u{e61d}"), // "" ("c", "\u{e61e}"), // "" ("cue", "\u{f001}"), // "" @@ -450,6 +452,7 @@ impl IconTheme { ("mp3", "\u{f001}"), // "" ("mp4", "\u{f008}"), // "" ("msi", "\u{f17a}"), // "" + ("mts", "\u{e628}"), // "" ("mustache", "\u{e60f}"), // "" ("nix", "\u{f313}"), // "" ("npmignore", "\u{e71e}"), // "" From 8c62e9ed12ccf7a737bd7fc24ccfb0b36cf7b7da Mon Sep 17 00:00:00 2001 From: Wei Zhang Date: Fri, 7 Apr 2023 00:14:08 +0800 Subject: [PATCH 2/5] :sparkles: chore: add new bug template Signed-off-by: Wei Zhang --- .github/ISSUE_TEMPLATE/bug.yml | 91 ++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug.yml diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml new file mode 100644 index 000000000..90215a993 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug.yml @@ -0,0 +1,91 @@ +name: Bug Report Form +description: Create a report to help us improve, by the new GitHub form +title: "[Bug]: " +labels: ["bug"] +assignees: + - zwpaper +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to fill out this bug report! + - type: checkboxes + id: latest-version + attributes: + label: Version + description: Please make sure you can reproduce in the [latest release](https://github.com/lsd-rs/lsd/releases/latest) + options: + - label: latest + required: true + - type: textarea + id: version + attributes: + label: version + description: "`lsd --version` output" + placeholder: lsd --version + validations: + required: true + - type: dropdown + id: os + attributes: + label: What OS are you seeing the problem on? + multiple: true + options: + - Windows + - Linux + - macOS + - Others + - type: textarea + id: installation + attributes: + label: installation + description: "how do you install lsd?" + placeholder: "how do you install lsd?" + validations: + required: true + - type: textarea + id: term + attributes: + label: term + description: "`echo $TERM` output" + placeholder: echo $TERM + validations: + required: false + - type: textarea + id: ls-colors + attributes: + label: ls-colors + description: "`echo $LS_COLORS` output" + placeholder: echo $LS_COLORS + validations: + required: false + - type: textarea + id: what-happened + attributes: + label: What happened? + description: Tell us what happen? + placeholder: | + If applicable, add the output of the classic ls command (`\ls -la`) in order to show the buggy file/directory. + render: markdown + validations: + required: true + - type: textarea + id: what-expected + attributes: + label: What expected? + description: What did you expect to happen? + placeholder: | + If the application panics run the command with the trace (`RUST_BACKTRACE=1 lsd ...`). + In case of graphical errors, add a screenshot if possible." + render: markdown + validations: + required: true + - type: textarea + id: others + attributes: + label: What else? + description: Is there anything else you want to tell us? + placeholder: "Others" + render: markdown + validations: + required: false From 5ecb868c19b82b635381d13c8601687d33d57d0d Mon Sep 17 00:00:00 2001 From: Han Yeong-woo Date: Sat, 22 Apr 2023 17:11:30 +0900 Subject: [PATCH 3/5] Fix obsolete Nerd Font icons (#830) --- CHANGELOG.md | 1 + README.md | 10 ++++- src/meta/name.rs | 2 +- src/theme/icon.rs | 102 +++++++++++++++++++++++----------------------- 4 files changed, 61 insertions(+), 54 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1707de9a0..607c6563f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Add many icons from https://github.com/Peltoche/lsd/issues/764 [@TruncatedDinosour](https://ari-web.xyz/gh) - Add support for localization from [scarf](https://github.com/scarf005) - Add icons for cjs, cts and mts from [Han Yeong-woo](https://github.com/nix6839) +- Fix obsolete Nerd Font icons from [Han Yeong-woo](https://github.com/nix6839) ### Fixed - Do not quote filename when piping into another program from [TeamTamoad](https://github.com/TeamTamoad) diff --git a/README.md b/README.md index cd6d1de30..7c21b7b3a 100644 --- a/README.md +++ b/README.md @@ -336,12 +336,12 @@ filetype: dir: 📂 file: 📄 pipe: 📩 - socket:  + socket: 󰆨 executable:  symlink-dir:  symlink-file:  device-char:  - device-block: ﰩ + device-block: 󰜫 special:  ``` @@ -429,6 +429,12 @@ lsd --icon never --ignore-config `lsd` will try to display the UTF-8 chars in file name, A `U+FFFD REPLACEMENT CHARACTER`(�) is used to represent the invalid UTF-8 chars. +### Icons are showing up strangely + +Nerd Fonts is moving the codepoints of the Material Design Icons in 3.0, so lsd has updated the icons in #830. If your icons look weird, use fonts that have been patched using Nerd Fonts v2.3.0 or later. + +See also: + ## Contributors Everyone can contribute to this project, improving the code or adding functions. If anyone wants something to be added we will try to do it. diff --git a/src/meta/name.rs b/src/meta/name.rs index 07cc4c7ae..53c044e2b 100644 --- a/src/meta/name.rs +++ b/src/meta/name.rs @@ -376,7 +376,7 @@ mod test { let name = Name::new(&pipe_path, file_type); assert_eq!( - " pipe.tmp".to_string().with(Color::AnsiValue(184)), + "󰈲 pipe.tmp".to_string().with(Color::AnsiValue(184)), name.render( &colors, icons, diff --git a/src/theme/icon.rs b/src/theme/icon.rs index 4ecb182b0..e955db39e 100644 --- a/src/theme/icon.rs +++ b/src/theme/icon.rs @@ -41,16 +41,16 @@ impl Default for IconTheme { impl Default for ByType { fn default() -> ByType { ByType { - dir: "\u{f115}".into(), //  - file: "\u{f016}".into(), //  - pipe: "\u{f731}".into(), //  - socket: "\u{f6a7}".into(), //  - executable: "\u{f489}".into(), //  - symlink_dir: "\u{f482}".into(), //  - symlink_file: "\u{f481}".into(), //  - device_char: "\u{e601}".into(), //  - device_block: "\u{fc29}".into(), // ﰩ - special: "\u{f2dc}".into(), //  + dir: "\u{f115}".into(), //  + file: "\u{f016}".into(), //  + pipe: "\u{f0232}".into(), // 󰈲 + socket: "\u{f01a8}".into(), // 󰆨 + executable: "\u{f489}".into(), //  + symlink_dir: "\u{f482}".into(), //  + symlink_file: "\u{f481}".into(), //  + device_char: "\u{e601}".into(), //  + device_block: "\u{f072b}".into(), // 󰜫 + special: "\u{f2dc}".into(), //  } } } @@ -86,10 +86,10 @@ impl IconTheme { // Note: filenames must be lower-case [ ("a.out", "\u{f489}"), // "" - ("api", "\u{f98c}"), // "歷" + ("api", "\u{f048d}"), // "󰒍" (".atom", "\u{e764}"), // "" ("authorized_keys", "\u{e60a}"), // "" - ("backups", "\u{f56e}"), // "" + ("backups", "\u{f006f}"), // "󰁯" (".bash_logout", "\u{e615}"), // "" (".bash_profile", "\u{e615}"), // "" (".bashrc", "\u{f489}"), // "" @@ -160,7 +160,7 @@ impl IconTheme { ("hidden", "\u{f023}"), // "" ("home", "\u{f015}"), // "" ("hostname", "\u{e615}"), // "" - ("hosts", "\u{f502}"), // "" + ("hosts", "\u{f0002}"), // "󰀂" (".htaccess", "\u{e615}"), // "" ("htoprc", "\u{e615}"), // "" (".htpasswd", "\u{e615}"), // "" @@ -185,15 +185,15 @@ impl IconTheme { ("localized", "\u{f179}"), // "" ("lsb-release", "\u{e615}"), // "" (".lynxrc", "\u{e615}"), // "" - (".mailcap", "\u{f6ef}"), // "" - ("mail", "\u{f6ef}"), // "" + (".mailcap", "\u{f01f0}"), // "󰇰" + ("mail", "\u{f01f0}"), // "󰇰" ("maintainers", "\u{e60a}"), // "" ("makefile.ac", "\u{e615}"), // "" ("makefile", "\u{e615}"), // "" ("manifest", "\u{f292}"), // "" ("metadata", "\u{e5fc}"), // "" ("metadata.xml", "\u{f462}"), // "" - ("mime.types", "\u{fb44}"), // "פּ" + ("mime.types", "\u{f0645}"), // "󰙅" ("module.symvers", "\u{f471}"), // "" (".mozilla", "\u{e786}"), // "" ("music", "\u{f025}"), // "" @@ -215,18 +215,18 @@ impl IconTheme { (".pki", "\u{f023}"), // "" ("portage", "\u{e5fc}"), // "" ("profile", "\u{e615}"), // "" - (".profile", "\u{f68c}"), // "" + (".profile", "\u{f018d}"), // "󰆍" ("public", "\u{f415}"), // "" - ("__pycache__", "\u{f81f}"), // "" + ("__pycache__", "\u{f0320}"), // "󰌠" (".python_history", "\u{e606}"), // "" ("rc.lua", "\u{e615}"), // "" ("readme", "\u{e609}"), // "" (".release.toml", "\u{e7a8}"), // "" - ("requirements.txt", "\u{f81f}"), // "" - ("robots.txt", "\u{fba7}"), // "ﮧ" + ("requirements.txt", "\u{f0320}"), // "󰌠" + ("robots.txt", "\u{f06a9}"), // "󰚩" ("root", "\u{f023}"), // "" ("rubydoc", "\u{e73b}"), // "" - ("runtime.txt", "\u{f81f}"), // "" + ("runtime.txt", "\u{f0320}"), // "󰌠" (".rustup", "\u{e7a8}"), // "" (".rvm", "\u{e21e}"), // "" ("sass", "\u{e603}"), // "" @@ -244,14 +244,14 @@ impl IconTheme { ("sudoers", "\u{f023}"), // "" ("sxhkdrc", "\u{e615}"), // "" ("tigrc", "\u{e615}"), // "" - ("tox.ini", "\u{f81f}"), // "" + ("tox.ini", "\u{f0320}"), // "󰌠" (".trash", "\u{f1f8}"), // "" ("ts", "\u{e628}"), // "" ("unlicense", "\u{e60a}"), // "" ("url", "\u{f0ac}"), // "" ("user-dirs.dirs", "\u{e5fc}"), // "" ("vagrantfile", "\u{e615}"), // "" - ("venv", "\u{f81f}"), // "" + ("venv", "\u{f0320}"), // "󰌠" ("videos", "\u{f03d}"), // "" (".viminfo", "\u{e62b}"), // "" (".vimrc", "\u{e62b}"), // "" @@ -259,7 +259,7 @@ impl IconTheme { (".vim", "\u{e62b}"), // "" ("vim", "\u{e62b}"), // "" (".vscode", "\u{e70c}"), // "" - ("webpack.config.js", "\u{fc29}"), // "ﰩ" + ("webpack.config.js", "\u{f072b}"), // "󰜫" (".wgetrc", "\u{e615}"), // "" ("wgetrc", "\u{e615}"), // "" (".xauthority", "\u{e615}"), // "" @@ -305,14 +305,14 @@ impl IconTheme { ("avi", "\u{f008}"), // "" ("avro", "\u{e60b}"), // "" ("awk", "\u{f489}"), // "" - ("bak", "\u{f56e}"), // "" + ("bak", "\u{f006f}"), // "󰁯" ("bash_history", "\u{f489}"), // "" ("bash_profile", "\u{f489}"), // "" ("bashrc", "\u{f489}"), // "" ("bash", "\u{f489}"), // "" ("bat", "\u{f17a}"), // "" ("bin", "\u{f489}"), // "" - ("bio", "\u{f910}"), // "蘿" + ("bio", "\u{f0411}"), // "󰐑" ("bmp", "\u{f1c5}"), // "" ("bz2", "\u{f410}"), // "" ("cc", "\u{e61d}"), // "" @@ -322,18 +322,18 @@ impl IconTheme { ("cljs", "\u{e76a}"), // "" ("clj", "\u{e768}"), // "" ("cls", "\u{e600}"), // "" - ("cl", "\u{f671}"), // "" + ("cl", "\u{f0172}"), // "󰅲" ("coffee", "\u{f0f4}"), // "" ("conf", "\u{e615}"), // "" ("cpp", "\u{e61d}"), // "" ("cp", "\u{e61d}"), // "" ("cshtml", "\u{f1fa}"), // "" ("csh", "\u{f489}"), // "" - ("csproj", "\u{f81a}"), // "" + ("csproj", "\u{f031b}"), // "󰌛" ("css", "\u{e749}"), // "" - ("cs", "\u{f81a}"), // "" + ("cs", "\u{f031b}"), // "󰌛" ("csv", "\u{f1c3}"), // "" - ("csx", "\u{f81a}"), // "" + ("csx", "\u{f031b}"), // "󰌛" ("cts", "\u{e628}"), // "" ("c++", "\u{e61d}"), // "" ("c", "\u{e61e}"), // "" @@ -356,10 +356,10 @@ impl IconTheme { ("eclass", "\u{f30d}"), // "" ("editorconfig", "\u{e615}"), // "" ("ejs", "\u{e618}"), // "" - ("elc", "\u{f671}"), // "" + ("elc", "\u{f0172}"), // "󰅲" ("elf", "\u{f489}"), // "" ("elm", "\u{e62c}"), // "" - ("el", "\u{f671}"), // "" + ("el", "\u{f0172}"), // "󰅲" ("env", "\u{f462}"), // "" ("eot", "\u{f031}"), // "" ("epub", "\u{e28a}"), // "" @@ -372,7 +372,7 @@ impl IconTheme { ("flac", "\u{f001}"), // "" ("flv", "\u{f008}"), // "" ("font", "\u{f031}"), // "" - ("fpl", "\u{f910}"), // "蘿" + ("fpl", "\u{f0411}"), // "󰐑" ("fsi", "\u{e7a7}"), // "" ("fs", "\u{e7a7}"), // "" ("fsx", "\u{e7a7}"), // "" @@ -427,7 +427,7 @@ impl IconTheme { ("less", "\u{e758}"), // "" ("lhs", "\u{e777}"), // "" ("license", "\u{e60a}"), // "" - ("lisp", "\u{f671}"), // "" + ("lisp", "\u{f0172}"), // "󰅲" ("list", "\u{f03a}"), // "" ("localized", "\u{f179}"), // "" ("lock", "\u{f023}"), // "" @@ -435,8 +435,8 @@ impl IconTheme { ("lss", "\u{e749}"), // "" ("lua", "\u{e620}"), // "" ("lz", "\u{f410}"), // "" - ("m3u8", "\u{f910}"), // "蘿" - ("m3u", "\u{f910}"), // "蘿" + ("m3u8", "\u{f0411}"), // "󰐑" + ("m3u", "\u{f0411}"), // "󰐑" ("m4a", "\u{f001}"), // "" ("m4v", "\u{f008}"), // "" ("magnet", "\u{f076}"), // "" @@ -458,18 +458,18 @@ impl IconTheme { ("npmignore", "\u{e71e}"), // "" ("ogg", "\u{f001}"), // "" ("ogv", "\u{f008}"), // "" - ("old", "\u{f56e}"), // "" + ("old", "\u{f006f}"), // "󰁯" ("opus", "\u{f001}"), // "" - ("orig", "\u{f56e}"), // "" + ("orig", "\u{f006f}"), // "󰁯" ("otf", "\u{f031}"), // "" ("o", "\u{e624}"), // "" ("pdf", "\u{f1c1}"), // "" - ("pem", "\u{f805}"), // "" + ("pem", "\u{f0306}"), // "󰌆" ("phar", "\u{e608}"), // "" ("php", "\u{e608}"), // "" ("pkg", "\u{f187}"), // "" ("plist", "\u{f302}"), // "" - ("pls", "\u{f910}"), // "蘿" + ("pls", "\u{f0411}"), // "󰐑" ("pl", "\u{e769}"), // "" ("pm", "\u{e769}"), // "" ("png", "\u{f1c5}"), // "" @@ -487,16 +487,16 @@ impl IconTheme { ("rar", "\u{f410}"), // "" ("razor", "\u{f1fa}"), // "" ("rb", "\u{e21e}"), // "" - ("rdata", "\u{fcd2}"), // "ﳒ" + ("rdata", "\u{f07d4}"), // "󰟔" ("rdb", "\u{e76d}"), // "" ("rdoc", "\u{e609}"), // "" - ("rds", "\u{fcd2}"), // "ﳒ" + ("rds", "\u{f07d4}"), // "󰟔" ("readme", "\u{e609}"), // "" ("rlib", "\u{e7a8}"), // "" ("rl", "\u{f11c}"), // "" ("rmd", "\u{e609}"), // "" ("rpm", "\u{f187}"), // "" - ("rproj", "\u{fac5}"), // "鉶" + ("rproj", "\u{f05c6}"), // "󰗆" ("rspec_parallel", "\u{e21e}"), // "" ("rspec_status", "\u{e21e}"), // "" ("rspec", "\u{e21e}"), // "" @@ -504,7 +504,7 @@ impl IconTheme { ("rs", "\u{e7a8}"), // "" ("rtf", "\u{f15c}"), // "" ("rubydoc", "\u{e73b}"), // "" - ("r", "\u{fcd2}"), // "ﳒ" + ("r", "\u{f07d4}"), // "󰟔" ("ru", "\u{e21e}"), // "" ("sass", "\u{e603}"), // "" ("scala", "\u{e737}"), // "" @@ -534,7 +534,7 @@ impl IconTheme { ("tgz", "\u{f410}"), // "" ("tiff", "\u{f1c5}"), // "" ("toml", "\u{e60b}"), // "" - ("torrent", "\u{f98c}"), // "歷" + ("torrent", "\u{f048d}"), // "󰒍" ("trash", "\u{f1f8}"), // "" ("ts", "\u{e628}"), // "" ("tsx", "\u{e7ba}"), // "" @@ -545,8 +545,8 @@ impl IconTheme { ("txt", "\u{f15c}"), // "" ("video", "\u{f008}"), // "" ("vim", "\u{e62b}"), // "" - ("vlc", "\u{f910}"), // "蘿" - ("vue", "\u{fd42}"), // "﵂" + ("vlc", "\u{f0411}"), // "󰐑" + ("vue", "\u{f0844}"), // "󰡄" ("wav", "\u{f001}"), // "" ("webm", "\u{f008}"), // "" ("webp", "\u{f1c5}"), // "" @@ -555,7 +555,7 @@ impl IconTheme { ("wmv", "\u{f008}"), // "" ("woff2", "\u{f031}"), // "" ("woff", "\u{f031}"), // "" - ("wpl", "\u{f910}"), // "蘿" + ("wpl", "\u{f0411}"), // "󰐑" ("xbps", "\u{f187}"), // "" ("xcf", "\u{f1c5}"), // "" ("xls", "\u{f1c3}"), // "" @@ -596,13 +596,13 @@ extension: filetype: dir:  file:  - pipe:  - socket:  + pipe: 󰈲 + socket: 󰆨 executable:  symlink-dir:  symlink-file:  device-char:  - device-block: ﰩ + device-block: 󰜫 special:  "# } From ff3e48e20b53583e880a9b8e4893ff0b503a9abe Mon Sep 17 00:00:00 2001 From: Mikihiro SUDA Date: Sat, 22 Apr 2023 23:14:49 +0900 Subject: [PATCH 4/5] Icon theme with overrides from config (#792) --- CHANGELOG.md | 1 + src/theme/icon.rs | 68 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 607c6563f..9e2e0b444 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 [`LS_COLORS`](README.md#Colors) can be used to customize. - Handle dereference (-L) with broken symlink from [r3dArch](https://github.com/r3dArch) - Avoid using Clap's deprecated structs and functions [sudame](https://github.com/sudame) +- Icon theme with overrides from config [sudame](https://github.com/sudame) ## [0.23.1] - 2022-09-13 diff --git a/src/theme/icon.rs b/src/theme/icon.rs index e955db39e..ebd6a93ad 100644 --- a/src/theme/icon.rs +++ b/src/theme/icon.rs @@ -1,12 +1,48 @@ use serde::Deserialize; use std::collections::HashMap; +enum ByFilename { + Name, + Extension, +} + +fn deserialize_by_filename<'de, D>( + deserializer: D, + by: ByFilename, +) -> Result, D::Error> +where + D: serde::de::Deserializer<'de>, +{ + let default = match by { + ByFilename::Name => IconTheme::get_default_icons_by_name(), + ByFilename::Extension => IconTheme::get_default_icons_by_extension(), + }; + HashMap::<_, _>::deserialize(deserializer) + .map(|input| default.into_iter().chain(input.into_iter()).collect()) +} + +fn deserialize_by_name<'de, D>(deserializer: D) -> Result, D::Error> +where + D: serde::de::Deserializer<'de>, +{ + deserialize_by_filename(deserializer, ByFilename::Name) +} + +fn deserialize_by_extension<'de, D>(deserializer: D) -> Result, D::Error> +where + D: serde::de::Deserializer<'de>, +{ + deserialize_by_filename(deserializer, ByFilename::Extension) +} + #[derive(Debug, Deserialize, PartialEq, Eq)] #[serde(rename_all = "kebab-case")] #[serde(deny_unknown_fields)] #[serde(default)] pub struct IconTheme { + #[serde(deserialize_with = "deserialize_by_name")] pub name: HashMap, + #[serde(deserialize_with = "deserialize_by_extension")] pub extension: HashMap, pub filetype: ByType, } @@ -656,4 +692,36 @@ filetype: let empty: IconTheme = Theme::with_yaml("filetype:\n dir: ").unwrap(); assert_eq!(empty.filetype.dir, ""); } + + #[test] + fn test_custom_icon_by_name() { + // When a user sets to use 📦-icon for a cargo.toml file, + let theme: IconTheme = Theme::with_yaml("name:\n cargo.toml: 📦").unwrap(); + // 📦-icon should be used for a cargo.toml file. + assert_eq!(theme.name.get("cargo.toml").unwrap(), "📦"); + } + + #[test] + fn test_default_icon_by_name_with_custom_entry() { + // When a user sets to use 📦-icon for a cargo.toml file, + let theme: IconTheme = Theme::with_yaml("name:\n cargo.toml: 📦").unwrap(); + // the default icon  should be used for a cargo.lock file. + assert_eq!(theme.name.get("cargo.lock").unwrap(), "\u{e7a8}"); + } + + #[test] + fn test_custom_icon_by_extension() { + // When a user sets to use 🦀-icon for *.rs files, + let theme: IconTheme = Theme::with_yaml("extension:\n rs: 🦀").unwrap(); + // 🦀-icon should be used for *.rs files. + assert_eq!(theme.extension.get("rs").unwrap(), "🦀"); + } + + #[test] + fn test_default_icon_by_extension_with_custom_entry() { + // When a user sets to use 🦀-icon for *.rs files, + let theme: IconTheme = Theme::with_yaml("extension:\n rs: 🦀").unwrap(); + // the default icon  should be used for *.go files. + assert_eq!(theme.extension.get("go").unwrap(), "\u{e627}"); + } } From 7b18d527927c4d5d946f79eb15ef3bd4c6cc2c20 Mon Sep 17 00:00:00 2001 From: Craig O'Connor <5249140+CraigglesO@users.noreply.github.com> Date: Sun, 23 Apr 2023 22:25:56 -0400 Subject: [PATCH 5/5] Update icon.rs add zig extension icon --- src/theme/icon.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/theme/icon.rs b/src/theme/icon.rs index ebd6a93ad..ed48cac68 100644 --- a/src/theme/icon.rs +++ b/src/theme/icon.rs @@ -602,6 +602,7 @@ impl IconTheme { ("yaml", "\u{e60b}"), // "" ("yml", "\u{e60b}"), // "" ("zip", "\u{f410}"), // "" + ("zig", "\u{e6a9}"), // "" ("zshrc", "\u{f489}"), // "" ("zsh-theme", "\u{f489}"), // "" ("zsh", "\u{f489}"), // ""