aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaho Lurie-Gregg <paho@paholg.com>2020-09-06 02:16:34 -0700
committerGitHub <noreply@github.com>2020-09-06 11:16:34 +0200
commit1a6d6b8acee1537e6cf48dbc5b32dacba06e8ef3 (patch)
tree77ed37b17eb052120a7109f9ef3b356056005750
parentf14662089757959e726ad2713c9420784cb71911 (diff)
zplug: Reduce noise (#1441)
Running `zplug install` will always product output, even if there is nothing to do. Gating it behind a `zplug check` eliminates that output when there is nothing to do, and is recommended in the zplug README.
-rw-r--r--modules/programs/zplug.nix7
-rw-r--r--tests/modules/programs/zplug/modules.nix6
2 files changed, 9 insertions, 4 deletions
diff --git a/modules/programs/zplug.nix b/modules/programs/zplug.nix
index 0df395292a7..6cb5e98e313 100644
--- a/modules/programs/zplug.nix
+++ b/modules/programs/zplug.nix
@@ -45,11 +45,14 @@ in {
optionalString (plugin.tags != [ ]) ''
${concatStrings (map (tag: ", ${tag}") plugin.tags)}
''
- }
+ }
'') cfg.plugins)}
''}
- zplug install
+ if ! zplug check; then
+ zplug install
+ fi
+
zplug load
'';
diff --git a/tests/modules/programs/zplug/modules.nix b/tests/modules/programs/zplug/modules.nix
index 8ebf82b861f..704c5c5e2ef 100644
--- a/tests/modules/programs/zplug/modules.nix
+++ b/tests/modules/programs/zplug/modules.nix
@@ -38,8 +38,10 @@ with lib;
assertFileContains home-files/.zshrc \
'zplug "lib/clipboard", from:oh-my-zsh, if:"[[ $OSTYPE == *darwin* ]]"'
- assertFileRegex home-files/.zshrc \
- '^zplug install$'
+ assertFileContains home-files/.zshrc \
+ 'if ! zplug check; then
+ zplug install
+ fi'
assertFileRegex home-files/.zshrc \
'^zplug load$'