Add --color option for some builtins

Fixes #9716

Closes #12252
This commit is contained in:
phanium
2026-01-01 23:39:37 +08:00
committed by Johannes Altmanninger
parent 5d8f7801f7
commit c23a4cbd9f
32 changed files with 301 additions and 75 deletions

View File

@@ -234,3 +234,21 @@ functions --all=arg
# CHECKERR: functions: --all=arg: option does not take an argument
echo $status
# CHECK: 2
# Test --color option
function test_color_option
echo hello
end
functions --color=invalid
# CHECKERR: functions: Invalid value for '--color' option: 'invalid'. Expected 'always', 'never', or 'auto'
functions --no-details --color=never test_color_option
# CHECK: function test_color_option
# CHECK: echo hello
# CHECK: end
string escape (functions --no-details --color=always test_color_option)
# CHECK: function\ \e\[36mtest_color_option\e\[32m
# CHECK: \e\[m\ \ \ \ echo\ \e\[36mhello\e\[32m
# CHECK: \e\[mend\e\[32m\e\[m