7525b1d533b927bc40e3cfb29e399e5f2e0828d4

Author
Marc Cornellà <marc.cornella@live.com>
Committer
Marc Cornellà <marc.cornella@live.com>
Date

Message

lib: allow bare output in theme and plugins list command

Diff

 1diff --git a/lib/cli.zsh b/lib/cli.zsh
 2index 9421fd19a93a516eccc060829ea648132ba5d85c..82a2a398548f2c0bbbd2bf1e824d475febba1e6c 100644
 3--- a/lib/cli.zsh
 4+++ b/lib/cli.zsh
 5@@ -135,6 +135,12 @@ function _omz::plugin::list {
 6     custom_plugins=("$ZSH_CUSTOM"/plugins/*(/N:t))
 7     builtin_plugins=("$ZSH"/plugins/*(/N:t))
 8 
 9+    # If the command is being piped, print all found line by line
10+    if [[ ! -t 1 ]]; then
11+        print -l ${(q-)custom_plugins} ${(q-)builtin_plugins}
12+        return
13+    fi
14+
15     if (( ${#custom_plugins} )); then
16         print -P "%U%BCustom plugins%b%u:"
17         print -l ${(q-)custom_plugins} | column
18@@ -305,6 +311,12 @@ function _omz::theme::list {
19     custom_themes=("$ZSH_CUSTOM"/**/*.zsh-theme(.N:r:gs:"$ZSH_CUSTOM"/themes/:::gs:"$ZSH_CUSTOM"/:::))
20     builtin_themes=("$ZSH"/themes/*.zsh-theme(.N:t:r))
21 
22+    # If the command is being piped, print all found line by line
23+    if [[ ! -t 1 ]]; then
24+        print -l ${(q-)custom_themes} ${(q-)builtin_themes}
25+        return
26+    fi
27+
28     if (( ${#custom_themes} )); then
29         print -P "%U%BCustom themes%b%u:"
30         print -l ${(q-)custom_themes} | column