Commit 0c257ebe4a9289925701e6755ad0cc421f988f8b
1 parent
40deb795bd
For #29. Intial working implementation with tests.
The `-theme` command is now little more than an extension to the `-bundle` command. The difference is that this command sets `--btype=theme`, which is what indicates that this bundle is a theme. As such, the `-theme` command accepts all the documented options taken by `-bundle`.
Showing 3 changed files with 25 additions and 2 deletions Side-by-side Diff
antigen.zsh
... | ... | @@ -49,6 +49,11 @@ antigen-bundle () { |
49 | 49 | make_local_clone=false |
50 | 50 | fi |
51 | 51 | |
52 | + # Add the theme extension to `loc`, if this is a theme. | |
53 | + if [[ $btype == theme && $loc != *.zsh-theme ]]; then | |
54 | + loc="$loc.zsh-theme" | |
55 | + fi | |
56 | + | |
52 | 57 | # Add it to the record. |
53 | 58 | _ANTIGEN_BUNDLE_RECORD="$_ANTIGEN_BUNDLE_RECORD\n$url $loc $btype" |
54 | 59 | _ANTIGEN_BUNDLE_RECORD="$_ANTIGEN_BUNDLE_RECORD $make_local_clone" |
... | ... | @@ -313,8 +318,18 @@ antigen-lib () { |
313 | 318 | } |
314 | 319 | |
315 | 320 | antigen-theme () { |
316 | - local name="${1:-robbyrussell}" | |
317 | - antigen-bundle --loc=themes/$name.zsh-theme --btype=theme | |
321 | + | |
322 | + if [[ "$1" != */* && "$1" != --* ]]; then | |
323 | + # The first argument is just a name of the plugin, to be picked up from | |
324 | + # the default repo. | |
325 | + local name="${1:-robbyrussell}" | |
326 | + antigen-bundle --loc=themes/$name --btype=theme | |
327 | + | |
328 | + else | |
329 | + antigen-bundle "$@" --btype=theme | |
330 | + | |
331 | + fi | |
332 | + | |
318 | 333 | } |
319 | 334 | |
320 | 335 | antigen-apply () { |
tests/.zshenv
tests/theme.t