From 1a6d6b8acee1537e6cf48dbc5b32dacba06e8ef3 Mon Sep 17 00:00:00 2001 From: Paho Lurie-Gregg Date: Sun, 6 Sep 2020 02:16:34 -0700 Subject: [PATCH] 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. --- modules/programs/zplug.nix | 7 +++++-- tests/modules/programs/zplug/modules.nix | 6 ++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/modules/programs/zplug.nix b/modules/programs/zplug.nix index 0df395292..6cb5e98e3 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 8ebf82b86..704c5c5e2 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$'