Commit a4f6e2fc87bd6d11349f86c81b90ae239d03abac
1 parent
7ba3548fdf
Fix #2. Add `antigen-` prefix for commands.
This is done so that the commands don't clash with other programs. Notably, Bundler's `bundle` command is a clash.
Showing 1 changed file with 27 additions and 27 deletions Side-by-side Diff
antigen.zsh
| ... | ... | @@ -7,8 +7,8 @@ |
| 7 | 7 | local _ANTIGEN_BUNDLE_RECORD="" |
| 8 | 8 | |
| 9 | 9 | # Syntaxes |
| 10 | -# bundle <url> [<loc>=/] | |
| 11 | -bundle () { | |
| 10 | +# antigen-bundle <url> [<loc>=/] | |
| 11 | +antigen-bundle () { | |
| 12 | 12 | |
| 13 | 13 | # Bundle spec arguments' default values. |
| 14 | 14 | local url="$ANTIGEN_DEFAULT_REPO_URL" |
| ... | ... | @@ -50,20 +50,20 @@ bundle () { |
| 50 | 50 | # Add it to the record. |
| 51 | 51 | _ANTIGEN_BUNDLE_RECORD="$_ANTIGEN_BUNDLE_RECORD\n$url $loc $btype" |
| 52 | 52 | |
| 53 | - -bundle-ensure-repo "$url" | |
| 53 | + -antigen-ensure-repo "$url" | |
| 54 | 54 | |
| 55 | - -bundle-load "$url" "$loc" "$btype" | |
| 55 | + -antigen-load "$url" "$loc" "$btype" | |
| 56 | 56 | |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | -bundle-update () { | |
| 59 | +antigen-bundle-update () { | |
| 60 | 60 | # Update your bundles, i.e., `git pull` in all the plugin repos. |
| 61 | - -bundle-echo-record | awk '{print $1}' | sort -u | while read url; do | |
| 62 | - -bundle-ensure-repo --update "$url" | |
| 61 | + -antigen-echo-record | awk '{print $1}' | sort -u | while read url; do | |
| 62 | + -antigen-ensure-repo --update "$url" | |
| 63 | 63 | done |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | --bundle-get-clone-dir () { | |
| 66 | +-antigen-get-clone-dir () { | |
| 67 | 67 | # Takes a repo url and gives out the path that this url needs to be cloned |
| 68 | 68 | # to. Doesn't actually clone anything. |
| 69 | 69 | # TODO: Memoize? |
| ... | ... | @@ -74,7 +74,7 @@ bundle-update () { |
| 74 | 74 | -e 's.:.-COLON-.g' |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | --bundle-get-clone-url () { | |
| 77 | +-antigen-get-clone-url () { | |
| 78 | 78 | # Takes a repo's clone dir and gives out the repo's original url that was |
| 79 | 79 | # used to create the given directory path. |
| 80 | 80 | # TODO: Memoize? |
| ... | ... | @@ -85,7 +85,7 @@ bundle-update () { |
| 85 | 85 | -e 's.-COLON-.:.g' |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | --bundle-ensure-repo () { | |
| 88 | +-antigen-ensure-repo () { | |
| 89 | 89 | |
| 90 | 90 | local update=false |
| 91 | 91 | if [[ $1 == --update ]]; then |
| ... | ... | @@ -94,7 +94,7 @@ bundle-update () { |
| 94 | 94 | fi |
| 95 | 95 | |
| 96 | 96 | local url="$1" |
| 97 | - local clone_dir="$(-bundle-get-clone-dir $url)" | |
| 97 | + local clone_dir="$(-antigen-get-clone-dir $url)" | |
| 98 | 98 | |
| 99 | 99 | if [[ ! -d $clone_dir ]]; then |
| 100 | 100 | git clone "$url" "$clone_dir" |
| ... | ... | @@ -104,10 +104,10 @@ bundle-update () { |
| 104 | 104 | |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | --bundle-load () { | |
| 107 | +-antigen-load () { | |
| 108 | 108 | |
| 109 | 109 | local url="$1" |
| 110 | - local location="$(-bundle-get-clone-dir "$url")/$2" | |
| 110 | + local location="$(-antigen-get-clone-dir "$url")/$2" | |
| 111 | 111 | local btype="$3" |
| 112 | 112 | |
| 113 | 113 | if [[ $btype == theme ]]; then |
| ... | ... | @@ -138,7 +138,7 @@ bundle-update () { |
| 138 | 138 | |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | -bundle-cleanup () { | |
| 141 | +antigen-cleanup () { | |
| 142 | 142 | |
| 143 | 143 | if [[ ! -d "$ADOTDIR/repos" || -z "$(ls "$ADOTDIR/repos/")" ]]; then |
| 144 | 144 | echo "You don't have any bundles." |
| ... | ... | @@ -147,9 +147,9 @@ bundle-cleanup () { |
| 147 | 147 | |
| 148 | 148 | # Find directores in ADOTDIR/repos, that are not in the bundles record. |
| 149 | 149 | local unused_clones="$(comm -13 \ |
| 150 | - <(-bundle-echo-record | awk '{print $1}' | sort -u) \ | |
| 150 | + <(-antigen-echo-record | awk '{print $1}' | sort -u) \ | |
| 151 | 151 | <(ls "$ADOTDIR/repos" | while read line; do |
| 152 | - -bundle-get-clone-url "$line" | |
| 152 | + -antigen-get-clone-url "$line" | |
| 153 | 153 | done))" |
| 154 | 154 | |
| 155 | 155 | if [[ -z $unused_clones ]]; then |
| ... | ... | @@ -166,7 +166,7 @@ bundle-cleanup () { |
| 166 | 166 | echo |
| 167 | 167 | echo "$unused_clones" | while read url; do |
| 168 | 168 | echo -n "Deleting clone for $url..." |
| 169 | - rm -rf "$(-bundle-get-clone-dir $url)" | |
| 169 | + rm -rf "$(-antigen-get-clone-dir $url)" | |
| 170 | 170 | echo ' done.' |
| 171 | 171 | done |
| 172 | 172 | else |
| ... | ... | @@ -175,39 +175,39 @@ bundle-cleanup () { |
| 175 | 175 | fi |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | -bundle-lib () { | |
| 179 | - bundle --loc=lib | |
| 178 | +antigen-lib () { | |
| 179 | + antigen-bundle --loc=lib | |
| 180 | 180 | } |
| 181 | 181 | |
| 182 | -bundle-theme () { | |
| 182 | +antigen-theme () { | |
| 183 | 183 | local name="${1:-robbyrussell}" |
| 184 | - bundle --loc=themes/$name.zsh-theme --btype=theme | |
| 184 | + antigen-bundle --loc=themes/$name.zsh-theme --btype=theme | |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | -bundle-apply () { | |
| 187 | +antigen-apply () { | |
| 188 | 188 | # Initialize completion. |
| 189 | 189 | # TODO: Only load completions if there are any changes to the bundle |
| 190 | 190 | # repositories. |
| 191 | 191 | compinit -i |
| 192 | 192 | } |
| 193 | 193 | |
| 194 | -bundle-list () { | |
| 194 | +antigen-list () { | |
| 195 | 195 | # List all currently installed bundles |
| 196 | 196 | if [[ -z "$_ANTIGEN_BUNDLE_RECORD" ]]; then |
| 197 | 197 | echo "You don't have any bundles." >&2 |
| 198 | 198 | return 1 |
| 199 | 199 | else |
| 200 | - -bundle-echo-record | |
| 200 | + -antigen-echo-record | |
| 201 | 201 | fi |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | # Echo the bundle specs as in the record. The first line is not echoed since it |
| 205 | 205 | # is a blank line. |
| 206 | --bundle-echo-record () { | |
| 206 | +-antigen-echo-record () { | |
| 207 | 207 | echo "$_ANTIGEN_BUNDLE_RECORD" | sed -n '1!p' |
| 208 | 208 | } |
| 209 | 209 | |
| 210 | --bundle-env-setup () { | |
| 210 | +-antigen-env-setup () { | |
| 211 | 211 | # Pre-startup initializations |
| 212 | 212 | -set-default ANTIGEN_DEFAULT_REPO_URL \ |
| 213 | 213 | https://github.com/robbyrussell/oh-my-zsh.git |
| ... | ... | @@ -228,4 +228,4 @@ bundle-list () { |
| 228 | 228 | eval "test -z \"\$$arg_name\" && export $arg_name='$arg_value'" |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | --bundle-env-setup | |
| 231 | +-antigen-env-setup |