From 4f422c1a3a49f91722ee320f1c070dd3492fe593 Mon Sep 17 00:00:00 2001 From: Simone Ragusa Date: Sat, 21 Sep 2024 15:59:34 +0200 Subject: [PATCH 1/4] uucore: add alacritty to the list of terminals that support colors Any value of TERM with glob pattern `alacritty*` will be matched. Fixes #6722 --- src/uucore/src/lib/features/colors.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/uucore/src/lib/features/colors.rs b/src/uucore/src/lib/features/colors.rs index f05739431..f8cbc9ebf 100644 --- a/src/uucore/src/lib/features/colors.rs +++ b/src/uucore/src/lib/features/colors.rs @@ -13,6 +13,7 @@ /// restrict following config to systems with matching environment variables. pub static TERMS: &[&str] = &[ "Eterm", + "alacritty*", "ansi", "*color*", "con[0-9]*x[0-9]*", From f0b7d322d1e29e088708d959ee412b7781630184 Mon Sep 17 00:00:00 2001 From: Simone Ragusa Date: Sat, 21 Sep 2024 22:08:46 +0200 Subject: [PATCH 2/4] dircolors: patch test fixture to include alacritty support --- src/uu/dircolors/README.md | 8 +++++++- src/uu/dircolors/alacritty-supports-colors.patch | 12 ++++++++++++ tests/fixtures/dircolors/internal.expected | 1 + 3 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 src/uu/dircolors/alacritty-supports-colors.patch diff --git a/src/uu/dircolors/README.md b/src/uu/dircolors/README.md index ce8aa965f..f4ec5d675 100644 --- a/src/uu/dircolors/README.md +++ b/src/uu/dircolors/README.md @@ -9,10 +9,16 @@ dircolors -b > /PATH_TO_COREUTILS/tests/fixtures/dircolors/bash_def.expected dircolors -c > /PATH_TO_COREUTILS/tests/fixtures/dircolors/csh_def.expected ``` +Apply the patches to include more terminals that support colors: + +```shell +git apply /PATH_TO_COREUTILS/src/uu/dircolors/alacritty-supports-colors.patch +``` + Run the tests: ```shell cargo test --features "dircolors" --no-default-features ``` -Edit `/PATH_TO_COREUTILS/src/uu/dircolors/src/colors.rs` until the tests pass. +Edit `/PATH_TO_COREUTILS/src/uu/dircolors/src/dircolors.rs` until the tests pass. diff --git a/src/uu/dircolors/alacritty-supports-colors.patch b/src/uu/dircolors/alacritty-supports-colors.patch new file mode 100644 index 000000000..c6f022423 --- /dev/null +++ b/src/uu/dircolors/alacritty-supports-colors.patch @@ -0,0 +1,12 @@ +diff --git a/tests/fixtures/dircolors/internal.expected b/tests/fixtures/dircolors/internal.expected +index e151973f2..01dae4273 100644 +--- a/tests/fixtures/dircolors/internal.expected ++++ b/tests/fixtures/dircolors/internal.expected +@@ -7,6 +7,7 @@ + # restrict following config to systems with matching environment variables. + COLORTERM ?* + TERM Eterm ++TERM alacritty* + TERM ansi + TERM *color* + TERM con[0-9]*x[0-9]* diff --git a/tests/fixtures/dircolors/internal.expected b/tests/fixtures/dircolors/internal.expected index e151973f2..01dae4273 100644 --- a/tests/fixtures/dircolors/internal.expected +++ b/tests/fixtures/dircolors/internal.expected @@ -7,6 +7,7 @@ # restrict following config to systems with matching environment variables. COLORTERM ?* TERM Eterm +TERM alacritty* TERM ansi TERM *color* TERM con[0-9]*x[0-9]* From de775caa9c2b7882f12401e8028b3cba7ab7a682 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Wed, 4 Dec 2024 13:23:03 +0100 Subject: [PATCH 3/4] alacritty: remove unused patch --- src/uu/dircolors/README.md | 6 ------ src/uu/dircolors/alacritty-supports-colors.patch | 12 ------------ 2 files changed, 18 deletions(-) delete mode 100644 src/uu/dircolors/alacritty-supports-colors.patch diff --git a/src/uu/dircolors/README.md b/src/uu/dircolors/README.md index f4ec5d675..62944d490 100644 --- a/src/uu/dircolors/README.md +++ b/src/uu/dircolors/README.md @@ -9,12 +9,6 @@ dircolors -b > /PATH_TO_COREUTILS/tests/fixtures/dircolors/bash_def.expected dircolors -c > /PATH_TO_COREUTILS/tests/fixtures/dircolors/csh_def.expected ``` -Apply the patches to include more terminals that support colors: - -```shell -git apply /PATH_TO_COREUTILS/src/uu/dircolors/alacritty-supports-colors.patch -``` - Run the tests: ```shell diff --git a/src/uu/dircolors/alacritty-supports-colors.patch b/src/uu/dircolors/alacritty-supports-colors.patch deleted file mode 100644 index c6f022423..000000000 --- a/src/uu/dircolors/alacritty-supports-colors.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/tests/fixtures/dircolors/internal.expected b/tests/fixtures/dircolors/internal.expected -index e151973f2..01dae4273 100644 ---- a/tests/fixtures/dircolors/internal.expected -+++ b/tests/fixtures/dircolors/internal.expected -@@ -7,6 +7,7 @@ - # restrict following config to systems with matching environment variables. - COLORTERM ?* - TERM Eterm -+TERM alacritty* - TERM ansi - TERM *color* - TERM con[0-9]*x[0-9]* From a6447241375976d9d7477de21eabe47461babbff Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Wed, 4 Dec 2024 13:25:24 +0100 Subject: [PATCH 4/4] uucore: add foot to the list of terminals that support colors --- src/uucore/src/lib/features/colors.rs | 1 + tests/fixtures/dircolors/internal.expected | 1 + 2 files changed, 2 insertions(+) diff --git a/src/uucore/src/lib/features/colors.rs b/src/uucore/src/lib/features/colors.rs index f8cbc9ebf..885ae2fe9 100644 --- a/src/uucore/src/lib/features/colors.rs +++ b/src/uucore/src/lib/features/colors.rs @@ -22,6 +22,7 @@ pub static TERMS: &[&str] = &[ "cygwin", "*direct*", "dtterm", + "foot", "gnome", "hurd", "jfbterm", diff --git a/tests/fixtures/dircolors/internal.expected b/tests/fixtures/dircolors/internal.expected index 01dae4273..feea46455 100644 --- a/tests/fixtures/dircolors/internal.expected +++ b/tests/fixtures/dircolors/internal.expected @@ -16,6 +16,7 @@ TERM console TERM cygwin TERM *direct* TERM dtterm +TERM foot TERM gnome TERM hurd TERM jfbterm