From 2ac7c0cb0ac5795033c20544a9d4117f76ce9597 Mon Sep 17 00:00:00 2001 From: Shrikant Sharat Date: Fri, 8 Jun 2012 18:15:08 +0530 Subject: [PATCH] Bundles are installed without a bundle-install command. When a plugin is specified with the `bundle` command, the plugin is immediately installed and loaded. No need of running a bundle-install and restarting your shell. --- antigen.zsh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/antigen.zsh b/antigen.zsh index 701a26d..a0898dd 100644 --- a/antigen.zsh +++ b/antigen.zsh @@ -55,7 +55,36 @@ bundle () { # Add it to the record. _ANTIGEN_BUNDLE_RECORD="$_ANTIGEN_BUNDLE_RECORD\n$url $loc $clone_dir $btype" + -antigen-ensure-repo "$url" "$clone_dir" + bundle-load "$clone_dir/$loc" "$btype" + +} + +-antigen-ensure-repo () { + + local update=false + if [[ $1 == --update ]]; then + update=true + shift + fi + + local handled_repos="" + local install_bundles="" + + local url="$1" + local clone_dir="$2" + + if ! echo "$handled_repos" | grep -Fqm1 "$url"; then + if [[ ! -d $clone_dir ]]; then + git clone "$url" "$clone_dir" + elif $update; then + git --git-dir "$clone_dir/.git" pull + fi + + handled_repos="$handled_repos\n$url" + fi + } bundle-install () { -- 2.0.0