Commit da678afb28803f7ed292ec13a43aeb818a510053
1 parent
23ddf43369
Introduce antigen-use command
Showing 3 changed files with 41 additions and 9 deletions Side-by-side Diff
README.mkd
... | ... | @@ -77,7 +77,7 @@ See? It's easy! To see how that works, refer to the section on the |
77 | 77 | Note: Many of those plugins and especially themes, assume you have the core |
78 | 78 | library of oh-my-zsh loaded. So, if you want to experiment further, issue a |
79 | 79 | |
80 | - antigen-lib | |
80 | + antigen-use oh-my-zsh | |
81 | 81 | |
82 | 82 | and continue until you're tired. At which point you can come back to this page |
83 | 83 | ;) |
... | ... | @@ -98,7 +98,7 @@ might look like this |
98 | 98 | source /path-to-antigen-clone/antigen.zsh |
99 | 99 | |
100 | 100 | # Load the oh-my-zsh's library. |
101 | - antigen-lib | |
101 | + antigen-use oh-my-zsh | |
102 | 102 | |
103 | 103 | # Bundles from the default repo (robbyrussell's oh-my-zsh). |
104 | 104 | antigen-bundle git |
... | ... | @@ -351,7 +351,7 @@ clones. If the `--force` argument is given, then this confirmation is not asked. |
351 | 351 | It straight away deletes all the unused clones. This option makes this command |
352 | 352 | usable in a non-interactive fashion. |
353 | 353 | |
354 | -### antigen-lib | |
354 | +### antigen-use oh-my-zsh | |
355 | 355 | |
356 | 356 | This is (almost) the same as |
357 | 357 | |
... | ... | @@ -365,19 +365,19 @@ correct path, if not already set to something else. |
365 | 365 | |
366 | 366 | Please note that this assumes that the `ANTIGEN_DEFAULT_REPO_URL` is set to the |
367 | 367 | oh-my-zsh repo or a fork of that repo. If you want to specify the `url` too, |
368 | -then you can't use the `antigen-lib` short cut. You have to do that directly | |
368 | +then you can't use the `antigen-use oh-my-zsh` short cut. You have to do that directly | |
369 | 369 | with the `antigen-bundle` command. |
370 | 370 | |
371 | 371 | This is present to ease dealing with oh-my-zsh plugins. |
372 | 372 | |
373 | 373 | Use |
374 | 374 | |
375 | - antigen-lib | |
375 | + antigen-use oh-my-zsh | |
376 | 376 | |
377 | 377 | in your `.zshrc`, before any `antigen-bundle` declarations. It takes no |
378 | 378 | arguments. |
379 | 379 | |
380 | -### antigen-prezto-lib <sup>α</sup> | |
380 | +### antigen-use prezto <sup>α</sup> | |
381 | 381 | |
382 | 382 | This is (almost, but not quite) the same as doing, |
383 | 383 | |
... | ... | @@ -411,9 +411,9 @@ Will pull the apple theme from the canonical oh-my-zsh repo. Also, note that the |
411 | 411 | You can use this command to change your theme on the fly in your shell. Go on, |
412 | 412 | try out a few themes in your shell before you set it in your `.zshrc`. |
413 | 413 | |
414 | -**Note**: Some themes use functions that are loaded by `antigen-lib`. So, to | |
415 | -avoid any trouble, run `antigen-lib` if you haven't already before experimenting | |
416 | -with themes. If you have `antigen-lib` in your `.zshrc`, you're covered. | |
414 | +**Note**: Some themes use functions that are loaded by `antigen-use oh-my-zsh`. So, to | |
415 | +avoid any trouble, run `antigen-use oh-my-zsh` if you haven't already before experimenting | |
416 | +with themes. If you have `antigen-use oh-my-zsh` in your `.zshrc`, you're covered. | |
417 | 417 | |
418 | 418 | **Note**: Do *not* provide the `--btype` argument to `antigen-theme`. Its an |
419 | 419 | internal argument. |
antigen.zsh
... | ... | @@ -371,6 +371,19 @@ antigen-cleanup () { |
371 | 371 | fi |
372 | 372 | } |
373 | 373 | |
374 | +antigen-use () { | |
375 | + if [[ $1 == "oh-my-zsh" ]]; then | |
376 | + antigen-lib $@ | |
377 | + elif [[ $1 == "prezto" ]]; then | |
378 | + antigen-prezto-lib $@ | |
379 | + else | |
380 | + echo 'Antigen currently supports only following libraries:' >&2 | |
381 | + echo ' * oh-my-zsh' >&2 | |
382 | + echo ' * prezto' >&2 | |
383 | + return 1 | |
384 | + fi | |
385 | +} | |
386 | + | |
374 | 387 | antigen-lib () { |
375 | 388 | if [[ -z "$ZSH" ]]; then |
376 | 389 | export ZSH="$(-antigen-get-clone-dir "$ANTIGEN_DEFAULT_REPO_URL")" |
tests/antigen-use.t
... | ... | @@ -0,0 +1,19 @@ |
1 | +Load unknown library. | |
2 | + | |
3 | + $ antigen-use unknown | |
4 | + Antigen currently supports only following libraries: | |
5 | + * oh-my-zsh | |
6 | + * prezto | |
7 | + [1] | |
8 | + | |
9 | +# Fixme: loading prezto or oh-my-zsh library breaks all the tests. | |
10 | +# | |
11 | +# Load prezto library. | |
12 | +# | |
13 | +# $ antigen-use prezto &> /dev/null | |
14 | +# $ antigen-bundle git &> /dev/null | |
15 | +# | |
16 | +# Load oh-my-zsh library. | |
17 | +# | |
18 | +# $ antigen-use oh-my-zsh &> /dev/null | |
19 | +# $ antigen-bundle git &> /dev/null |