Skip to content

Commit

Permalink
Add antibody home command
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmc3 committed Dec 29, 2023
1 parent 63f39f0 commit 219afde
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 2 deletions.
21 changes: 19 additions & 2 deletions bin/antibody
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@
ANTIBODY_VERSION="1.9.4"

echos() {
print -r "$@"
print -r -- "$@"
}

echoln() {
printf '%s\n' "${@[@]}"
}

echoerr() {
print -ru2 "$@"
print -ru2 -- "$@"
}

-antibody-version() {
Expand Down Expand Up @@ -82,6 +82,23 @@ echoerr() {
echoln "$script[@]"
}

-antibody-cmd-home() {
local result ostype=${ANTIBODY_TEST_OSTYPE:-$OSTYPE}
if [[ -n "$ANTIBODY_HOME" ]]; then
result=$ANTIBODY_HOME
elif [[ "$ostype" == darwin* ]]; then
result=$HOME/Library/Caches
elif [[ "$ostype" == (cygwin|msys)* ]]; then
result=${LOCALAPPDATA:-$LocalAppData}
if type cygpath > /dev/null; then
result=$(cygpath "$result")
fi
else
result=${XDG_CACHE_HOME:-$HOME/.cache}
fi
echos $result
}

antibody() {
cmd=${1:-help}
case "$cmd" in
Expand Down
37 changes: 37 additions & 0 deletions bin/antibody.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,5 +118,42 @@ compctl -K _antibody antibody
$
```

### home

`antibody home` prints where antibody is cloning bundles. This differs based on which system you are on.

```sh
$ ANTIBODY_TEST_OSTYPE=linux antibody home | subenv
$HOME/.cache
$ ANTIBODY_TEST_OSTYPE=darwin antibody home | subenv
$HOME/Library/Caches
$
```

You can also change Antibody’s home folder by manually setting `ANTIBODY_HOME` to a path of your choosing:

```sh
$ export ANTIBODY_HOME=$HOME/path/to/antibody/home
$ antibody home | subenv
$HOME/path/to/antibody/home
$
```

### bundle

TODO:

### update

TODO:

### list

TODO:

### purge

TODO:

[antibody]: https://github.com/getantibody/antibody
[clitest]: https://github.com/aureliojargas/clitest

0 comments on commit 219afde

Please sign in to comment.