Skip to content

Commit

Permalink
feat(update): add flag (-a, --all) zap-zsh#123
Browse files Browse the repository at this point in the history
  • Loading branch information
LoneExile committed May 3, 2023
1 parent aa6c5d7 commit 6d9b5a7
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions zap.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -120,11 +128,11 @@ function _zap_help() {
Usage: zap <command>
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() {
Expand All @@ -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
Expand All @@ -155,3 +163,4 @@ function zap() {
# 13: Failed to checkout
# 14: Failed to pull
# 15: Nothing to remove

0 comments on commit 6d9b5a7

Please sign in to comment.