From 5562f431d0d4a63c54815af5dd831fbfba99e20a Mon Sep 17 00:00:00 2001 From: James Patrick Date: Tue, 11 May 2021 15:11:30 -0400 Subject: [PATCH] Generally guard clauses > if else --- zsh/makefile | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/zsh/makefile b/zsh/makefile index c7e61b4..c52976b 100644 --- a/zsh/makefile +++ b/zsh/makefile @@ -20,29 +20,27 @@ init: ; $(report) "updating cache permissions" init_zplug: - if [ ! -e $(ZPLUG_DIR) ] ; then - export ZPLUG_HOME=$(ZPLUG_DIR) - git clone https://github.com/zplug/zplug $(ZPLUG_DIR) \ - ; $(report) "zplug installed" - else + if [ -e $(ZPLUG_DIR) ] ; then $(report) debug "zplug already installed. Skipping" + return fi + export ZPLUG_HOME=$(ZPLUG_DIR) + git clone https://github.com/zplug/zplug $(ZPLUG_DIR) \ + ; $(report) "zplug installed" update: - if [ -e $(ZPLUG_DIR) ] ; then - $(report) header "Updating zplug" - source $(ZPLUG_DIR)/init.zsh - source $(ZSH_DIR)/zplug - export zplugs - zplug install - zplug update \ - ; $(report) "zplug upate" - zplug clean \ - ; $(report) "zplug cleaned" - else + if [ ! -d $(ZPLUG_DIR) ] ; then $(report) error "$(ZPLUG_DIR) doesn't exist - run init first." + return fi + $(report) header "Updating zplug" + source $(ZPLUG_DIR)/init.zsh + source $(ZSH_DIR)/zplug + export zplugs + zplug install + zplug update ; $(report) "zplug upate" + zplug clean ; $(report) "zplug cleaned" remove: rm -rf $(ZPLUG_DIR) ; $(report) "deleting zplug dir"