Commit a8ea6fb4949d21afe019d637bbaa1741d595e20b
Merge branch 'master' of github.com:zsh-users/antigen
Showing 2 changed files Side-by-side Diff
README.mkd
... | ... | @@ -53,7 +53,7 @@ it). Just a bundle command away. |
53 | 53 | antigen-bundle sharat87/autoenv |
54 | 54 | |
55 | 55 | And boom! you have all the autoenv goodness. Just remember how you used to do |
56 | -these before antigen, clone it, modify your bashrc to source it, load a new | |
56 | +these before antigen, clone it, modify your zshrc to source it, load a new | |
57 | 57 | terminal, all just to test it out. Duh! |
58 | 58 | |
59 | 59 | A subtle aspect of this is that you can tell antigen to grab just about anything |
antigen.zsh
... | ... | @@ -126,18 +126,22 @@ antigen-update () { |
126 | 126 | } |
127 | 127 | |
128 | 128 | antigen-revert () { |
129 | - if ! [[ -f $ADOTDIR/revert-info ]]; then | |
129 | + if [[ -f $ADOTDIR/revert-info ]]; then | |
130 | + cat $ADOTDIR/revert-info | sed '1!p' | while read line; do | |
131 | + dir="$(echo "$line" | cut -d: -f1)" | |
132 | + git --git-dir="$dir/.git" --work-tree="$dir" \ | |
133 | + checkout "$(echo "$line" | cut -d: -f2)" 2> /dev/null | |
134 | + | |
135 | + done | |
136 | + | |
137 | + echo "Reverted to state before running -update on $( | |
138 | + cat $ADOTDIR/revert-info | sed -n 1p)." | |
139 | + | |
140 | + else | |
130 | 141 | echo 'No revert information available. Cannot revert.' >&2 |
131 | 142 | fi |
132 | 143 | |
133 | - cat $ADOTDIR/revert-info | sed '1!p' | while read line; do | |
134 | - dir="$(echo "$line" | cut -d: -f1)" | |
135 | - git --git-dir="$dir/.git" --work-tree="$dir" \ | |
136 | - checkout "$(echo "$line" | cut -d: -f2)" 2> /dev/null | |
137 | - done | |
138 | 144 | |
139 | - echo "Reverted to state before running -update on $( | |
140 | - cat $ADOTDIR/revert-info | sed -n 1p)." | |
141 | 145 | } |
142 | 146 | |
143 | 147 | -antigen-get-clone-dir () { |
... | ... | @@ -225,7 +229,7 @@ antigen-revert () { |
225 | 229 | --plugin-git checkout $requested_branch |
226 | 230 | fi |
227 | 231 | |
228 | - if ! [[ -z $old_rev || $old_rev == $new_rev ]]; then | |
232 | + if [[ -n $old_rev && $old_rev != $new_rev ]]; then | |
229 | 233 | echo Updated from ${old_rev:0:7} to ${new_rev:0:7}. |
230 | 234 | if $verbose; then |
231 | 235 | --plugin-git log --oneline --reverse --no-merges --stat '@{1}..' |
... | ... | @@ -541,7 +545,7 @@ antigen () { |
541 | 545 | |
542 | 546 | # Set spec values based on the positional arguments. |
543 | 547 | local i=1 |
544 | - while ! [[ -z $1 || $1 == --* ]]; do | |
548 | + while [[ -n $1 && $1 != --* ]]; do | |
545 | 549 | |
546 | 550 | if (( $i > $positional_args_count )); then |
547 | 551 | echo "Only $positional_args_count positional arguments allowed." >&2 |