Commit 0c257ebe4a9289925701e6755ad0cc421f988f8b

Authored by Shrikant Sharat
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

... ... @@ -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 () {
... ... @@ -17,6 +17,7 @@ mkdir "$PLUGIN_DIR"
17 17 alias pg='git --git-dir "$PLUGIN_DIR/.git" --work-tree "$PLUGIN_DIR"'
18 18  
19 19 echo 'alias hehe="echo hehe"' > "$PLUGIN_DIR"/aliases.zsh
  20 +echo 'export PS1="prompt>"' > "$PLUGIN_DIR"/silly.zsh-theme
20 21  
21 22 {
22 23 pg init
... ... @@ -0,0 +1,7 @@
  1 +Load the theme explicitly.
  2 +
  3 + $ antigen-theme $PLUGIN_DIR silly
  4 + Cloning into '*'... (glob)
  5 + done.
  6 + $ echo "$PS1"
  7 + prompt>