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