From 6d9b5a7d6db1815ea68bebf7cda7d1ded89c3392 Mon Sep 17 00:00:00 2001 From: LoneExile Date: Thu, 4 May 2023 01:07:39 +0700 Subject: [PATCH] feat(update): add flag (-a, --all) #123 --- zap.zsh | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/zap.zsh b/zap.zsh index 13bc475..b29bad4 100644 --- a/zap.zsh +++ b/zap.zsh @@ -75,6 +75,14 @@ function _zap_update() { local _plugin _plug _status + if [[ "$1" == "-a" || "$1" == "--all" ]]; then + echo "\nUpdating All Plugins\n" + for _plug in ${ZAP_INSTALLED_PLUGINS[@]}; do + _pull "$ZAP_PLUGIN_DIR/$_plug" + done + return 0 + fi + function _check() { git -C "$1" remote update &> /dev/null case $(LANG=en_US git -C "$1" status -uno | grep -Eo '(ahead|behind|up to date)') in @@ -120,11 +128,11 @@ function _zap_help() { Usage: zap COMMANDS: - clean Remove unused plugins - help Show this help message - list List plugins - update Update plugins - version Show version information" + clean Remove unused plugins + help Show this help message + list List plugins + update [-a, --all] Update plugins + version Show version information" } function _zap_version() { @@ -144,7 +152,7 @@ function zap() { version "_zap_version" ) emulate -L zsh - [[ -z "$subcmds[$1]" ]] && { _zap_help; return 1 } || ${subcmds[$1]} + [[ -z "$subcmds[$1]" ]] && { _zap_help; return 1 } || ${subcmds[$1]} $2 } # vim: ft=zsh ts=4 et @@ -155,3 +163,4 @@ function zap() { # 13: Failed to checkout # 14: Failed to pull # 15: Nothing to remove +