982d010be5fdb1cff471978634f8ff374deba9ba
- Author
- Marc Cornellà <marc.cornella@live.com>
- Committer
- Marc Cornellà <marc.cornella@live.com>
- Date
Message
lib: fix fmt removing ESC characters in theme and plugin list CLI commands
Diff
1diff --git a/lib/cli.zsh b/lib/cli.zsh
2index 5d6c31aef6c65d125448c2337e198f3bddbb3330..c9ee159bc561d57dfdbf4b58b40aa8ccef00a549 100644
3--- a/lib/cli.zsh
4+++ b/lib/cli.zsh
5@@ -134,18 +134,20 @@ function _omz::plugin::list {
6 custom_plugins=("$ZSH_CUSTOM"/plugins/*(/N:t))
7 builtin_plugins=("$ZSH"/plugins/*(/N:t))
8
9- (( ${#custom_plugins} )) && {
10- print -Pn "%U%BCustom plugins%b%u: "
11- print -l ${(q-)custom_plugins}
12- } | fmt -w $COLUMNS
13-
14- (( ${#builtin_plugins} )) && {
15- # add a line of separation
16- (( ${#custom_plugins} )) && echo
17-
18- print -Pn "%U%BBuilt-in plugins%b%u: "
19- print -l ${(q-)builtin_plugins}
20- } | fmt -w $COLUMNS
21+ {
22+ (( ${#custom_plugins} )) && {
23+ print -Pn "%U%BCustom plugins%b%u: "
24+ print -l ${(q-)custom_plugins}
25+ }
26+
27+ (( ${#builtin_plugins} )) && {
28+ # add a line of separation
29+ (( ${#custom_plugins} )) && echo
30+
31+ print -Pn "%U%BBuilt-in plugins%b%u: "
32+ print -l ${(q-)builtin_plugins}
33+ }
34+ } | fmt -w $COLUMNS | sed -E $'s/\e?(\\[[0-9]*m)/\e\\1/g' # deal with fmt removing ESC
35 }
36
37 function _omz::pr {
38@@ -305,18 +307,20 @@ function _omz::theme::list {
39 custom_themes=("$ZSH_CUSTOM"/**/*.zsh-theme(.N:r:gs:"$ZSH_CUSTOM"/themes/:::gs:"$ZSH_CUSTOM"/:::))
40 builtin_themes=("$ZSH"/themes/*.zsh-theme(.N:t:r))
41
42- (( ${#custom_themes} )) && {
43- print -Pn "%U%BCustom themes%b%u: "
44- print -l ${(q-)custom_themes}
45- } | fmt -w $COLUMNS
46+ {
47+ (( ${#custom_themes} )) && {
48+ print -Pn "%U%BCustom themes%b%u: "
49+ print -l ${(q-)custom_themes}
50+ }
51
52- (( ${#builtin_themes} )) && {
53- # add a line of separation
54- (( ${#custom_themes} )) && echo
55+ (( ${#builtin_themes} )) && {
56+ # add a line of separation
57+ (( ${#custom_themes} )) && echo
58
59- print -Pn "%U%BBuilt-in themes%b%u: "
60- print -l ${(q-)builtin_themes}
61- } | fmt -w $COLUMNS
62+ print -Pn "%U%BBuilt-in themes%b%u: "
63+ print -l ${(q-)builtin_themes}
64+ }
65+ } | fmt -w $COLUMNS | sed -E $'s/\e?(\\[[0-9]*m)/\e\\1/g' # deal with fmt removing ESC
66 }
67
68 function _omz::theme::use {