removed windows and linux split subdir
This commit is contained in:
parent
83dda10fa8
commit
065b982734
280 changed files with 9053 additions and 426 deletions
71
.antidote/tests/README.md
Normal file
71
.antidote/tests/README.md
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
# antidote tests
|
||||
|
||||
Tests are using [clitest](https://github.com/aureliojargas/clitest). `clitest` utilizes markdown files in this folder to house the tests in a literate format.
|
||||
|
||||
## Setup
|
||||
|
||||
A simple setup consists of:
|
||||
|
||||
- Remove existing antidote zstyles
|
||||
- Don't really git things
|
||||
- Setup antidote
|
||||
|
||||
```zsh
|
||||
source <(zstyle -L ':antidote:*' | awk '{print "zstyle -d",$2}')
|
||||
function git { echo "$@" }
|
||||
ANTIDOTE_HOME=$PWD/tests/zdotdir/antidote_home
|
||||
source ./antidote.zsh
|
||||
```
|
||||
|
||||
But you probably just want to source setup...
|
||||
|
||||
```zsh
|
||||
% source ./tests/_setup.zsh
|
||||
% source ./antidote.zsh
|
||||
%
|
||||
```
|
||||
|
||||
## General
|
||||
|
||||
`antidote` with no args displays its help:
|
||||
|
||||
```zsh
|
||||
% antidote
|
||||
antidote - the cure to slow zsh plugin management
|
||||
|
||||
usage: antidote [<flags>] <command> [<args> ...]
|
||||
|
||||
flags:
|
||||
-h, --help Show context-sensitive help
|
||||
-v, --version Show application version
|
||||
|
||||
commands:
|
||||
help Show documentation
|
||||
load Statically source all bundles from the plugins file
|
||||
bundle Clone bundle(s) and generate the static load script
|
||||
install Clone a new bundle and add it to your plugins file
|
||||
update Update antidote and its cloned bundles
|
||||
purge Remove a cloned bundle
|
||||
home Print where antidote is cloning bundles
|
||||
list List cloned bundles
|
||||
path Print the path of a cloned bundle
|
||||
init Initialize the shell for dynamic bundles
|
||||
%
|
||||
```
|
||||
|
||||
## Version
|
||||
|
||||
The `-v/--version` flag displays the current version:
|
||||
|
||||
```zsh
|
||||
% antidote --version
|
||||
antidote version 1.9.7
|
||||
%
|
||||
```
|
||||
|
||||
## Teardown
|
||||
|
||||
```zsh
|
||||
% t_teardown
|
||||
%
|
||||
```
|
||||
4
.antidote/tests/_setup.zsh
Normal file
4
.antidote/tests/_setup.zsh
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
# autoload test functions
|
||||
0=${(%):-%N}
|
||||
autoload -U ${0:A:h}/functions/t_setup
|
||||
t_setup
|
||||
70
.antidote/tests/functions/mockgit
Normal file
70
.antidote/tests/functions/mockgit
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
#!/bin/zsh
|
||||
#function mockgit {
|
||||
# handle these commands:
|
||||
# - `git -C "$dir" config remote.origin.url`
|
||||
# - `git -C "$dir" pull --quiet --ff --rebase --autostash`
|
||||
# - `git -C "$dir" rev-parse --short HEAD`
|
||||
# - `git clone --quiet --depth 1 --recurse-submodules --shallow-submodules --branch branch $url $dir`
|
||||
# - `git --version`
|
||||
emulate -L zsh; setopt local_options extended_glob
|
||||
local MATCH MBEGIN MEND; local -a match mbegin mend # appease 'warn_create_global'
|
||||
0=${(%):-%x}
|
||||
|
||||
local args=("$@[@]")
|
||||
local o_path o_quiet o_ff o_rebase o_autostash o_short
|
||||
local o_depth o_recurse_submodules o_shallow_submodules o_branch
|
||||
local o_init o_recursive
|
||||
zparseopts -D -E -- \
|
||||
C:=o_path \
|
||||
-short=o_short \
|
||||
-quiet=o_quiet \
|
||||
-ff=o_ff \
|
||||
-rebase=o_rebase \
|
||||
-autostash=o_autostash \
|
||||
-recurse-submodules=o_recurse_submodules \
|
||||
-shallow-submodules=o_shallow_submodules \
|
||||
-depth:=o_depth \
|
||||
-branch:=o_branch \
|
||||
-init=o_init \
|
||||
-recursive=o_recursive ||
|
||||
return 1
|
||||
|
||||
if [[ "$@" = "--version" ]]; then
|
||||
echo "0.0.0"
|
||||
elif [[ "$1" = "clone" ]]; then
|
||||
local giturl="$2"
|
||||
local bundledir="$3"
|
||||
local src="$ANTIDOTE_HOME/${bundledir:t}"
|
||||
if [[ -d $src ]]; then
|
||||
cp -r $src ${bundledir:h}
|
||||
elif ! (( $#o_quiet )); then
|
||||
echo "MOCKGIT: Cloning into '${url:t}'..."
|
||||
echo "MOCKGIT: Repository not found."
|
||||
echo "MOCKGIT: repository '$url' not found"
|
||||
fi
|
||||
elif [[ "$@" = "config remote.origin.url" ]]; then
|
||||
if [[ -e $bundledir/.git/config/remote.origin.url ]]; then
|
||||
cat $bundledir/.git/config/remote.origin.url
|
||||
else
|
||||
# un-sanitize dir into URL
|
||||
local url=$o_path[-1]
|
||||
url=${url:t}
|
||||
url=${url:gs/-AT-/\@}
|
||||
url=${url:gs/-COLON-/\:}
|
||||
url=${url:gs/-SLASH-/\/}
|
||||
echo "$url"
|
||||
fi
|
||||
elif [[ "$@" = "pull" ]]; then
|
||||
(( $#o_quiet )) || echo "MOCKGIT: Already up to date."
|
||||
elif [[ "$@" = "rev-parse HEAD" ]]; then
|
||||
#echo "a123456"
|
||||
echo ""
|
||||
elif [[ "$@" = "submodule sync" ]]; then
|
||||
# nothing to do
|
||||
elif [[ "$@" = "submodule update" ]]; then
|
||||
# nothing to do
|
||||
else
|
||||
echo >&2 "mocking not implemented for git command: git $@"
|
||||
return 1
|
||||
fi
|
||||
#}
|
||||
17
.antidote/tests/functions/subenv
Normal file
17
.antidote/tests/functions/subenv
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
#!/bin/zsh
|
||||
#function subenv {
|
||||
emulate -L zsh; setopt local_options
|
||||
|
||||
if (( $# == 0 )); then
|
||||
set -- HOME
|
||||
fi
|
||||
|
||||
local -a sedargs=(-e "s|\$HOME|$HOME|g")
|
||||
while (( $# )); do
|
||||
if [[ -v "$1" ]]; then
|
||||
sedargs+=(-e "s|${(P)1}|\$$1|g")
|
||||
fi
|
||||
shift
|
||||
done
|
||||
sed "$sedargs[@]"
|
||||
#}
|
||||
7
.antidote/tests/functions/t_reset
Normal file
7
.antidote/tests/functions/t_reset
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
#!/bin/zsh
|
||||
#function t_reset {
|
||||
0=${(%):-%x}
|
||||
t_teardown
|
||||
t_setup
|
||||
source ${0:A:h:h:h}/antidote.zsh
|
||||
#}
|
||||
54
.antidote/tests/functions/t_setup
Normal file
54
.antidote/tests/functions/t_setup
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
#!/bin/zsh
|
||||
#function t_setup {
|
||||
emulate -L zsh
|
||||
setopt local_options extended_glob glob_dots
|
||||
|
||||
0=${(%):-%x}
|
||||
local prjdir="${0:A:h:h:h}"
|
||||
local testdir="${0:A:h:h}"
|
||||
|
||||
# save path/fpath
|
||||
typeset -ga T_PREV_PATH=( $path )
|
||||
typeset -ga T_PREV_FPATH=( $fpath )
|
||||
|
||||
# save zstyles, and clear them all for the test session
|
||||
typeset -ga T_PREV_ZSTYLES=( ${(@f)"$(zstyle -L ':antidote:*')"} )
|
||||
source <(zstyle -L ':antidote:*' | awk '{print "zstyle -d",$2}')
|
||||
|
||||
# setup test functions
|
||||
fpath+=( $testdir/functions )
|
||||
autoload -Uz $testdir/functions/*
|
||||
|
||||
# mock git
|
||||
function git { mockgit "$@" }
|
||||
|
||||
# works with BSD and GNU gmktemp
|
||||
T_TEMPDIR=${$(mktemp -d -t t_antidote.XXXXXXXX):A}
|
||||
typeset -g T_PREV_HOME=$HOME
|
||||
typeset -g T_PREV_ZDOTDIR=$ZDOTDIR
|
||||
|
||||
export HOME=$T_TEMPDIR
|
||||
export ZDOTDIR=$HOME/.zsh
|
||||
typeset -g ANTIDOTE_HOME=$HOME/.cache/antidote
|
||||
|
||||
# put tmp_home into position
|
||||
for p in $testdir/tmp_home/*; do
|
||||
cp -rf $p $T_TEMPDIR
|
||||
done
|
||||
|
||||
# rename .mockgit to .git
|
||||
local mockdir
|
||||
for mockdir in $T_TEMPDIR/**/.mock*; do
|
||||
mv $mockdir ${mockdir:s/.mock/.}
|
||||
done
|
||||
|
||||
# our mock plugins use this
|
||||
typeset -ga plugins=()
|
||||
typeset -ga libs=()
|
||||
|
||||
# setup antidote
|
||||
zstyle ':antidote:tests' set-warn-options 'on'
|
||||
zstyle ':antidote:tests' cloning 'off'
|
||||
zstyle ':antidote:bundle' use-friendly-names on
|
||||
zstyle ':antidote:defer' bundle 'getantidote/zsh-defer'
|
||||
#}
|
||||
30
.antidote/tests/functions/t_setup_real
Normal file
30
.antidote/tests/functions/t_setup_real
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
#!/bin/zsh
|
||||
#function t_setup_real {
|
||||
0=${(%):-%x}
|
||||
local testdir="${0:A:h:h}"
|
||||
local prjdir="${0:A:h:h:h}"
|
||||
|
||||
# undo setup so we clone for real
|
||||
zstyle ':antidote:tests' cloning 'on'
|
||||
(( $+functions[git] )) && unfunction git
|
||||
|
||||
# unset other testing zstyles
|
||||
zstyle -d ':antidote:defer' bundle
|
||||
|
||||
# unset rupa/z
|
||||
(( $+aliases[z] )) && unalias z
|
||||
|
||||
# replace .zsh_plugins.txt with real versions
|
||||
local file
|
||||
for file in .zsh_plugins.txt .zsh_plugins.zsh; do
|
||||
[[ -f $ZDOTDIR/$file ]] && command rm -f -- "$ZDOTDIR/$file"
|
||||
[[ -f $testdir/real/$file ]] && command rm -f -- "$testdir/real/$file"
|
||||
done
|
||||
|
||||
# clean out antidote home
|
||||
[[ -d $ANTIDOTE_HOME ]] && command rm -rf -- "$ANTIDOTE_HOME"
|
||||
mkdir -p "$ANTIDOTE_HOME"
|
||||
|
||||
# source antidote
|
||||
source $prjdir/antidote.zsh
|
||||
#}
|
||||
44
.antidote/tests/functions/t_teardown
Normal file
44
.antidote/tests/functions/t_teardown
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
#!/bin/zsh
|
||||
|
||||
#function t_teardown {
|
||||
emulate -L zsh
|
||||
setopt local_options
|
||||
|
||||
# reset current session
|
||||
HOME=$T_PREV_HOME
|
||||
ZDOTDIR=$T_PREV_ZDOTDIR
|
||||
|
||||
# unfunction all antidote
|
||||
for fn in ${(k)functions}; do
|
||||
[[ $fn == *antidote* ]] && unfunction -- $fn
|
||||
done
|
||||
(( $+functions[git] )) && unfunction git
|
||||
|
||||
# unfunction zsh-defer
|
||||
(( $+functions[zsh-defer] )) && unfunction zsh-defer
|
||||
|
||||
# restore original path/fpath
|
||||
path=( $T_PREV_PATH )
|
||||
fpath=( $T_PREV_FPATH )
|
||||
|
||||
# restore original zstyles
|
||||
source <(zstyle -L ':antidote:*' | awk '{print "zstyle -d",$2}')
|
||||
source <(printf '%s\n' $T_PREV_ZSTYLES)
|
||||
|
||||
# remove tempdir
|
||||
[[ -d "$T_TEMPDIR" ]] && command rm -rf -- "$T_TEMPDIR"
|
||||
|
||||
# remove vars
|
||||
for var in \
|
||||
ANTIDOTE_HOME \
|
||||
T_TEMPDIR \
|
||||
T_PREV_HOME \
|
||||
T_PREV_ZDOTDIR \
|
||||
T_PREV_PATH \
|
||||
T_PREV_FPATH \
|
||||
plugins \
|
||||
libs
|
||||
do
|
||||
[[ -v $var ]] && unset $var
|
||||
done
|
||||
#}
|
||||
13
.antidote/tests/functions/t_unload_antidote
Normal file
13
.antidote/tests/functions/t_unload_antidote
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
#!/bin/zsh
|
||||
|
||||
emulate -L zsh
|
||||
setopt local_options
|
||||
|
||||
# unfunction all antidote
|
||||
for fn in ${(k)functions}; do
|
||||
[[ $fn == *antidote* ]] && [[ $fn != t_* ]] && unfunction -- $fn
|
||||
done
|
||||
(( $+functions[git] )) && unfunction git
|
||||
|
||||
# unfunction zsh-defer
|
||||
(( $+functions[zsh-defer] )) && unfunction zsh-defer
|
||||
35
.antidote/tests/test_alt_zsh_defer_bundle.md
Normal file
35
.antidote/tests/test_alt_zsh_defer_bundle.md
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
# antidote test alternative zsh-defer repo
|
||||
|
||||
## Setup
|
||||
|
||||
```zsh
|
||||
% source ./tests/_setup.zsh
|
||||
% source ./antidote.zsh
|
||||
%
|
||||
```
|
||||
|
||||
## Customize zsh-defer
|
||||
|
||||
If the user forks zsh-defer, support setting a zstyle for an alternative repo location.
|
||||
|
||||
### General
|
||||
|
||||
```zsh
|
||||
% zstyle ':antidote:bundle' use-friendly-names on
|
||||
% zstyle ':antidote:defer' bundle 'custom/zsh-defer'
|
||||
% antidote bundle 'zsh-users/zsh-autosuggestions kind:defer' 2>/dev/null
|
||||
if ! (( $+functions[zsh-defer] )); then
|
||||
fpath+=( $HOME/.cache/antidote/custom/zsh-defer )
|
||||
source $HOME/.cache/antidote/custom/zsh-defer/zsh-defer.plugin.zsh
|
||||
fi
|
||||
fpath+=( $HOME/.cache/antidote/zsh-users/zsh-autosuggestions )
|
||||
zsh-defer source $HOME/.cache/antidote/zsh-users/zsh-autosuggestions/zsh-autosuggestions.plugin.zsh
|
||||
%
|
||||
```
|
||||
|
||||
## Teardown
|
||||
|
||||
```zsh
|
||||
% t_teardown
|
||||
%
|
||||
```
|
||||
302
.antidote/tests/test_antidote.md
Normal file
302
.antidote/tests/test_antidote.md
Normal file
|
|
@ -0,0 +1,302 @@
|
|||
# antidote bundle tests
|
||||
|
||||
## Setup
|
||||
|
||||
```zsh
|
||||
% source ./tests/_setup.zsh
|
||||
% source ./antidote.zsh
|
||||
%
|
||||
```
|
||||
|
||||
## Version
|
||||
|
||||
Show antidote's version:
|
||||
|
||||
```zsh
|
||||
% antidote --version
|
||||
antidote version 1.9.7
|
||||
%
|
||||
```
|
||||
|
||||
## Help
|
||||
|
||||
Show antidote's functionality:
|
||||
|
||||
```zsh
|
||||
% antidote --help
|
||||
antidote - the cure to slow zsh plugin management
|
||||
|
||||
usage: antidote [<flags>] <command> [<args> ...]
|
||||
|
||||
flags:
|
||||
-h, --help Show context-sensitive help
|
||||
-v, --version Show application version
|
||||
|
||||
commands:
|
||||
help Show documentation
|
||||
load Statically source all bundles from the plugins file
|
||||
bundle Clone bundle(s) and generate the static load script
|
||||
install Clone a new bundle and add it to your plugins file
|
||||
update Update antidote and its cloned bundles
|
||||
purge Remove a cloned bundle
|
||||
home Print where antidote is cloning bundles
|
||||
list List cloned bundles
|
||||
path Print the path of a cloned bundle
|
||||
init Initialize the shell for dynamic bundles
|
||||
%
|
||||
```
|
||||
|
||||
## Bundling
|
||||
|
||||
Bundle the foo/bar repo using old antibody style directories:
|
||||
|
||||
```zsh
|
||||
% zstyle ':antidote:bundle' use-friendly-names off
|
||||
% antidote bundle foo/bar
|
||||
# antidote cloning foo/bar...
|
||||
fpath+=( $HOME/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-foo-SLASH-bar )
|
||||
source $HOME/.cache/antidote/https-COLON--SLASH--SLASH-github.com-SLASH-foo-SLASH-bar/bar.plugin.zsh
|
||||
%
|
||||
```
|
||||
|
||||
Use new-style directory naming:
|
||||
|
||||
```zsh
|
||||
% zstyle ':antidote:bundle' use-friendly-names on
|
||||
%
|
||||
```
|
||||
|
||||
Bundle a repo at https://github.com/foo/bar
|
||||
|
||||
```zsh
|
||||
% antidote bundle foo/bar
|
||||
fpath+=( $HOME/.cache/antidote/foo/bar )
|
||||
source $HOME/.cache/antidote/foo/bar/bar.plugin.zsh
|
||||
%
|
||||
```
|
||||
|
||||
Bundle a repo at git@bitbucket.org:foo/bar
|
||||
|
||||
```zsh
|
||||
% antidote bundle git@bitbucket.org:foo/bar
|
||||
fpath+=( $HOME/.cache/antidote/foo/bar )
|
||||
source $HOME/.cache/antidote/foo/bar/bar.plugin.zsh
|
||||
%
|
||||
```
|
||||
|
||||
Bundle a specific branch of a repo with `branch:<branch>`.
|
||||
|
||||
```zsh
|
||||
% antidote bundle foo/bar branch:dev
|
||||
fpath+=( $HOME/.cache/antidote/foo/bar )
|
||||
source $HOME/.cache/antidote/foo/bar/bar.plugin.zsh
|
||||
%
|
||||
```
|
||||
|
||||
### Annotations: kind
|
||||
|
||||
Bundles support a `kind:` annotation. The default is `kind:zsh`.
|
||||
|
||||
```zsh
|
||||
% antidote bundle foo/bar kind:zsh
|
||||
fpath+=( $HOME/.cache/antidote/foo/bar )
|
||||
source $HOME/.cache/antidote/foo/bar/bar.plugin.zsh
|
||||
%
|
||||
```
|
||||
|
||||
Bundle foo/bar with `kind:path` to add it to your `$PATH`.
|
||||
|
||||
```zsh
|
||||
% antidote bundle foo/bar kind:path
|
||||
export PATH="$HOME/.cache/antidote/foo/bar:$PATH"
|
||||
%
|
||||
```
|
||||
|
||||
Bundle foo/bar with `kind:fpath` to add it to your `$fpath`.
|
||||
|
||||
```zsh
|
||||
% antidote bundle foo/bar kind:fpath
|
||||
fpath+=( $HOME/.cache/antidote/foo/bar )
|
||||
%
|
||||
```
|
||||
|
||||
Bundle foo/bar with `kind:clone` to just clone the repo, but do nothing to load it.
|
||||
|
||||
```zsh
|
||||
% antidote bundle foo/bar kind:clone
|
||||
%
|
||||
```
|
||||
|
||||
Autoload a path within foo/bar with the `kind:autoload` annotation.
|
||||
|
||||
```zsh
|
||||
% antidote bundle foo/baz kind:autoload path:functions
|
||||
fpath+=( $HOME/.cache/antidote/foo/baz/functions )
|
||||
builtin autoload -Uz $fpath[-1]/*(N.:t)
|
||||
%
|
||||
```
|
||||
|
||||
Defer loading the foo/bar bundle with the `kind:defer` annotation.
|
||||
|
||||
```zsh
|
||||
% antidote bundle foo/baz kind:defer
|
||||
if ! (( $+functions[zsh-defer] )); then
|
||||
fpath+=( $HOME/.cache/antidote/getantidote/zsh-defer )
|
||||
source $HOME/.cache/antidote/getantidote/zsh-defer/zsh-defer.plugin.zsh
|
||||
fi
|
||||
fpath+=( $HOME/.cache/antidote/foo/baz )
|
||||
zsh-defer source $HOME/.cache/antidote/foo/baz/baz.plugin.zsh
|
||||
%
|
||||
```
|
||||
|
||||
### Annotations: path
|
||||
|
||||
Use the `path:<path>` annotation to load subplugins.
|
||||
|
||||
```zsh
|
||||
% antidote bundle ohmy/ohmy path:plugins/docker
|
||||
fpath+=( $HOME/.cache/antidote/ohmy/ohmy/plugins/docker )
|
||||
source $HOME/.cache/antidote/ohmy/ohmy/plugins/docker/docker.plugin.zsh
|
||||
%
|
||||
```
|
||||
|
||||
Use `path:<lib>` to load a whole directory full of files.
|
||||
|
||||
```zsh
|
||||
% antidote bundle ohmy/ohmy path:lib
|
||||
fpath+=( $HOME/.cache/antidote/ohmy/ohmy/lib )
|
||||
source $HOME/.cache/antidote/ohmy/ohmy/lib/lib1.zsh
|
||||
source $HOME/.cache/antidote/ohmy/ohmy/lib/lib2.zsh
|
||||
source $HOME/.cache/antidote/ohmy/ohmy/lib/lib3.zsh
|
||||
%
|
||||
```
|
||||
|
||||
Use `path:<file>` to load a specific file.
|
||||
|
||||
```zsh
|
||||
% antidote bundle ohmy/ohmy path:custom/themes/pretty.zsh-theme
|
||||
source $HOME/.cache/antidote/ohmy/ohmy/custom/themes/pretty.zsh-theme
|
||||
%
|
||||
```
|
||||
|
||||
### Annotations: conditional
|
||||
|
||||
Use a existing boolean function to wrap a bundle in `if` logic:
|
||||
|
||||
```zsh
|
||||
% is-macos() { [[ "$OSTYPE" == "darwin"* ]]; }
|
||||
% antidote bundle foo/bar conditional:is-macos
|
||||
if is-macos; then
|
||||
fpath+=( $HOME/.cache/antidote/foo/bar )
|
||||
source $HOME/.cache/antidote/foo/bar/bar.plugin.zsh
|
||||
fi
|
||||
%
|
||||
```
|
||||
|
||||
## Dynamic bundling
|
||||
|
||||
If you run `source <(antidote init)`, antidote will emit a wrapper so that you can
|
||||
dynamically bundle.
|
||||
|
||||
```zsh
|
||||
% antidote init
|
||||
#!/usr/bin/env zsh
|
||||
function antidote {
|
||||
case "$1" in
|
||||
bundle)
|
||||
source <( antidote-main $@ ) || antidote-main $@
|
||||
;;
|
||||
*)
|
||||
antidote-main $@
|
||||
;;
|
||||
esac
|
||||
}
|
||||
%
|
||||
```
|
||||
|
||||
## Home
|
||||
|
||||
Show where antidote stores its bundles:
|
||||
|
||||
```zsh
|
||||
% antidote home | subenv HOME
|
||||
$HOME/.cache/antidote
|
||||
%
|
||||
```
|
||||
|
||||
## List bundles
|
||||
|
||||
List directories:
|
||||
|
||||
```zsh
|
||||
% antidote list --dirs | subenv HOME
|
||||
$HOME/.cache/antidote/foo/bar
|
||||
$HOME/.cache/antidote/foo/baz
|
||||
$HOME/.cache/antidote/foo/qux
|
||||
$HOME/.cache/antidote/getantidote/zsh-defer
|
||||
$HOME/.cache/antidote/ohmy/ohmy
|
||||
%
|
||||
```
|
||||
|
||||
List repo URLs:
|
||||
|
||||
```zsh
|
||||
% antidote list --url
|
||||
git@github.com:foo/qux
|
||||
https://github.com/foo/bar
|
||||
https://github.com/foo/baz
|
||||
https://github.com/getantidote/zsh-defer
|
||||
https://github.com/ohmy/ohmy
|
||||
%
|
||||
```
|
||||
|
||||
List short repos:
|
||||
|
||||
```zsh
|
||||
% antidote list --short
|
||||
foo/bar
|
||||
foo/baz
|
||||
getantidote/zsh-defer
|
||||
git@github.com:foo/qux
|
||||
ohmy/ohmy
|
||||
%
|
||||
```
|
||||
|
||||
## Bundle paths
|
||||
|
||||
Show the path to a bundle:
|
||||
|
||||
```zsh
|
||||
% ZSH=$(antidote path ohmy/ohmy)
|
||||
% echo $ZSH | subenv HOME
|
||||
$HOME/.cache/antidote/ohmy/ohmy
|
||||
%
|
||||
```
|
||||
|
||||
## Update bundles
|
||||
|
||||
```zsh
|
||||
% antidote update
|
||||
Updating bundles...
|
||||
antidote: checking for updates: https://github.com/foo/bar
|
||||
antidote: checking for updates: https://github.com/foo/baz
|
||||
antidote: checking for updates: git@github.com:foo/qux
|
||||
antidote: checking for updates: https://github.com/getantidote/zsh-defer
|
||||
antidote: checking for updates: https://github.com/ohmy/ohmy
|
||||
Waiting for bundle updates to complete...
|
||||
|
||||
Bundle updates complete.
|
||||
|
||||
Updating antidote...
|
||||
antidote self-update complete.
|
||||
|
||||
antidote version 1.9.7
|
||||
%
|
||||
```
|
||||
|
||||
## Teardown
|
||||
|
||||
```zsh
|
||||
% t_teardown
|
||||
%
|
||||
```
|
||||
135
.antidote/tests/test_antidote_core.md
Normal file
135
.antidote/tests/test_antidote_core.md
Normal file
|
|
@ -0,0 +1,135 @@
|
|||
# antidote core tests
|
||||
|
||||
fails gracefully when someone tries bash
|
||||
|
||||
```zsh
|
||||
% bash -c "source $PWD/antidote.zsh"
|
||||
antidote: Expecting zsh. Found 'bash'.
|
||||
%
|
||||
```
|
||||
|
||||
## Setup
|
||||
|
||||
```zsh
|
||||
% echo $+functions[antidote]
|
||||
0
|
||||
% source ./tests/_setup.zsh
|
||||
% source ./antidote.zsh
|
||||
% echo $+functions[antidote]
|
||||
1
|
||||
% git --version
|
||||
0.0.0
|
||||
%
|
||||
```
|
||||
|
||||
## General
|
||||
|
||||
No args displays help:
|
||||
|
||||
```zsh
|
||||
% antidote
|
||||
antidote - the cure to slow zsh plugin management
|
||||
|
||||
usage: antidote [<flags>] <command> [<args> ...]
|
||||
|
||||
flags:
|
||||
-h, --help Show context-sensitive help
|
||||
-v, --version Show application version
|
||||
|
||||
commands:
|
||||
help Show documentation
|
||||
load Statically source all bundles from the plugins file
|
||||
bundle Clone bundle(s) and generate the static load script
|
||||
install Clone a new bundle and add it to your plugins file
|
||||
update Update antidote and its cloned bundles
|
||||
purge Remove a cloned bundle
|
||||
home Print where antidote is cloning bundles
|
||||
list List cloned bundles
|
||||
path Print the path of a cloned bundle
|
||||
init Initialize the shell for dynamic bundles
|
||||
%
|
||||
```
|
||||
|
||||
No arg exit status is 2:
|
||||
|
||||
```zsh
|
||||
% antidote >/dev/null; err=$?
|
||||
% echo $err
|
||||
2
|
||||
%
|
||||
```
|
||||
|
||||
## Help
|
||||
|
||||
`-h` and `--help` work:
|
||||
|
||||
```zsh
|
||||
% antidote -h >/dev/null; err=$?
|
||||
% echo $err
|
||||
0
|
||||
% antidote --help >/dev/null; err=$?
|
||||
% echo $err
|
||||
0
|
||||
%
|
||||
```
|
||||
|
||||
## Version
|
||||
|
||||
`-v` and `--version` work:
|
||||
|
||||
```zsh
|
||||
% antidote --version
|
||||
antidote version 1.9.7
|
||||
% antidote -v >/dev/null; echo $?
|
||||
0
|
||||
% antidote --version >/dev/null; echo $?
|
||||
0
|
||||
%
|
||||
```
|
||||
|
||||
## Unrecognized options
|
||||
|
||||
```zsh
|
||||
% antidote --foo >/dev/null; err=$? #=> --regex (bad option|command not found)
|
||||
% echo $err
|
||||
1
|
||||
%
|
||||
```
|
||||
|
||||
## Unrecognized commands
|
||||
|
||||
```zsh
|
||||
% antidote foo; err=$?
|
||||
antidote: command not found 'foo'
|
||||
% echo $err
|
||||
1
|
||||
%
|
||||
```
|
||||
|
||||
## All commands
|
||||
|
||||
```zsh
|
||||
% cmds=( bundle help home init install list load path purge update script main null )
|
||||
% for cmd in $cmds; echo $+functions[antidote-$cmd]
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
0
|
||||
%
|
||||
```
|
||||
|
||||
## Teardown
|
||||
|
||||
```zsh
|
||||
% t_teardown
|
||||
%
|
||||
```
|
||||
135
.antidote/tests/test_bundle_helpers.md
Normal file
135
.antidote/tests/test_bundle_helpers.md
Normal file
|
|
@ -0,0 +1,135 @@
|
|||
# antidote bundle helper tests
|
||||
|
||||
## Setup
|
||||
|
||||
```zsh
|
||||
% TESTDATA=$PWD/tests/testdata
|
||||
% source ./tests/_setup.zsh
|
||||
% source ./antidote.zsh
|
||||
% antidote-bundle -h &>/dev/null
|
||||
%
|
||||
```
|
||||
|
||||
## Awk filter repos
|
||||
|
||||
The repo parser pulls a list of all git URLs in a bundle file so that we can clone missing ones in parallel.
|
||||
|
||||
```zsh
|
||||
% __antidote_bulk_clone $TESTDATA/.zsh_plugins_repos.txt
|
||||
antidote-script --kind clone --branch baz foobar/foobar &
|
||||
antidote-script --kind clone bar/baz &
|
||||
antidote-script --kind clone getantidote/zsh-defer &
|
||||
antidote-script --kind clone git@github.com:user/repo &
|
||||
antidote-script --kind clone http://github.com/user/repo.git &
|
||||
antidote-script --kind clone https://github.com/foo/baz &
|
||||
antidote-script --kind clone https://github.com/foo/qux &
|
||||
antidote-script --kind clone https://github.com/user/repo &
|
||||
antidote-script --kind clone user/repo &
|
||||
wait
|
||||
%
|
||||
```
|
||||
|
||||
Test empty
|
||||
|
||||
```zsh
|
||||
% __antidote_bulk_clone $TESTDATA/.zsh_plugins_empty.txt
|
||||
wait
|
||||
%
|
||||
```
|
||||
|
||||
## Awk Filter defers
|
||||
|
||||
Test that only the first defer block is kept...
|
||||
|
||||
```zsh
|
||||
% __antidote_filter_defers $PWD/tests/testdata/.zsh_plugins_multi_defer.zsh | subenv ANTIDOTE_HOME
|
||||
fpath+=( $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-history-substring-search )
|
||||
source $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-history-substring-search/zsh-history-substring-search.plugin.zsh
|
||||
if ! (( $+functions[zsh-defer] )); then
|
||||
fpath+=( $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-getantidote-SLASH-zsh-defer )
|
||||
source $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-getantidote-SLASH-zsh-defer/zsh-defer.plugin.zsh
|
||||
fi
|
||||
fpath+=( $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-syntax-highlighting )
|
||||
zsh-defer source $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-syntax-highlighting/zsh-syntax-highlighting.plugin.zsh
|
||||
if is-macos; then
|
||||
fpath+=( $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-ohmy-SLASH-ohmy/plugins/macos )
|
||||
source $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-ohmy-SLASH-ohmy/plugins/macos/macos.plugin.zsh
|
||||
fi
|
||||
fpath+=( $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-autosuggestions )
|
||||
zsh-defer source $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-autosuggestions/zsh-autosuggestions.plugin.zsh
|
||||
fpath+=( $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-zdharma-continuum-SLASH-fast-syntax-highlighting )
|
||||
zsh-defer source $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-zdharma-continuum-SLASH-fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh
|
||||
fpath+=( $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-dracula-SLASH-zsh )
|
||||
source $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-dracula-SLASH-zsh/dracula.zsh-theme
|
||||
fpath+=( $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-peterhurford-SLASH-up.zsh )
|
||||
source $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-peterhurford-SLASH-up.zsh/up.plugin.zsh
|
||||
fpath+=( $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-rummik-SLASH-zsh-tailf )
|
||||
source $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-rummik-SLASH-zsh-tailf/tailf.plugin.zsh
|
||||
fpath+=( $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-rupa-SLASH-z )
|
||||
source $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-rupa-SLASH-z/z.sh
|
||||
%
|
||||
```
|
||||
|
||||
Test that with no defers, nothing is altered...
|
||||
|
||||
```zsh
|
||||
% __antidote_filter_defers $PWD/tests/testdata/.zsh_plugins_no_defer.zsh #=> --file testdata/.zsh_plugins_no_defer.zsh
|
||||
%
|
||||
```
|
||||
|
||||
## Awk Bundle parser
|
||||
|
||||
Parse a simple repo:
|
||||
|
||||
```zsh
|
||||
% echo foo/bar | __antidote_parse_bundles
|
||||
antidote-script foo/bar
|
||||
%
|
||||
```
|
||||
|
||||
```zsh
|
||||
% echo 'https://github.com/foo/bar path:lib branch:dev' | __antidote_parse_bundles
|
||||
antidote-script --path lib --branch dev https://github.com/foo/bar
|
||||
% echo 'git@github.com:foo/bar.git kind:clone branch:main' | __antidote_parse_bundles
|
||||
antidote-script --kind clone --branch main git@github.com:foo/bar.git
|
||||
% echo 'foo/bar kind:fpath abc:xyz' | __antidote_parse_bundles
|
||||
antidote-script --kind fpath --abc xyz foo/bar
|
||||
% echo 'foo/bar path:plugins/myplugin kind:path # trailing comment' | __antidote_parse_bundles
|
||||
antidote-script --path plugins/myplugin --kind path foo/bar
|
||||
%
|
||||
```
|
||||
|
||||
Handle funky whitespace
|
||||
|
||||
```zsh
|
||||
% cr=$'\r'; lf=$'\n'; tab=$'\t'
|
||||
% echo "foo/bar${tab}kind:path${cr}${lf}" | __antidote_parse_bundles
|
||||
antidote-script --kind path foo/bar
|
||||
%
|
||||
```
|
||||
|
||||
The bundle parser is an awk script that turns the bundle DSL into antidote-script statements.
|
||||
|
||||
```zsh
|
||||
% __antidote_parse_bundles $ZDOTDIR/.zsh_plugins.txt
|
||||
antidote-script ~/foo/bar
|
||||
antidote-script --path plugins/myplugin \$ZSH_CUSTOM
|
||||
antidote-script foo/bar
|
||||
antidote-script git@github.com:foo/qux.git
|
||||
antidote-script --kind clone getantidote/zsh-defer
|
||||
antidote-script --kind zsh foo/bar
|
||||
antidote-script --kind fpath foo/bar
|
||||
antidote-script --kind path foo/bar
|
||||
antidote-script --path lib ohmy/ohmy
|
||||
antidote-script --path plugins/extract ohmy/ohmy
|
||||
antidote-script --path plugins/magic-enter --kind defer ohmy/ohmy
|
||||
antidote-script --path custom/themes/pretty.zsh-theme ohmy/ohmy
|
||||
%
|
||||
```
|
||||
|
||||
## Teardown
|
||||
|
||||
```zsh
|
||||
% t_teardown
|
||||
%
|
||||
```
|
||||
62
.antidote/tests/test_cmd_bundle.md
Normal file
62
.antidote/tests/test_cmd_bundle.md
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
# antidote bundle helper tests
|
||||
|
||||
## Setup
|
||||
|
||||
```zsh
|
||||
% source ./tests/_setup.zsh
|
||||
% source ./antidote.zsh
|
||||
%
|
||||
```
|
||||
|
||||
## Test bundle command
|
||||
|
||||
Many 'bundle' tests could just as well just be 'script' tests, so we rely on
|
||||
'test_script.md' to find scripting issues and use this to test actual bundling,
|
||||
or things not handled by 'antidote script'. You can think of 'antidote script' as
|
||||
handling a single bundle, and 'antidote bundle' handling them in bulk.
|
||||
|
||||
### General
|
||||
|
||||
```zsh
|
||||
% # antidote bundle
|
||||
%
|
||||
```
|
||||
|
||||
```zsh
|
||||
% antidote bundle <$ZDOTDIR/.zsh_plugins.txt >$ZDOTDIR/.zsh_plugins.zsh
|
||||
% cat $ZDOTDIR/.zsh_plugins.zsh | subenv #=> --file testdata/.zsh_plugins.zsh
|
||||
%
|
||||
```
|
||||
|
||||
### Multiple ways to call bundle
|
||||
|
||||
Test \|piping, \<redirection, and --args
|
||||
|
||||
```zsh
|
||||
% zstyle ':antidote:bundle' use-friendly-names off
|
||||
% ANTIDOTE_HOME=$HOME/.cache/antibody
|
||||
% antidote bundle foo/bar | subenv ANTIDOTE_HOME #=> --file testdata/script-foobar.zsh
|
||||
% echo 'foo/bar' | antidote bundle | subenv ANTIDOTE_HOME #=> --file testdata/script-foobar.zsh
|
||||
% echo 'foo/bar' >$ZDOTDIR/.zsh_plugins_simple.txt
|
||||
% antidote bundle <$ZDOTDIR/.zsh_plugins_simple.txt | subenv ANTIDOTE_HOME #=> --file testdata/script-foobar.zsh
|
||||
% zstyle ':antidote:bundle' use-friendly-names on
|
||||
% ANTIDOTE_HOME=$HOME/.cache/antidote
|
||||
%
|
||||
```
|
||||
|
||||
## Fails
|
||||
|
||||
```zsh
|
||||
% echo "foo/bar\nfoo/baz kind:whoops" | antidote bundle 2>&1 | subenv ANTIDOTE_HOME
|
||||
antidote: error: unexpected kind value: 'whoops'
|
||||
fpath+=( $ANTIDOTE_HOME/foo/bar )
|
||||
source $ANTIDOTE_HOME/foo/bar/bar.plugin.zsh
|
||||
%
|
||||
```
|
||||
|
||||
## Teardown
|
||||
|
||||
```zsh
|
||||
% t_teardown
|
||||
%
|
||||
```
|
||||
185
.antidote/tests/test_cmd_help.md
Normal file
185
.antidote/tests/test_cmd_help.md
Normal file
|
|
@ -0,0 +1,185 @@
|
|||
# antidote help tests
|
||||
|
||||
## Setup
|
||||
|
||||
```zsh
|
||||
% source ./tests/_setup.zsh
|
||||
% source ./antidote.zsh
|
||||
%
|
||||
```
|
||||
|
||||
## General
|
||||
|
||||
`antidote help` command exists
|
||||
|
||||
```zsh
|
||||
% antidote help &>/dev/null; echo $?
|
||||
0
|
||||
%
|
||||
```
|
||||
|
||||
`antidote --h/--help` works
|
||||
|
||||
```zsh
|
||||
% antidote -h &>/dev/null; echo $?
|
||||
0
|
||||
% antidote --help &>/dev/null; echo $?
|
||||
0
|
||||
%
|
||||
```
|
||||
|
||||
`antidote` man pages work
|
||||
|
||||
```zsh
|
||||
% PAGER=cat man antidote | head -n 1 | sed 's/ */ /g'
|
||||
antidote(1) Antidote Manual antidote(1)
|
||||
%
|
||||
```
|
||||
|
||||
`antidote` man pages are in `$MANPATH`
|
||||
```zsh
|
||||
% [[ "$MANPATH" == *"$PWD/man:"* ]] || echo 'MANPATH not set properly'
|
||||
%
|
||||
```
|
||||
|
||||
## antidote-bundle
|
||||
|
||||
```zsh
|
||||
% antidote help bundle | head -n 1 | sed 's/ */ /g'
|
||||
antidote-bundle(1) Antidote Manual antidote-bundle(1)
|
||||
% antidote bundle --help | head -n 1 | sed 's/ */ /g'
|
||||
antidote-bundle(1) Antidote Manual antidote-bundle(1)
|
||||
% antidote bundle -h | head -n 1 | sed 's/ */ /g'
|
||||
antidote-bundle(1) Antidote Manual antidote-bundle(1)
|
||||
%
|
||||
```
|
||||
|
||||
## antidote-help
|
||||
|
||||
```zsh
|
||||
% antidote help help | head -n 1 | sed 's/ */ /g'
|
||||
antidote-help(1) Antidote Manual antidote-help(1)
|
||||
% antidote help --help | head -n 1 | sed 's/ */ /g'
|
||||
antidote-help(1) Antidote Manual antidote-help(1)
|
||||
% antidote help -h | head -n 1 | sed 's/ */ /g'
|
||||
antidote-help(1) Antidote Manual antidote-help(1)
|
||||
%
|
||||
```
|
||||
|
||||
## antidote-home
|
||||
|
||||
```zsh
|
||||
% antidote help home | head -n 1 | sed 's/ */ /g'
|
||||
antidote-home(1) Antidote Manual antidote-home(1)
|
||||
% antidote home --help | head -n 1 | sed 's/ */ /g'
|
||||
antidote-home(1) Antidote Manual antidote-home(1)
|
||||
% antidote home -h | head -n 1 | sed 's/ */ /g'
|
||||
antidote-home(1) Antidote Manual antidote-home(1)
|
||||
%
|
||||
```
|
||||
|
||||
## antidote-init
|
||||
|
||||
```zsh
|
||||
% antidote help init | head -n 1 | sed 's/ */ /g'
|
||||
antidote-init(1) Antidote Manual antidote-init(1)
|
||||
% antidote init --help | head -n 1 | sed 's/ */ /g'
|
||||
antidote-init(1) Antidote Manual antidote-init(1)
|
||||
% antidote init -h | head -n 1 | sed 's/ */ /g'
|
||||
antidote-init(1) Antidote Manual antidote-init(1)
|
||||
%
|
||||
```
|
||||
|
||||
## antidote-install
|
||||
|
||||
```zsh
|
||||
% antidote help install | head -n 1 | sed 's/ */ /g'
|
||||
antidote-install(1) Antidote Manual antidote-install(1)
|
||||
% antidote install --help | head -n 1 | sed 's/ */ /g'
|
||||
antidote-install(1) Antidote Manual antidote-install(1)
|
||||
% antidote install -h | head -n 1 | sed 's/ */ /g'
|
||||
antidote-install(1) Antidote Manual antidote-install(1)
|
||||
%
|
||||
```
|
||||
|
||||
## antidote-list
|
||||
|
||||
```zsh
|
||||
% antidote help list | head -n 1 | sed 's/ */ /g'
|
||||
antidote-list(1) Antidote Manual antidote-list(1)
|
||||
% antidote list --help | head -n 1 | sed 's/ */ /g'
|
||||
antidote-list(1) Antidote Manual antidote-list(1)
|
||||
% antidote list -h | head -n 1 | sed 's/ */ /g'
|
||||
antidote-list(1) Antidote Manual antidote-list(1)
|
||||
%
|
||||
```
|
||||
|
||||
## antidote-load
|
||||
|
||||
```zsh
|
||||
% antidote help load | head -n 1 | sed 's/ */ /g'
|
||||
antidote-load(1) Antidote Manual antidote-load(1)
|
||||
% antidote load --help | head -n 1 | sed 's/ */ /g'
|
||||
antidote-load(1) Antidote Manual antidote-load(1)
|
||||
% antidote load -h | head -n 1 | sed 's/ */ /g'
|
||||
antidote-load(1) Antidote Manual antidote-load(1)
|
||||
%
|
||||
```
|
||||
|
||||
## antidote-path
|
||||
|
||||
```zsh
|
||||
% antidote help path | head -n 1 | sed 's/ */ /g'
|
||||
antidote-path(1) Antidote Manual antidote-path(1)
|
||||
% antidote path --help | head -n 1 | sed 's/ */ /g'
|
||||
antidote-path(1) Antidote Manual antidote-path(1)
|
||||
% antidote path -h | head -n 1 | sed 's/ */ /g'
|
||||
antidote-path(1) Antidote Manual antidote-path(1)
|
||||
%
|
||||
```
|
||||
|
||||
## antidote-update
|
||||
|
||||
```zsh
|
||||
% antidote help update | head -n 1 | sed 's/ */ /g'
|
||||
antidote-update(1) Antidote Manual antidote-update(1)
|
||||
% antidote update --help | head -n 1 | sed 's/ */ /g'
|
||||
antidote-update(1) Antidote Manual antidote-update(1)
|
||||
% antidote update -h | head -n 1 | sed 's/ */ /g'
|
||||
antidote-update(1) Antidote Manual antidote-update(1)
|
||||
%
|
||||
```
|
||||
|
||||
## antidote-script
|
||||
|
||||
```zsh
|
||||
% antidote help script
|
||||
No manual entry for antidote-script
|
||||
antidote - the cure to slow zsh plugin management
|
||||
|
||||
usage: antidote [<flags>] <command> [<args> ...]
|
||||
|
||||
flags:
|
||||
-h, --help Show context-sensitive help
|
||||
-v, --version Show application version
|
||||
|
||||
commands:
|
||||
help Show documentation
|
||||
load Statically source all bundles from the plugins file
|
||||
bundle Clone bundle(s) and generate the static load script
|
||||
install Clone a new bundle and add it to your plugins file
|
||||
update Update antidote and its cloned bundles
|
||||
purge Remove a cloned bundle
|
||||
home Print where antidote is cloning bundles
|
||||
list List cloned bundles
|
||||
path Print the path of a cloned bundle
|
||||
init Initialize the shell for dynamic bundles
|
||||
%
|
||||
```
|
||||
|
||||
## Teardown
|
||||
|
||||
```zsh
|
||||
% t_teardown
|
||||
%
|
||||
```
|
||||
95
.antidote/tests/test_cmd_home.md
Normal file
95
.antidote/tests/test_cmd_home.md
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
# antidote home tests
|
||||
|
||||
## Setup
|
||||
|
||||
```zsh
|
||||
% source ./tests/_setup.zsh
|
||||
% source ./antidote.zsh
|
||||
%
|
||||
```
|
||||
|
||||
## General
|
||||
|
||||
`antidote home` command exists
|
||||
|
||||
```zsh
|
||||
% antidote home &>/dev/null; echo $?
|
||||
0
|
||||
%
|
||||
```
|
||||
|
||||
`antidote home --h/--help` works
|
||||
|
||||
```zsh
|
||||
% antidote home -h &>/dev/null; echo $?
|
||||
0
|
||||
% antidote home --help &>/dev/null; echo $?
|
||||
0
|
||||
%
|
||||
```
|
||||
|
||||
`$ANTIDOTE_HOME` is used if set...
|
||||
|
||||
```zsh
|
||||
% ANTIDOTE_HOME=$HOME/.cache/antidote
|
||||
% antidote home | subenv HOME
|
||||
$HOME/.cache/antidote
|
||||
% unset ANTIDOTE_HOME
|
||||
%
|
||||
```
|
||||
|
||||
`antidote home` is `~/Library/Caches/antidote` on macOS
|
||||
|
||||
```zsh
|
||||
% OLD_OSTYPE=$OSTYPE; OSTYPE=darwin21.3.0
|
||||
% antidote home | subenv HOME
|
||||
$HOME/Library/Caches/antidote
|
||||
% OSTYPE=$OLD_OSTYPE
|
||||
%
|
||||
```
|
||||
|
||||
`antidote home` is `$LOCALAPPDATA/antidote` on msys
|
||||
|
||||
```zsh
|
||||
% OLD_OSTYPE=$OSTYPE; OSTYPE=msys
|
||||
% LOCALAPPDATA=$HOME/AppData
|
||||
% antidote home | subenv HOME
|
||||
$HOME/AppData/antidote
|
||||
% OSTYPE=$OLD_OSTYPE
|
||||
%
|
||||
```
|
||||
|
||||
`antidote home` uses `$XDG_CACHE_HOME` on an OS that defines it.
|
||||
|
||||
```zsh
|
||||
% # Setup
|
||||
% OLD_OSTYPE=$OSTYPE; OSTYPE=foobar
|
||||
% OLD_XDG_CACHE_HOME=$XDG_CACHE_HOME; XDG_CACHE_HOME=$HOME/.xdg-cache
|
||||
% # Run test
|
||||
% antidote home | subenv XDG_CACHE_HOME
|
||||
$XDG_CACHE_HOME/antidote
|
||||
% # Teardown
|
||||
% OSTYPE=$OLD_OSTYPE; XDG_CACHE_HOME=$OLD_XDG_CACHE_HOME
|
||||
%
|
||||
```
|
||||
|
||||
`antidote home` uses `$HOME/.cache` otherwise.
|
||||
|
||||
```zsh
|
||||
% # Setup
|
||||
% OLD_OSTYPE=$OSTYPE; OSTYPE=foobar
|
||||
% OLD_XDG_CACHE_HOME=$XDG_CACHE_HOME; XDG_CACHE_HOME=
|
||||
% # Run test
|
||||
% antidote home | subenv HOME
|
||||
$HOME/.cache/antidote
|
||||
% # Teardown
|
||||
% OSTYPE=$OLD_OSTYPE; XDG_CACHE_HOME=$OLD_XDG_CACHE_HOME
|
||||
%
|
||||
```
|
||||
|
||||
## Teardown
|
||||
|
||||
```zsh
|
||||
% t_teardown
|
||||
%
|
||||
```
|
||||
54
.antidote/tests/test_cmd_init.md
Normal file
54
.antidote/tests/test_cmd_init.md
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
# antidote init tests
|
||||
|
||||
## Setup
|
||||
|
||||
```zsh
|
||||
% source ./tests/_setup.zsh
|
||||
% source ./antidote.zsh
|
||||
%
|
||||
```
|
||||
|
||||
## Init
|
||||
|
||||
```zsh
|
||||
% antidote init
|
||||
#!/usr/bin/env zsh
|
||||
function antidote {
|
||||
case "$1" in
|
||||
bundle)
|
||||
source <( antidote-main $@ ) || antidote-main $@
|
||||
;;
|
||||
*)
|
||||
antidote-main $@
|
||||
;;
|
||||
esac
|
||||
}
|
||||
%
|
||||
```
|
||||
|
||||
Load plugins dynamically
|
||||
|
||||
```zsh
|
||||
% source <(antidote init)
|
||||
% antidote bundle foo/bar
|
||||
sourcing foo/bar...
|
||||
% antidote bundle foo/baz autoload:functions
|
||||
sourcing foo/baz...
|
||||
% antidote bundle $ZDOTDIR/custom/lib
|
||||
sourcing custom lib1.zsh...
|
||||
sourcing custom lib2.zsh...
|
||||
% echo $#plugins
|
||||
2
|
||||
% echo $#libs
|
||||
2
|
||||
% echo $+functions[baz]
|
||||
1
|
||||
%
|
||||
```
|
||||
|
||||
## Teardown
|
||||
|
||||
```zsh
|
||||
% t_teardown
|
||||
%
|
||||
```
|
||||
59
.antidote/tests/test_cmd_install.md
Normal file
59
.antidote/tests/test_cmd_install.md
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
# antidote installs tests
|
||||
|
||||
## Setup
|
||||
|
||||
```zsh
|
||||
% source ./tests/_setup.zsh
|
||||
% source ./antidote.zsh
|
||||
%
|
||||
```
|
||||
|
||||
## Install Command
|
||||
|
||||
`antidote install` requires a `<bundle>` argument.
|
||||
|
||||
```zsh
|
||||
% antidote install #=> --exit 1
|
||||
antidote: error: required argument 'bundle' not provided, try --help
|
||||
%
|
||||
```
|
||||
|
||||
Trying to install an existing bundle fails.
|
||||
|
||||
```zsh
|
||||
% antidote install foo/bar &>/dev/null #=> --exit 1
|
||||
% antidote install foo/bar 2>&1 | subenv ANTIDOTE_HOME >&2
|
||||
antidote: error: foo/bar already installed: $ANTIDOTE_HOME/foo/bar
|
||||
%
|
||||
```
|
||||
|
||||
Install a bundle
|
||||
|
||||
```zsh
|
||||
% antidote install rupa/z | subenv ZDOTDIR
|
||||
# antidote cloning rupa/z...
|
||||
Adding bundle to '$ZDOTDIR/.zsh_plugins.txt':
|
||||
rupa/z
|
||||
% tail -n 1 $ZDOTDIR/.zsh_plugins.txt
|
||||
rupa/z
|
||||
%
|
||||
```
|
||||
|
||||
Install a complicated bundle
|
||||
|
||||
```zsh
|
||||
% antidote install --path plugins/macos --conditional is-macos ohmyzsh/ohmyzsh | subenv ZDOTDIR
|
||||
# antidote cloning ohmyzsh/ohmyzsh...
|
||||
Adding bundle to '$ZDOTDIR/.zsh_plugins.txt':
|
||||
ohmyzsh/ohmyzsh path:plugins/macos conditional:is-macos
|
||||
% tail -n 1 $ZDOTDIR/.zsh_plugins.txt
|
||||
ohmyzsh/ohmyzsh path:plugins/macos conditional:is-macos
|
||||
%
|
||||
```
|
||||
|
||||
## Teardown
|
||||
|
||||
```zsh
|
||||
% t_teardown
|
||||
%
|
||||
```
|
||||
74
.antidote/tests/test_cmd_list.md
Normal file
74
.antidote/tests/test_cmd_list.md
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
# antidote list tests
|
||||
|
||||
## Setup
|
||||
|
||||
```zsh
|
||||
% source ./tests/_setup.zsh
|
||||
% source ./antidote.zsh
|
||||
%
|
||||
```
|
||||
|
||||
## List Command
|
||||
|
||||
### Short
|
||||
|
||||
`antidote list --short`
|
||||
|
||||
```zsh
|
||||
% antidote list --short | subenv ANTIDOTE_HOME
|
||||
foo/bar
|
||||
foo/baz
|
||||
getantidote/zsh-defer
|
||||
git@github.com:foo/qux
|
||||
ohmy/ohmy
|
||||
%
|
||||
```
|
||||
|
||||
### Directories
|
||||
|
||||
`antidote list --dirs`
|
||||
|
||||
```zsh
|
||||
% antidote list --dirs | subenv ANTIDOTE_HOME
|
||||
$ANTIDOTE_HOME/foo/bar
|
||||
$ANTIDOTE_HOME/foo/baz
|
||||
$ANTIDOTE_HOME/foo/qux
|
||||
$ANTIDOTE_HOME/getantidote/zsh-defer
|
||||
$ANTIDOTE_HOME/ohmy/ohmy
|
||||
%
|
||||
```
|
||||
|
||||
### URLs
|
||||
|
||||
`antidote list --url`
|
||||
|
||||
```zsh
|
||||
% antidote list --url
|
||||
git@github.com:foo/qux
|
||||
https://github.com/foo/bar
|
||||
https://github.com/foo/baz
|
||||
https://github.com/getantidote/zsh-defer
|
||||
https://github.com/ohmy/ohmy
|
||||
%
|
||||
```
|
||||
|
||||
### Full
|
||||
|
||||
`antidote list`
|
||||
|
||||
```zsh
|
||||
% antidote list | subenv ANTIDOTE_HOME
|
||||
git@github.com:foo/qux $ANTIDOTE_HOME/foo/qux
|
||||
https://github.com/foo/bar $ANTIDOTE_HOME/foo/bar
|
||||
https://github.com/foo/baz $ANTIDOTE_HOME/foo/baz
|
||||
https://github.com/getantidote/zsh-defer $ANTIDOTE_HOME/getantidote/zsh-defer
|
||||
https://github.com/ohmy/ohmy $ANTIDOTE_HOME/ohmy/ohmy
|
||||
%
|
||||
```
|
||||
|
||||
## Teardown
|
||||
|
||||
```zsh
|
||||
% t_teardown
|
||||
%
|
||||
```
|
||||
67
.antidote/tests/test_cmd_load.md
Normal file
67
.antidote/tests/test_cmd_load.md
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
# antidote load tests
|
||||
|
||||
## Setup
|
||||
|
||||
```zsh
|
||||
% source ./tests/_setup.zsh
|
||||
% source ./antidote.zsh
|
||||
%
|
||||
```
|
||||
|
||||
### General
|
||||
|
||||
```zsh
|
||||
% antidote load $ZDOTDIR/.zplugins_fake_load
|
||||
sourcing foo/bar...
|
||||
sourcing foo/qux...
|
||||
sourcing foo/bar...
|
||||
sourcing ohmy/lib/lib1.zsh...
|
||||
sourcing ohmy/lib/lib2.zsh...
|
||||
sourcing ohmy/lib/lib3.zsh...
|
||||
sourcing extract.plugin.zsh...
|
||||
sourcing docker.plugin.zsh...
|
||||
sourcing docker.plugin.zsh...
|
||||
sourcing getantidote/zsh-defer...
|
||||
sourcing magic-enter.plugin.zsh...
|
||||
sourcing pretty.zsh-theme...
|
||||
% cat $ZDOTDIR/.zplugins_fake_load.zsh | subenv #=> --file testdata/.zplugins_fake_load.zsh
|
||||
% # cleanup
|
||||
% t_reset
|
||||
%
|
||||
```
|
||||
|
||||
### zstyles
|
||||
|
||||
```zsh
|
||||
% cp $ZDOTDIR/.zplugins_fake_load $ZDOTDIR/.zplugins.txt
|
||||
% zstyle ':antidote:bundle' file $ZDOTDIR/.zplugins.txt
|
||||
% zstyle ':antidote:static' file $ZDOTDIR/.zplugins.txt
|
||||
% # the static file should be different
|
||||
% antidote load 2>&1 | subenv ZDOTDIR
|
||||
antidote: bundle file and static file are the same '$ZDOTDIR/.zplugins.txt'.
|
||||
% # fixed...
|
||||
% zstyle ':antidote:static' file $ZDOTDIR/.zplugins.static.zsh
|
||||
% # the static file should be different
|
||||
% antidote load
|
||||
sourcing foo/bar...
|
||||
sourcing foo/qux...
|
||||
sourcing foo/bar...
|
||||
sourcing ohmy/lib/lib1.zsh...
|
||||
sourcing ohmy/lib/lib2.zsh...
|
||||
sourcing ohmy/lib/lib3.zsh...
|
||||
sourcing extract.plugin.zsh...
|
||||
sourcing docker.plugin.zsh...
|
||||
sourcing docker.plugin.zsh...
|
||||
sourcing getantidote/zsh-defer...
|
||||
sourcing magic-enter.plugin.zsh...
|
||||
sourcing pretty.zsh-theme...
|
||||
% cat $ZDOTDIR/.zplugins.static.zsh | subenv #=> --file testdata/.zplugins_fake_load.zsh
|
||||
%
|
||||
```
|
||||
|
||||
## Teardown
|
||||
|
||||
```zsh
|
||||
% t_teardown
|
||||
%
|
||||
```
|
||||
57
.antidote/tests/test_cmd_main.md
Normal file
57
.antidote/tests/test_cmd_main.md
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
# antidote main tests
|
||||
|
||||
## Setup
|
||||
|
||||
```zsh
|
||||
% source ./tests/_setup.zsh
|
||||
% source ./antidote.zsh
|
||||
%
|
||||
```
|
||||
|
||||
## Test main
|
||||
|
||||
Main is core to everything, so we don't need to test much here.
|
||||
|
||||
```zsh
|
||||
% antidote-main --version &>/dev/null #=> --exit 0
|
||||
%
|
||||
```
|
||||
|
||||
## Lazy config
|
||||
|
||||
Tests for lazy-loading antidote.
|
||||
|
||||
- Fix [#54](https://github.com/mattmc3/antidote/issues/54)
|
||||
|
||||
```zsh
|
||||
% # Unload antidote
|
||||
% echo $+functions[antidote-main]
|
||||
1
|
||||
% t_unload_antidote
|
||||
% echo $+functions[antidote-main]
|
||||
0
|
||||
% # Now, lazy load it and make sure it works
|
||||
% autoload -Uz $PWD/antidote
|
||||
% antidote -v &>/dev/null; echo $?
|
||||
0
|
||||
% # Now, tear down again
|
||||
% echo $+functions[antidote-main]
|
||||
1
|
||||
% t_unload_antidote
|
||||
% echo $+functions[antidote-main]
|
||||
0
|
||||
% # Now, lazy load from the functions dir
|
||||
% autoload -Uz $PWD/functions/antidote
|
||||
% antidote -v &>/dev/null; echo $?
|
||||
0
|
||||
% echo $+functions[antidote-main]
|
||||
1
|
||||
%
|
||||
```
|
||||
|
||||
## Teardown
|
||||
|
||||
```zsh
|
||||
% t_teardown
|
||||
%
|
||||
```
|
||||
59
.antidote/tests/test_cmd_path.md
Normal file
59
.antidote/tests/test_cmd_path.md
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
# antidote path tests
|
||||
|
||||
## Setup
|
||||
|
||||
```zsh
|
||||
% source ./tests/_setup.zsh
|
||||
% source ./antidote.zsh
|
||||
%
|
||||
```
|
||||
|
||||
## Path Command
|
||||
|
||||
`antidote-path` prints path to bundle.
|
||||
|
||||
```zsh
|
||||
% antidote path foo/bar &>/dev/null #=> --exit 0
|
||||
% antidote path foo/bar | subenv ANTIDOTE_HOME
|
||||
$ANTIDOTE_HOME/foo/bar
|
||||
%
|
||||
```
|
||||
|
||||
`antidote-path` fails on missing bundles
|
||||
|
||||
```zsh
|
||||
% antidote path bar/foo &>/dev/null #=> --exit 1
|
||||
% antidote path bar/foo; err=$?
|
||||
antidote: error: bar/foo does not exist in cloned paths
|
||||
% echo $err
|
||||
1
|
||||
%
|
||||
```
|
||||
|
||||
`antidote-path` accepts piped input
|
||||
|
||||
```zsh
|
||||
% antidote list -s | antidote path | sort | subenv ANTIDOTE_HOME
|
||||
$ANTIDOTE_HOME/foo/bar
|
||||
$ANTIDOTE_HOME/foo/baz
|
||||
$ANTIDOTE_HOME/foo/qux
|
||||
$ANTIDOTE_HOME/getantidote/zsh-defer
|
||||
$ANTIDOTE_HOME/ohmy/ohmy
|
||||
%
|
||||
```
|
||||
|
||||
`antidote-path` expands vars
|
||||
|
||||
```zsh
|
||||
% ZSH_CUSTOM=$ZDOTDIR/custom
|
||||
% antidote path '$ZSH_CUSTOM/plugins/myplugin' | subenv
|
||||
$HOME/.zsh/custom/plugins/myplugin
|
||||
%
|
||||
```
|
||||
|
||||
## Teardown
|
||||
|
||||
```zsh
|
||||
% t_teardown
|
||||
%
|
||||
```
|
||||
78
.antidote/tests/test_cmd_purge.md
Normal file
78
.antidote/tests/test_cmd_purge.md
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
# antidote purge tests
|
||||
|
||||
## Setup
|
||||
|
||||
```zsh
|
||||
% source ./tests/_setup.zsh
|
||||
% source ./antidote.zsh
|
||||
%
|
||||
```
|
||||
|
||||
## Purge Command
|
||||
|
||||
`antidote purge` requires a `<bundle>` argument.
|
||||
|
||||
```zsh
|
||||
% antidote purge &>/dev/null #=> --exit 1
|
||||
% antidote purge
|
||||
antidote: error: required argument 'bundle' not provided, try --help
|
||||
%
|
||||
```
|
||||
|
||||
Trying to purge a missing bundle fails.
|
||||
|
||||
```zsh
|
||||
% antidote purge bar/foo &>/dev/null #=> --exit 1
|
||||
% antidote purge bar/foo 2>&1 | subenv ANTIDOTE_HOME >&2
|
||||
antidote: error: bar/foo does not exist at the expected location: $ANTIDOTE_HOME/bar/foo
|
||||
%
|
||||
```
|
||||
|
||||
Purging a bundle deletes the directory and comments out instances of the bundle in `.zsh_plugins.txt`.
|
||||
|
||||
```zsh
|
||||
% # bundle dir exists
|
||||
% bundledir=$ANTIDOTE_HOME/foo/bar
|
||||
% test -d $bundledir #=> --exit 0
|
||||
% # purge works
|
||||
% antidote purge foo/bar | subenv ZDOTDIR
|
||||
Removed 'foo/bar'.
|
||||
Bundle 'foo/bar' was commented out in '$ZDOTDIR/.zsh_plugins.txt'.
|
||||
% # bundle dir was removed
|
||||
% test -d $bundledir #=> --exit 1
|
||||
% cat $ZDOTDIR/.zsh_plugins.txt #=> --file ./testdata/.zsh_plugins_purged.txt
|
||||
%
|
||||
```
|
||||
|
||||
Test that `antidote purge --all` aborts when told "no".
|
||||
|
||||
```zsh
|
||||
% function test_exists { [[ -e "$1" ]] }
|
||||
% zstyle ':antidote:purge:all' answer 'n'
|
||||
% antidote purge --all #=> --exit 1
|
||||
% antidote list | subenv ANTIDOTE_HOME
|
||||
git@github.com:foo/qux $ANTIDOTE_HOME/foo/qux
|
||||
https://github.com/foo/baz $ANTIDOTE_HOME/foo/baz
|
||||
https://github.com/getantidote/zsh-defer $ANTIDOTE_HOME/getantidote/zsh-defer
|
||||
https://github.com/ohmy/ohmy $ANTIDOTE_HOME/ohmy/ohmy
|
||||
%
|
||||
```
|
||||
|
||||
Test that `antidote purge --all` does the work when told "yes".
|
||||
|
||||
```zsh
|
||||
% function test_exists { [[ -e "$1" ]] }
|
||||
% zstyle ':antidote:purge:all' answer 'y'
|
||||
% antidote purge --all | tail -n 1
|
||||
Antidote purge complete. Be sure to start a new Zsh session.
|
||||
% antidote list | wc -l | awk '{print $1}'
|
||||
0
|
||||
%
|
||||
```
|
||||
|
||||
## Teardown
|
||||
|
||||
```zsh
|
||||
% t_teardown
|
||||
%
|
||||
```
|
||||
377
.antidote/tests/test_cmd_script.md
Normal file
377
.antidote/tests/test_cmd_script.md
Normal file
|
|
@ -0,0 +1,377 @@
|
|||
# antidote-script tests
|
||||
|
||||
## Setup
|
||||
|
||||
```zsh
|
||||
% source ./tests/_setup.zsh
|
||||
% source ./antidote.zsh
|
||||
%
|
||||
```
|
||||
|
||||
## Script Command
|
||||
|
||||
### Fails
|
||||
|
||||
```zsh
|
||||
% antidote-script #=> --exit 1
|
||||
antidote: error: bundle argument expected
|
||||
%
|
||||
```
|
||||
|
||||
### Arg style
|
||||
|
||||
`antidote-script` accepts '--arg val', '--arg:val', '--arg=val' syntax
|
||||
|
||||
```zsh
|
||||
% antidote-script --kind zsh foo/bar #=> --exit 0
|
||||
% antidote-script --kind:zsh foo/bar #=> --exit 0
|
||||
% antidote-script --kind=zsh foo/bar #=> --exit 0
|
||||
% antidote-script --kind+zsh foo/bar #=> --exit 1
|
||||
%
|
||||
```
|
||||
|
||||
### Scripting types
|
||||
|
||||
`antidote-script` works with local files and directories, as well as remote repos.
|
||||
|
||||
Script a file:
|
||||
|
||||
```zsh
|
||||
% antidote-script $ZDOTDIR/aliases.zsh | subenv ZDOTDIR
|
||||
source $ZDOTDIR/aliases.zsh
|
||||
%
|
||||
```
|
||||
|
||||
Script a lib directory:
|
||||
|
||||
```zsh
|
||||
% antidote-script $ZDOTDIR/custom/lib | subenv ZDOTDIR
|
||||
fpath+=( $ZDOTDIR/custom/lib )
|
||||
source $ZDOTDIR/custom/lib/lib1.zsh
|
||||
source $ZDOTDIR/custom/lib/lib2.zsh
|
||||
%
|
||||
```
|
||||
|
||||
Script a plugin directory:
|
||||
|
||||
```zsh
|
||||
% antidote-script $ZDOTDIR/custom/plugins/myplugin | subenv ZDOTDIR
|
||||
fpath+=( $ZDOTDIR/custom/plugins/myplugin )
|
||||
source $ZDOTDIR/custom/plugins/myplugin/myplugin.plugin.zsh
|
||||
%
|
||||
```
|
||||
|
||||
Script repos in antibody style:
|
||||
|
||||
```zsh
|
||||
% zstyle ':antidote:bundle' use-friendly-names off
|
||||
% ANTIDOTE_HOME=$HOME/.cache/antibody
|
||||
% antidote-script foo/bar | subenv ANTIDOTE_HOME #=> --file ./testdata/script-foobar.zsh
|
||||
% antidote-script https://github.com/foo/bar | subenv ANTIDOTE_HOME #=> --file ./testdata/script-foobar.zsh
|
||||
% antidote-script https://github.com/foo/bar.git | subenv ANTIDOTE_HOME #=> --file ./testdata/script-foobar.zsh
|
||||
% antidote-script git@github.com:foo/qux.git | subenv ANTIDOTE_HOME #=> --file ./testdata/script-fooqux.zsh
|
||||
% zstyle ':antidote:bundle' use-friendly-names on
|
||||
% ANTIDOTE_HOME=$HOME/.cache/antidote
|
||||
%
|
||||
```
|
||||
|
||||
## Annotations
|
||||
|
||||
### kind:clone
|
||||
|
||||
Nothing happens when the plugin already exists.
|
||||
|
||||
```zsh
|
||||
% antidote-script --kind clone foo/bar
|
||||
%
|
||||
```
|
||||
|
||||
Clone a missing plugin.
|
||||
|
||||
```zsh
|
||||
% antidote-script --kind clone bar/foo
|
||||
# antidote cloning bar/foo...
|
||||
%
|
||||
```
|
||||
|
||||
### kind:zsh
|
||||
|
||||
```zsh
|
||||
% antidote-script --kind zsh foo/bar | subenv ANTIDOTE_HOME
|
||||
fpath+=( $ANTIDOTE_HOME/foo/bar )
|
||||
source $ANTIDOTE_HOME/foo/bar/bar.plugin.zsh
|
||||
%
|
||||
```
|
||||
|
||||
### kind:path
|
||||
|
||||
```zsh
|
||||
% antidote-script --kind path foo/bar | subenv ANTIDOTE_HOME
|
||||
export PATH="$ANTIDOTE_HOME/foo/bar:$PATH"
|
||||
%
|
||||
```
|
||||
|
||||
### kind:fpath
|
||||
|
||||
```zsh
|
||||
% antidote-script --kind fpath foo/bar | subenv ANTIDOTE_HOME
|
||||
fpath+=( $ANTIDOTE_HOME/foo/bar )
|
||||
%
|
||||
```
|
||||
|
||||
### kind:autoload
|
||||
|
||||
```zsh
|
||||
% antidote-script --kind autoload $ZDOTDIR/functions | subenv ZDOTDIR
|
||||
fpath+=( $ZDOTDIR/functions )
|
||||
builtin autoload -Uz $fpath[-1]/*(N.:t)
|
||||
%
|
||||
```
|
||||
|
||||
### kind:defer
|
||||
|
||||
```zsh
|
||||
% antidote-script --kind defer foo/bar | subenv ANTIDOTE_HOME
|
||||
if ! (( $+functions[zsh-defer] )); then
|
||||
fpath+=( $ANTIDOTE_HOME/getantidote/zsh-defer )
|
||||
source $ANTIDOTE_HOME/getantidote/zsh-defer/zsh-defer.plugin.zsh
|
||||
fi
|
||||
fpath+=( $ANTIDOTE_HOME/foo/bar )
|
||||
zsh-defer source $ANTIDOTE_HOME/foo/bar/bar.plugin.zsh
|
||||
%
|
||||
```
|
||||
|
||||
Test defer zstyle settings
|
||||
|
||||
```zsh
|
||||
% zstyle ':antidote:bundle:*' defer-options '-a'
|
||||
% zstyle ':antidote:bundle:foo/bar' defer-options '-p'
|
||||
% antidote-script --kind defer foo/bar | subenv ANTIDOTE_HOME
|
||||
if ! (( $+functions[zsh-defer] )); then
|
||||
fpath+=( $ANTIDOTE_HOME/getantidote/zsh-defer )
|
||||
source $ANTIDOTE_HOME/getantidote/zsh-defer/zsh-defer.plugin.zsh
|
||||
fi
|
||||
fpath+=( $ANTIDOTE_HOME/foo/bar )
|
||||
zsh-defer -p source $ANTIDOTE_HOME/foo/bar/bar.plugin.zsh
|
||||
%
|
||||
% # Uses different defer options due to zstyle matching
|
||||
% antidote-script --kind defer bar/baz | subenv ANTIDOTE_HOME
|
||||
if ! (( $+functions[zsh-defer] )); then
|
||||
fpath+=( $ANTIDOTE_HOME/getantidote/zsh-defer )
|
||||
source $ANTIDOTE_HOME/getantidote/zsh-defer/zsh-defer.plugin.zsh
|
||||
fi
|
||||
fpath+=( $ANTIDOTE_HOME/bar/baz )
|
||||
zsh-defer -a source $ANTIDOTE_HOME/bar/baz/baz.plugin.zsh
|
||||
% # cleanup
|
||||
% t_reset
|
||||
%
|
||||
```
|
||||
|
||||
### path:plugin-dir
|
||||
|
||||
```zsh
|
||||
% antidote-script --path plugins/extract ohmy/ohmy | subenv ANTIDOTE_HOME
|
||||
fpath+=( $ANTIDOTE_HOME/ohmy/ohmy/plugins/extract )
|
||||
source $ANTIDOTE_HOME/ohmy/ohmy/plugins/extract/extract.plugin.zsh
|
||||
%
|
||||
```
|
||||
|
||||
### path:file
|
||||
|
||||
```zsh
|
||||
% antidote-script --path lib/lib1.zsh ohmy/ohmy | subenv ANTIDOTE_HOME
|
||||
source $ANTIDOTE_HOME/ohmy/ohmy/lib/lib1.zsh
|
||||
%
|
||||
```
|
||||
|
||||
### path:lib-dir
|
||||
|
||||
```zsh
|
||||
% antidote-script --path lib ohmy/ohmy | subenv ANTIDOTE_HOME
|
||||
fpath+=( $ANTIDOTE_HOME/ohmy/ohmy/lib )
|
||||
source $ANTIDOTE_HOME/ohmy/ohmy/lib/lib1.zsh
|
||||
source $ANTIDOTE_HOME/ohmy/ohmy/lib/lib2.zsh
|
||||
source $ANTIDOTE_HOME/ohmy/ohmy/lib/lib3.zsh
|
||||
%
|
||||
```
|
||||
|
||||
### path:theme
|
||||
|
||||
```zsh
|
||||
% antidote-script --path themes/pretty.zsh-theme ohmy/ohmy | subenv ANTIDOTE_HOME
|
||||
source $ANTIDOTE_HOME/ohmy/ohmy/themes/pretty.zsh-theme
|
||||
%
|
||||
```
|
||||
|
||||
### conditional:testfunc
|
||||
|
||||
```zsh
|
||||
% antidote-script --conditional is-macos --path plugins/macos ohmy/ohmy | subenv ANTIDOTE_HOME
|
||||
if is-macos; then
|
||||
fpath+=( $ANTIDOTE_HOME/ohmy/ohmy/plugins/macos )
|
||||
source $ANTIDOTE_HOME/ohmy/ohmy/plugins/macos/macos.plugin.zsh
|
||||
fi
|
||||
%
|
||||
```
|
||||
|
||||
### autoload:funcdir
|
||||
|
||||
```zsh
|
||||
% antidote-script --path plugins/macos --autoload functions ohmy/ohmy | subenv ANTIDOTE_HOME
|
||||
fpath+=( $ANTIDOTE_HOME/ohmy/ohmy/plugins/macos/functions )
|
||||
builtin autoload -Uz $fpath[-1]/*(N.:t)
|
||||
fpath+=( $ANTIDOTE_HOME/ohmy/ohmy/plugins/macos )
|
||||
source $ANTIDOTE_HOME/ohmy/ohmy/plugins/macos/macos.plugin.zsh
|
||||
%
|
||||
```
|
||||
|
||||
### fpath-rule:append/prepend
|
||||
|
||||
```zsh
|
||||
% # append
|
||||
% antidote-script --fpath-rule append --path plugins/docker ohmy/ohmy | subenv ANTIDOTE_HOME
|
||||
fpath+=( $ANTIDOTE_HOME/ohmy/ohmy/plugins/docker )
|
||||
source $ANTIDOTE_HOME/ohmy/ohmy/plugins/docker/docker.plugin.zsh
|
||||
% # prepend
|
||||
% antidote-script --fpath-rule prepend --path plugins/docker ohmy/ohmy | subenv ANTIDOTE_HOME
|
||||
fpath=( $ANTIDOTE_HOME/ohmy/ohmy/plugins/docker $fpath )
|
||||
source $ANTIDOTE_HOME/ohmy/ohmy/plugins/docker/docker.plugin.zsh
|
||||
% # whoops
|
||||
% antidote-script --fpath-rule foobar --path plugins/docker ohmy/ohmy 2>&1
|
||||
antidote: error: unexpected fpath rule: 'foobar'
|
||||
%
|
||||
```
|
||||
|
||||
### pre/post functions
|
||||
|
||||
```zsh
|
||||
% # pre
|
||||
% antidote-script --pre run_before foo/bar | subenv ANTIDOTE_HOME
|
||||
run_before
|
||||
fpath+=( $ANTIDOTE_HOME/foo/bar )
|
||||
source $ANTIDOTE_HOME/foo/bar/bar.plugin.zsh
|
||||
% # post
|
||||
% antidote-script --post run_after foo/bar | subenv ANTIDOTE_HOME
|
||||
fpath+=( $ANTIDOTE_HOME/foo/bar )
|
||||
source $ANTIDOTE_HOME/foo/bar/bar.plugin.zsh
|
||||
run_after
|
||||
%
|
||||
```
|
||||
|
||||
If a plugin is deferred, so is its post event
|
||||
```zsh
|
||||
% antidote-script --pre pre-event --post post-event --kind defer foo/bar | subenv ANTIDOTE_HOME
|
||||
pre-event
|
||||
if ! (( $+functions[zsh-defer] )); then
|
||||
fpath+=( $ANTIDOTE_HOME/getantidote/zsh-defer )
|
||||
source $ANTIDOTE_HOME/getantidote/zsh-defer/zsh-defer.plugin.zsh
|
||||
fi
|
||||
fpath+=( $ANTIDOTE_HOME/foo/bar )
|
||||
zsh-defer source $ANTIDOTE_HOME/foo/bar/bar.plugin.zsh
|
||||
zsh-defer post-event
|
||||
%
|
||||
```
|
||||
|
||||
## Private functions
|
||||
|
||||
### __antidote_initfiles
|
||||
|
||||
setup
|
||||
|
||||
```zsh
|
||||
% # load __antidote_initfiles from private funcs in antidote-script
|
||||
% antidote-script -h &>/dev/null
|
||||
% PLUGINDIR=$T_TEMPDIR/initfiles/myplugin
|
||||
% mkdir -p $PLUGINDIR
|
||||
% touch $PLUGINDIR/myplugin.plugin.zsh
|
||||
% touch $PLUGINDIR/whatever.plugin.zsh
|
||||
% touch $PLUGINDIR/file.zsh
|
||||
% touch $PLUGINDIR/file.sh
|
||||
% touch $PLUGINDIR/file.bash
|
||||
% touch $PLUGINDIR/mytheme.zsh-theme
|
||||
% touch $PLUGINDIR/README.md
|
||||
% touch $PLUGINDIR/file
|
||||
% mkdir -p $PLUGINDIR/lib
|
||||
% touch $PLUGINDIR/lib/lib1.zsh
|
||||
% touch $PLUGINDIR/lib/lib2.zsh
|
||||
% touch $PLUGINDIR/lib/lib3.zsh
|
||||
%
|
||||
```
|
||||
|
||||
myplugin.plugin.zsh
|
||||
|
||||
```zsh
|
||||
% __antidote_initfiles $PLUGINDIR | subenv PLUGINDIR
|
||||
$PLUGINDIR/myplugin.plugin.zsh
|
||||
% rm $PLUGINDIR/myplugin.plugin.zsh
|
||||
%
|
||||
```
|
||||
|
||||
whatever.plugin.zsh
|
||||
|
||||
```zsh
|
||||
% __antidote_initfiles $PLUGINDIR | subenv PLUGINDIR
|
||||
$PLUGINDIR/whatever.plugin.zsh
|
||||
% rm $PLUGINDIR/whatever.plugin.zsh
|
||||
%
|
||||
```
|
||||
|
||||
file.zsh
|
||||
|
||||
```zsh
|
||||
% __antidote_initfiles $PLUGINDIR | subenv PLUGINDIR
|
||||
$PLUGINDIR/file.zsh
|
||||
% rm $PLUGINDIR/file.zsh
|
||||
%
|
||||
```
|
||||
|
||||
file.sh
|
||||
|
||||
```zsh
|
||||
% __antidote_initfiles $PLUGINDIR | subenv PLUGINDIR
|
||||
$PLUGINDIR/file.sh
|
||||
% rm $PLUGINDIR/file.sh
|
||||
%
|
||||
```
|
||||
|
||||
mytheme.zsh-theme
|
||||
|
||||
```zsh
|
||||
% __antidote_initfiles $PLUGINDIR | subenv PLUGINDIR
|
||||
$PLUGINDIR/mytheme.zsh-theme
|
||||
% rm $PLUGINDIR/mytheme.zsh-theme
|
||||
%
|
||||
```
|
||||
|
||||
lib
|
||||
|
||||
```zsh
|
||||
% __antidote_initfiles $PLUGINDIR/lib | subenv PLUGINDIR
|
||||
$PLUGINDIR/lib/lib1.zsh
|
||||
$PLUGINDIR/lib/lib2.zsh
|
||||
$PLUGINDIR/lib/lib3.zsh
|
||||
%
|
||||
```
|
||||
|
||||
FAIL: no files left that match
|
||||
|
||||
```zsh
|
||||
% __antidote_initfiles $PLUGINDIR #=> --exit 1
|
||||
%
|
||||
```
|
||||
|
||||
FAIL: Empty
|
||||
|
||||
```zsh
|
||||
% PLUGINDIR=$T_TEMPDIR/initfiles/foo
|
||||
% mkdir -p $PLUGINDIR
|
||||
% __antidote_initfiles $PLUGINDIR #=> --exit 1
|
||||
%
|
||||
```
|
||||
|
||||
## Teardown
|
||||
|
||||
```zsh
|
||||
% t_teardown
|
||||
%
|
||||
```
|
||||
37
.antidote/tests/test_cmd_update.md
Normal file
37
.antidote/tests/test_cmd_update.md
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
# antidote update tests
|
||||
|
||||
## Setup
|
||||
|
||||
```zsh
|
||||
% source ./tests/_setup.zsh
|
||||
% source ./antidote.zsh
|
||||
%
|
||||
```
|
||||
|
||||
## Update
|
||||
|
||||
```zsh
|
||||
% antidote update
|
||||
Updating bundles...
|
||||
antidote: checking for updates: https://github.com/foo/bar
|
||||
antidote: checking for updates: https://github.com/foo/baz
|
||||
antidote: checking for updates: git@github.com:foo/qux
|
||||
antidote: checking for updates: https://github.com/getantidote/zsh-defer
|
||||
antidote: checking for updates: https://github.com/ohmy/ohmy
|
||||
Waiting for bundle updates to complete...
|
||||
|
||||
Bundle updates complete.
|
||||
|
||||
Updating antidote...
|
||||
antidote self-update complete.
|
||||
|
||||
antidote version 1.9.7
|
||||
%
|
||||
```
|
||||
|
||||
## Teardown
|
||||
|
||||
```zsh
|
||||
% t_teardown
|
||||
%
|
||||
```
|
||||
111
.antidote/tests/test_fpath_rules.md
Normal file
111
.antidote/tests/test_fpath_rules.md
Normal file
|
|
@ -0,0 +1,111 @@
|
|||
# antidote bundle fpath-rule:<rule>
|
||||
|
||||
## Setup
|
||||
|
||||
```zsh
|
||||
% source ./tests/_setup.zsh
|
||||
% source ./antidote.zsh
|
||||
%
|
||||
```
|
||||
|
||||
By default, fpath is appended to:
|
||||
|
||||
```zsh
|
||||
% antidote bundle foo/bar kind:fpath
|
||||
fpath+=( $HOME/.cache/antidote/foo/bar )
|
||||
%
|
||||
```
|
||||
|
||||
fpath can be told to explicitly append, but it's unnecessary
|
||||
|
||||
```zsh
|
||||
% antidote bundle foo/bar kind:zsh fpath-rule:append
|
||||
fpath+=( $HOME/.cache/antidote/foo/bar )
|
||||
source $HOME/.cache/antidote/foo/bar/bar.plugin.zsh
|
||||
%
|
||||
|
||||
fpath can be prepended with fpath-rule:prepend
|
||||
|
||||
```zsh
|
||||
% antidote bundle foo/bar kind:fpath fpath-rule:prepend
|
||||
fpath=( $HOME/.cache/antidote/foo/bar $fpath )
|
||||
%
|
||||
|
||||
fpath rules can only be append/prepend
|
||||
|
||||
```zsh
|
||||
% antidote bundle foo/bar kind:fpath fpath-rule:append #=> --exit 0
|
||||
% antidote bundle foo/bar kind:fpath fpath-rule:prepend #=> --exit 0
|
||||
% antidote bundle foo/bar kind:fpath fpath-rule:foo 2>&1
|
||||
antidote: error: unexpected fpath rule: 'foo'
|
||||
%
|
||||
|
||||
fpath rules are also used for `kind:autoload`
|
||||
|
||||
```zsh
|
||||
% antidote bundle foo/baz path:baz kind:autoload fpath-rule:append
|
||||
fpath+=( $HOME/.cache/antidote/foo/baz/baz )
|
||||
builtin autoload -Uz $fpath[-1]/*(N.:t)
|
||||
% antidote bundle foo/baz path:baz kind:autoload fpath-rule:prepend
|
||||
fpath=( $HOME/.cache/antidote/foo/baz/baz $fpath )
|
||||
builtin autoload -Uz $fpath[1]/*(N.:t)
|
||||
%
|
||||
```
|
||||
|
||||
fpath rules are also used for `autoload:funcdir`
|
||||
|
||||
```zsh
|
||||
% # Append
|
||||
% antidote bundle foo/baz autoload:baz fpath-rule:append
|
||||
fpath+=( $HOME/.cache/antidote/foo/baz/baz )
|
||||
builtin autoload -Uz $fpath[-1]/*(N.:t)
|
||||
fpath+=( $HOME/.cache/antidote/foo/baz )
|
||||
source $HOME/.cache/antidote/foo/baz/baz.plugin.zsh
|
||||
% # Prepend
|
||||
% antidote bundle foo/baz autoload:baz fpath-rule:prepend
|
||||
fpath=( $HOME/.cache/antidote/foo/baz/baz $fpath )
|
||||
builtin autoload -Uz $fpath[1]/*(N.:t)
|
||||
fpath=( $HOME/.cache/antidote/foo/baz $fpath )
|
||||
source $HOME/.cache/antidote/foo/baz/baz.plugin.zsh
|
||||
%
|
||||
```
|
||||
|
||||
fpath rules can be set globally with a zstyle:
|
||||
|
||||
`zstyle ':antidote:fpath' rule 'prepend'`
|
||||
|
||||
```zsh
|
||||
% zstyle ':antidote:fpath' rule 'prepend'
|
||||
% antidote bundle foo/bar
|
||||
fpath=( $HOME/.cache/antidote/foo/bar $fpath )
|
||||
source $HOME/.cache/antidote/foo/bar/bar.plugin.zsh
|
||||
% antidote bundle foo/bar kind:fpath
|
||||
fpath=( $HOME/.cache/antidote/foo/bar $fpath )
|
||||
% antidote bundle foo/baz path:baz kind:autoload
|
||||
fpath=( $HOME/.cache/antidote/foo/baz/baz $fpath )
|
||||
builtin autoload -Uz $fpath[1]/*(N.:t)
|
||||
%
|
||||
```
|
||||
|
||||
It is NOT recommended to do this, but if you choose to then explicit fpath-rules are
|
||||
still respected:
|
||||
|
||||
```zsh
|
||||
% zstyle ':antidote:fpath' rule 'prepend'
|
||||
% antidote bundle foo/bar fpath-rule:append
|
||||
fpath+=( $HOME/.cache/antidote/foo/bar )
|
||||
source $HOME/.cache/antidote/foo/bar/bar.plugin.zsh
|
||||
% antidote bundle foo/bar kind:fpath fpath-rule:append
|
||||
fpath+=( $HOME/.cache/antidote/foo/bar )
|
||||
% antidote bundle foo/baz path:baz kind:autoload fpath-rule:append
|
||||
fpath+=( $HOME/.cache/antidote/foo/baz/baz )
|
||||
builtin autoload -Uz $fpath[-1]/*(N.:t)
|
||||
%
|
||||
```
|
||||
|
||||
## Teardown
|
||||
|
||||
```zsh
|
||||
% t_teardown
|
||||
%
|
||||
```
|
||||
235
.antidote/tests/test_helpers.md
Normal file
235
.antidote/tests/test_helpers.md
Normal file
|
|
@ -0,0 +1,235 @@
|
|||
# antidote helper tests
|
||||
|
||||
## Setup
|
||||
|
||||
```zsh
|
||||
% source ./tests/_setup.zsh
|
||||
% source ./antidote.zsh
|
||||
%
|
||||
```
|
||||
|
||||
## Safe removal
|
||||
|
||||
Appease my paranoia and ensure that you can't remove a path you shouldn't be able to:
|
||||
|
||||
```zsh
|
||||
% __antidote_del -rf -- /foo/bar
|
||||
antidote: Blocked attempt to rm path: '/foo/bar'.
|
||||
%
|
||||
```
|
||||
|
||||
## Pretty print path
|
||||
|
||||
```zsh
|
||||
% __antidote_print_path /foo/bar
|
||||
/foo/bar
|
||||
% __antidote_print_path $HOME/foo/bar
|
||||
$HOME/foo/bar
|
||||
% zstyle ':antidote:compatibility-mode' 'antibody' 'on'
|
||||
% __antidote_print_path $HOME/foo/bar | subenv T_TEMPDIR
|
||||
$T_TEMPDIR/foo/bar
|
||||
% zstyle -d ':antidote:compatibility-mode' 'antibody'
|
||||
%
|
||||
```
|
||||
|
||||
## Bundle type
|
||||
|
||||
```zsh
|
||||
% __antidote_bundle_type $PWD/antidote.zsh
|
||||
file
|
||||
% __antidote_bundle_type $PWD/functions
|
||||
dir
|
||||
% __antidote_bundle_type '$PWD/antidote.zsh'
|
||||
file
|
||||
% __antidote_bundle_type \$PWD/functions
|
||||
dir
|
||||
% __antidote_bundle_type 'git@github.com:foo/bar.git'
|
||||
sshurl
|
||||
% __antidote_bundle_type 'https://github.com/foo/bar'
|
||||
url
|
||||
% __antidote_bundle_type 'https:/bad.com/foo/bar.git'
|
||||
?
|
||||
% __antidote_bundle_type ''
|
||||
empty
|
||||
% __antidote_bundle_type ' '
|
||||
empty
|
||||
% __antidote_bundle_type /foo/bar
|
||||
path
|
||||
% __antidote_bundle_type /foobar
|
||||
path
|
||||
% __antidote_bundle_type foobar/
|
||||
relpath
|
||||
% __antidote_bundle_type '~/foo/bar'
|
||||
path
|
||||
% __antidote_bundle_type '$foo/bar'
|
||||
path
|
||||
% __antidote_bundle_type \$ZDOTDIR/foo
|
||||
path
|
||||
% __antidote_bundle_type \$ZDOTDIR/.zsh_plugins.txt
|
||||
file
|
||||
% touch ~/.zshenv
|
||||
% __antidote_bundle_type '~/.zshenv'
|
||||
file
|
||||
% __antidote_bundle_type '~/null'
|
||||
path
|
||||
% __antidote_bundle_type foo/bar
|
||||
repo
|
||||
% __antidote_bundle_type bar/baz.git
|
||||
repo
|
||||
% __antidote_bundle_type foo/bar/baz
|
||||
relpath
|
||||
% __antidote_bundle_type foobar
|
||||
word
|
||||
% __antidote_bundle_type foo bar baz
|
||||
word
|
||||
% __antidote_bundle_type 'foo bar baz'
|
||||
word
|
||||
%
|
||||
```
|
||||
|
||||
## Bundle name
|
||||
|
||||
```zsh
|
||||
% __antidote_bundle_name $HOME/.zsh/custom/lib/lib1.zsh
|
||||
$HOME/.zsh/custom/lib/lib1.zsh
|
||||
% __antidote_bundle_name $HOME/.zsh/plugins/myplugin
|
||||
$HOME/.zsh/plugins/myplugin
|
||||
% __antidote_bundle_name 'git@github.com:foo/bar.git'
|
||||
foo/bar
|
||||
% __antidote_bundle_name 'https://github.com/foo/bar'
|
||||
foo/bar
|
||||
% __antidote_bundle_name 'https:/bad.com/foo/bar.git'
|
||||
https:/bad.com/foo/bar.git
|
||||
% __antidote_bundle_name ''
|
||||
|
||||
% __antidote_bundle_name /foo/bar
|
||||
/foo/bar
|
||||
% __antidote_bundle_name /foobar
|
||||
/foobar
|
||||
% __antidote_bundle_name foobar/
|
||||
foobar/
|
||||
% __antidote_bundle_name '~/foo/bar'
|
||||
$HOME/foo/bar
|
||||
% __antidote_bundle_name '$foo/bar'
|
||||
$foo/bar
|
||||
% __antidote_bundle_name foo/bar
|
||||
foo/bar
|
||||
% __antidote_bundle_name bar/baz.git
|
||||
bar/baz.git
|
||||
% __antidote_bundle_name foo/bar/baz
|
||||
foo/bar/baz
|
||||
% __antidote_bundle_name foobar
|
||||
foobar
|
||||
% __antidote_bundle_name foo bar baz
|
||||
foo
|
||||
% __antidote_bundle_name 'foo bar baz'
|
||||
foo bar baz
|
||||
%
|
||||
```
|
||||
|
||||
## Bundle dir
|
||||
|
||||
```zsh
|
||||
% zstyle ':antidote:bundle' use-friendly-names off
|
||||
% # short repo
|
||||
% __antidote_bundle_dir foo/bar | subenv ANTIDOTE_HOME
|
||||
$ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-foo-SLASH-bar
|
||||
% # repo url
|
||||
% __antidote_bundle_dir https://github.com/foo/bar | subenv ANTIDOTE_HOME
|
||||
$ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-foo-SLASH-bar
|
||||
% # repo url.git
|
||||
% __antidote_bundle_dir https://github.com/foo/bar.git | subenv ANTIDOTE_HOME
|
||||
$ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-foo-SLASH-bar
|
||||
% # repo ssh
|
||||
% __antidote_bundle_dir git@github.com:foo/bar.git | subenv ANTIDOTE_HOME
|
||||
$ANTIDOTE_HOME/git-AT-github.com-COLON-foo-SLASH-bar
|
||||
% # local dir
|
||||
% __antidote_bundle_dir ~/foo/bar | subenv HOME
|
||||
$HOME/foo/bar
|
||||
% # another local dir
|
||||
% __antidote_bundle_dir $ZDOTDIR/bar/baz | subenv ZDOTDIR
|
||||
$ZDOTDIR/bar/baz
|
||||
%
|
||||
```
|
||||
|
||||
Use friendly names
|
||||
|
||||
```zsh
|
||||
% # short repo - friendly name
|
||||
% zstyle ':antidote:bundle' use-friendly-names on
|
||||
% __antidote_bundle_dir foo/bar | subenv ANTIDOTE_HOME
|
||||
$ANTIDOTE_HOME/foo/bar
|
||||
% # repo url - friendly name
|
||||
% __antidote_bundle_dir https://github.com/bar/baz | subenv ANTIDOTE_HOME
|
||||
$ANTIDOTE_HOME/bar/baz
|
||||
% # ssh repo - friendly name
|
||||
% __antidote_bundle_dir git@github.com:foo/qux.git | subenv ANTIDOTE_HOME
|
||||
$ANTIDOTE_HOME/foo/qux
|
||||
%
|
||||
```
|
||||
|
||||
### To URL
|
||||
|
||||
Short repos:
|
||||
|
||||
```zsh
|
||||
% __antidote_tourl ohmyzsh/ohmyzsh
|
||||
https://github.com/ohmyzsh/ohmyzsh
|
||||
% __antidote_tourl sindresorhus/pure
|
||||
https://github.com/sindresorhus/pure
|
||||
% __antidote_tourl foo/bar
|
||||
https://github.com/foo/bar
|
||||
%
|
||||
```
|
||||
|
||||
Proper URLs don't change:
|
||||
|
||||
```zsh
|
||||
% __antidote_tourl https://github.com/ohmyzsh/ohmyzsh
|
||||
https://github.com/ohmyzsh/ohmyzsh
|
||||
% __antidote_tourl http://github.com/ohmyzsh/ohmyzsh
|
||||
http://github.com/ohmyzsh/ohmyzsh
|
||||
% __antidote_tourl ssh://github.com/ohmyzsh/ohmyzsh
|
||||
ssh://github.com/ohmyzsh/ohmyzsh
|
||||
% __antidote_tourl git://github.com/ohmyzsh/ohmyzsh
|
||||
git://github.com/ohmyzsh/ohmyzsh
|
||||
% __antidote_tourl ftp://github.com/ohmyzsh/ohmyzsh
|
||||
ftp://github.com/ohmyzsh/ohmyzsh
|
||||
% __antidote_tourl git@github.com:sindresorhus/pure.git
|
||||
git@github.com:sindresorhus/pure.git
|
||||
%
|
||||
```
|
||||
|
||||
## Collect input
|
||||
|
||||
If we \<redirect input it should output that.
|
||||
|
||||
```zsh
|
||||
% __antidote_collect_input <$ZDOTDIR/.zsh_plugins.txt #=> --file tmp_home/.zsh/.zsh_plugins.txt
|
||||
%
|
||||
```
|
||||
|
||||
If we \|pipe input it should output that.
|
||||
|
||||
```zsh
|
||||
% cat $ZDOTDIR/.zsh_plugins.txt | __antidote_collect_input #=> --file tmp_home/.zsh/.zsh_plugins.txt
|
||||
%
|
||||
```
|
||||
|
||||
If we pass argument it should output that.
|
||||
|
||||
```zsh
|
||||
% __antidote_collect_input 'a\nb\nc\n'
|
||||
a
|
||||
b
|
||||
c
|
||||
|
||||
%
|
||||
```
|
||||
|
||||
## Teardown
|
||||
|
||||
```zsh
|
||||
% t_teardown
|
||||
%
|
||||
```
|
||||
229
.antidote/tests/test_real.md
Normal file
229
.antidote/tests/test_real.md
Normal file
|
|
@ -0,0 +1,229 @@
|
|||
# antidote tests for real
|
||||
|
||||
## antidote bundle
|
||||
|
||||
### Setup
|
||||
|
||||
```zsh
|
||||
% TESTDATA=$PWD/tests/testdata/real
|
||||
% source ./tests/_setup.zsh
|
||||
% # do it for real!
|
||||
% t_setup_real
|
||||
%
|
||||
```
|
||||
|
||||
### Config
|
||||
|
||||
```zsh
|
||||
% zstyle ':antidote:bundle:*' zcompile 'yes'
|
||||
%
|
||||
```
|
||||
|
||||
### Bundle
|
||||
|
||||
Clone and generate bundle script
|
||||
|
||||
```zsh
|
||||
% antidote bundle <$TESTDATA/.zsh_plugins.txt >$ZDOTDIR/.zsh_plugins.zsh 2>/dev/null
|
||||
% cat $ZDOTDIR/.zsh_plugins.zsh | subenv ANTIDOTE_HOME #=> --file testdata/real/.zsh_plugins.zsh
|
||||
%
|
||||
```
|
||||
|
||||
Check to see that everything cloned
|
||||
|
||||
```zsh
|
||||
% antidote list | subenv ANTIDOTE_HOME #=> --file testdata/real/repo-list.txt
|
||||
%
|
||||
```
|
||||
|
||||
Test that everything compiled
|
||||
|
||||
```zsh
|
||||
% zwcfiles=($(ls $(antidote home)/**/*.zwc(N) | wc -l))
|
||||
% test $zwcfiles -gt 100 #=> --exit 0
|
||||
%
|
||||
```
|
||||
|
||||
Test that everything updated
|
||||
|
||||
```zsh
|
||||
% rm -rf -- $(antidote home)/**/*.zwc(N)
|
||||
% antidote update &>/dev/null
|
||||
% zwcfiles=($(ls $(antidote home)/**/*.zwc(N) | wc -l))
|
||||
% test $zwcfiles -gt 100 #=> --exit 0
|
||||
%
|
||||
```
|
||||
|
||||
Check to see that branch:br annotations properly changed the cloned branch
|
||||
|
||||
```zsh
|
||||
% branched_plugin="$ANTIDOTE_HOME/mattmc3/antidote"
|
||||
% git -C $branched_plugin branch --show-current 2>/dev/null
|
||||
pz
|
||||
%
|
||||
```
|
||||
|
||||
Test that `antidote purge --all` aborts when told "no".
|
||||
|
||||
```zsh
|
||||
% function test_exists { [[ -e "$1" ]] }
|
||||
% zstyle ':antidote:purge:all' answer 'n'
|
||||
% antidote purge --all #=> --exit 1
|
||||
% antidote list | subenv ANTIDOTE_HOME #=> --file testdata/real/repo-list.txt
|
||||
% antidote list | wc -l | awk '{print $1}'
|
||||
15
|
||||
% test_exists $ZDOTDIR/.zsh_plugins.zsh(.N) #=> --exit 0
|
||||
% test_exists $ZDOTDIR/.zsh_plugins*.bak(.N) #=> --exit 1
|
||||
%
|
||||
```
|
||||
|
||||
Test that `antidote purge --all` does the work when told "yes".
|
||||
|
||||
```zsh
|
||||
% function test_exists { [[ -e "$1" ]] }
|
||||
% zstyle ':antidote:purge:all' answer 'y'
|
||||
% antidote purge --all | tail -n 1 #=> --exit 0
|
||||
Antidote purge complete. Be sure to start a new Zsh session.
|
||||
% antidote list | wc -l | awk '{print $1}'
|
||||
0
|
||||
% test_exists $ZDOTDIR/.zsh_plugins.zsh(.N) #=> --exit 1
|
||||
% test_exists $ZDOTDIR/.zsh_plugins*.bak(.N) #=> --exit 0
|
||||
%
|
||||
```
|
||||
|
||||
### Teardown
|
||||
|
||||
```zsh
|
||||
% zstyle -d ':antidote:purge:all' answer
|
||||
% t_teardown
|
||||
%
|
||||
```
|
||||
|
||||
## CRLF testing
|
||||
|
||||
### Redo setup
|
||||
|
||||
```zsh
|
||||
% TESTDATA=$PWD/tests/testdata/real
|
||||
% source ./tests/_setup.zsh
|
||||
% t_setup_real
|
||||
%
|
||||
```
|
||||
|
||||
Clone and generate bundle script
|
||||
|
||||
```zsh
|
||||
% antidote bundle <$TESTDATA/.zsh_plugins.crlf.txt >$ZDOTDIR/.zsh_plugins.zsh 2>/dev/null
|
||||
% cat $ZDOTDIR/.zsh_plugins.zsh | subenv ANTIDOTE_HOME
|
||||
fpath+=( $ANTIDOTE_HOME/rupa/z )
|
||||
source $ANTIDOTE_HOME/rupa/z/z.sh
|
||||
fpath+=( $ANTIDOTE_HOME/zsh-users/zsh-syntax-highlighting )
|
||||
source $ANTIDOTE_HOME/zsh-users/zsh-syntax-highlighting/zsh-syntax-highlighting.plugin.zsh
|
||||
fpath+=( $ANTIDOTE_HOME/zsh-users/zsh-completions )
|
||||
source $ANTIDOTE_HOME/zsh-users/zsh-completions/zsh-completions.plugin.zsh
|
||||
fpath+=( $ANTIDOTE_HOME/zsh-users/zsh-autosuggestions )
|
||||
source $ANTIDOTE_HOME/zsh-users/zsh-autosuggestions/zsh-autosuggestions.plugin.zsh
|
||||
fpath+=( $ANTIDOTE_HOME/zsh-users/zsh-history-substring-search )
|
||||
source $ANTIDOTE_HOME/zsh-users/zsh-history-substring-search/zsh-history-substring-search.plugin.zsh
|
||||
%
|
||||
```
|
||||
|
||||
Check to see that everything cloned
|
||||
|
||||
```zsh
|
||||
% antidote list | subenv ANTIDOTE_HOME
|
||||
https://github.com/rupa/z $ANTIDOTE_HOME/rupa/z
|
||||
https://github.com/zsh-users/zsh-autosuggestions $ANTIDOTE_HOME/zsh-users/zsh-autosuggestions
|
||||
https://github.com/zsh-users/zsh-completions $ANTIDOTE_HOME/zsh-users/zsh-completions
|
||||
https://github.com/zsh-users/zsh-history-substring-search $ANTIDOTE_HOME/zsh-users/zsh-history-substring-search
|
||||
https://github.com/zsh-users/zsh-syntax-highlighting $ANTIDOTE_HOME/zsh-users/zsh-syntax-highlighting
|
||||
%
|
||||
```
|
||||
|
||||
### Teardown
|
||||
|
||||
```zsh
|
||||
% t_teardown
|
||||
%
|
||||
```
|
||||
|
||||
## antidote load
|
||||
|
||||
### Redo setup
|
||||
|
||||
```zsh
|
||||
% TESTDATA=$PWD/tests/testdata/real
|
||||
% source ./tests/_setup.zsh
|
||||
% t_setup_real
|
||||
%
|
||||
```
|
||||
|
||||
### Load
|
||||
|
||||
Load rupa/z
|
||||
|
||||
```zsh
|
||||
% zstyle ':antidote:bundle' use-friendly-names on
|
||||
% echo "rupa/z" > $ZDOTDIR/.zsh_plugins.txt
|
||||
% antidote load 2>&1
|
||||
# antidote cloning rupa/z...
|
||||
% echo $+aliases[z]
|
||||
1
|
||||
% wc -l <$ZDOTDIR/.zsh_plugins.zsh | sed 's/ //g'
|
||||
2
|
||||
% (( ! $+aliases[z] )) || unalias z
|
||||
%
|
||||
```
|
||||
|
||||
Load re-generates .zsh_plugins.zsh when .zsh_plugins.txt changes
|
||||
|
||||
```zsh
|
||||
% compdir=$ANTIDOTE_HOME/zsh-users/zsh-completions/src
|
||||
% (( $fpath[(Ie)$compdir] )) || echo "completions are not in fpath"
|
||||
completions are not in fpath
|
||||
% echo $+aliases[z]
|
||||
0
|
||||
%
|
||||
```
|
||||
|
||||
...add a new plugin
|
||||
|
||||
```zsh
|
||||
% wc -l <$ZDOTDIR/.zsh_plugins.txt | sed 's/ //g'
|
||||
1
|
||||
% cat $ZDOTDIR/.zsh_plugins.zsh | subenv ANTIDOTE_HOME
|
||||
fpath+=( $ANTIDOTE_HOME/rupa/z )
|
||||
source $ANTIDOTE_HOME/rupa/z/z.sh
|
||||
% echo "zsh-users/zsh-completions path:src kind:fpath" >> $ZDOTDIR/.zsh_plugins.txt
|
||||
% # static cache file hasn't changed yet
|
||||
% cat $ZDOTDIR/.zsh_plugins.zsh | subenv ANTIDOTE_HOME
|
||||
fpath+=( $ANTIDOTE_HOME/rupa/z )
|
||||
source $ANTIDOTE_HOME/rupa/z/z.sh
|
||||
%
|
||||
```
|
||||
|
||||
...now do `antidote load` and show that it actually loaded all plugins
|
||||
|
||||
```zsh
|
||||
% antidote load 2>&1
|
||||
# antidote cloning zsh-users/zsh-completions...
|
||||
% cat $ZDOTDIR/.zsh_plugins.zsh | subenv ANTIDOTE_HOME
|
||||
fpath+=( $ANTIDOTE_HOME/rupa/z )
|
||||
source $ANTIDOTE_HOME/rupa/z/z.sh
|
||||
fpath+=( $ANTIDOTE_HOME/zsh-users/zsh-completions/src )
|
||||
% echo $+aliases[z]
|
||||
1
|
||||
% (( $fpath[(Ie)$compdir] )) && echo "completions are in fpath"
|
||||
completions are in fpath
|
||||
%
|
||||
% wc -l <$ZDOTDIR/.zsh_plugins.zsh | sed 's/ //g'
|
||||
3
|
||||
%
|
||||
```
|
||||
|
||||
### Teardown
|
||||
|
||||
```zsh
|
||||
% t_teardown
|
||||
%
|
||||
```
|
||||
41
.antidote/tests/test_setopts_special.md
Normal file
41
.antidote/tests/test_setopts_special.md
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
# antidote handles special Zsh options
|
||||
|
||||
## Setup
|
||||
|
||||
Tests to handle special Zsh options. [#154](https://github.com/mattmc3/antidote/issues/154).
|
||||
|
||||
```zsh
|
||||
% source ./tests/_setup.zsh
|
||||
% setopt KSH_ARRAYS SH_GLOB
|
||||
% source ./antidote.zsh
|
||||
%
|
||||
```
|
||||
|
||||
# Ensure bundle works
|
||||
|
||||
```zsh
|
||||
% antidote bundle <$ZDOTDIR/.zsh_plugins.txt >$ZDOTDIR/.zsh_plugins.zsh
|
||||
% cat $ZDOTDIR/.zsh_plugins.zsh | subenv #=> --file testdata/.zsh_plugins.zsh
|
||||
%
|
||||
```
|
||||
|
||||
# Ensure options remained
|
||||
|
||||
```zsh
|
||||
% [[ -o KSH_ARRAYS ]] && echo KSH_ARRAYS
|
||||
KSH_ARRAYS
|
||||
% [[ -o SH_GLOB ]] && echo SH_GLOB
|
||||
SH_GLOB
|
||||
% # unset
|
||||
% unsetopt KSH_ARRAYS SH_GLOB
|
||||
% [[ -o KSH_ARRAYS ]] && echo KSH_ARRAYS
|
||||
% [[ -o SH_GLOB ]] && echo SH_GLOB
|
||||
%
|
||||
```
|
||||
|
||||
## Teardown
|
||||
|
||||
```zsh
|
||||
% t_teardown
|
||||
%
|
||||
```
|
||||
54
.antidote/tests/test_zcompile_bundle.md
Normal file
54
.antidote/tests/test_zcompile_bundle.md
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
# antidote load tests
|
||||
|
||||
## Setup
|
||||
|
||||
```zsh
|
||||
% source ./tests/_setup.zsh
|
||||
% source ./antidote.zsh
|
||||
%
|
||||
```
|
||||
|
||||
### General
|
||||
|
||||
Ensure a compiled file does not exist:
|
||||
|
||||
```zsh
|
||||
% zstyle ':antidote:bundle:*' zcompile 'no'
|
||||
% ! test -e $ZDOTDIR/custom/lib/lib1.zsh.zwc #=> --exit 0
|
||||
% antidote bundle $ZDOTDIR/custom/lib/lib1.zsh | subenv ZDOTDIR
|
||||
source $ZDOTDIR/custom/lib/lib1.zsh
|
||||
% ! test -e $ZDOTDIR/custom/lib/lib1.zsh.zwc #=> --exit 0
|
||||
% antidote bundle $ZDOTDIR/custom/plugins/mytheme | subenv ZDOTDIR
|
||||
fpath+=( $ZDOTDIR/custom/plugins/mytheme )
|
||||
source $ZDOTDIR/custom/plugins/mytheme/mytheme.zsh-theme
|
||||
% ! test -e $ZDOTDIR/custom/plugins/mytheme/mytheme.zsh-theme.zwc #=> --exit 0
|
||||
%
|
||||
```
|
||||
|
||||
Ensure a compiled file exists:
|
||||
|
||||
```zsh
|
||||
% zstyle ':antidote:bundle:*' zcompile 'yes'
|
||||
% ! test -e $ZDOTDIR/custom/lib/lib2.zsh.zwc #=> --exit 0
|
||||
% antidote bundle $ZDOTDIR/custom/lib/lib2.zsh | subenv ZDOTDIR
|
||||
source $ZDOTDIR/custom/lib/lib2.zsh
|
||||
% test -e $ZDOTDIR/custom/lib/lib2.zsh.zwc #=> --exit 0
|
||||
% # plugin
|
||||
% antidote bundle $ZDOTDIR/custom/plugins/myplugin | subenv ZDOTDIR
|
||||
fpath+=( $ZDOTDIR/custom/plugins/myplugin )
|
||||
source $ZDOTDIR/custom/plugins/myplugin/myplugin.plugin.zsh
|
||||
% test -e $ZDOTDIR/custom/plugins/myplugin/myplugin.plugin.zsh.zwc #=> --exit 0
|
||||
% # zsh-theme
|
||||
% antidote bundle $ZDOTDIR/custom/plugins/mytheme | subenv ZDOTDIR
|
||||
fpath+=( $ZDOTDIR/custom/plugins/mytheme )
|
||||
source $ZDOTDIR/custom/plugins/mytheme/mytheme.zsh-theme
|
||||
% test -e $ZDOTDIR/custom/plugins/mytheme/mytheme.zsh-theme.zwc #=> --exit 0
|
||||
%
|
||||
```
|
||||
|
||||
## Teardown
|
||||
|
||||
```zsh
|
||||
% t_teardown
|
||||
%
|
||||
```
|
||||
44
.antidote/tests/test_zcompile_static.md
Normal file
44
.antidote/tests/test_zcompile_static.md
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
# antidote load tests
|
||||
|
||||
## Setup
|
||||
|
||||
```zsh
|
||||
% source ./tests/_setup.zsh
|
||||
% source ./antidote.zsh
|
||||
%
|
||||
```
|
||||
|
||||
### General
|
||||
|
||||
Ensure a compiled file exists:
|
||||
|
||||
```zsh
|
||||
% zstyle ':antidote:static' zcompile 'yes'
|
||||
% zstyle ':antidote:static' file $ZDOTDIR/.zplugins_fake_zcompile_static.zsh
|
||||
% ! test -e $ZDOTDIR/.zplugins_fake_zcompile_static.zsh.zwc #=> --exit 0
|
||||
% antidote load $ZDOTDIR/.zplugins_fake_load >/dev/null
|
||||
% cat $ZDOTDIR/.zplugins_fake_zcompile_static.zsh | subenv #=> --file testdata/.zplugins_fake_zcompile_static.zsh
|
||||
% test -e $ZDOTDIR/.zplugins_fake_zcompile_static.zsh.zwc #=> --exit 0
|
||||
% t_reset
|
||||
%
|
||||
```
|
||||
|
||||
Ensure a compiled file does not exist:
|
||||
|
||||
```zsh
|
||||
% zstyle ':antidote:static' zcompile 'no'
|
||||
% zstyle ':antidote:static' file $ZDOTDIR/.zplugins_fake_load.zsh
|
||||
% ! test -e $ZDOTDIR/.zplugins_fake_load.zsh.zwc #=> --exit 0
|
||||
% antidote load $ZDOTDIR/.zplugins_fake_load >/dev/null
|
||||
% cat $ZDOTDIR/.zplugins_fake_load.zsh | subenv #=> --file testdata/.zplugins_fake_load.zsh
|
||||
% ! test -e $ZDOTDIR/.zplugins_fake_load.zsh.zwc #=> --exit 0
|
||||
% t_reset
|
||||
%
|
||||
```
|
||||
|
||||
## Teardown
|
||||
|
||||
```zsh
|
||||
% t_teardown
|
||||
%
|
||||
```
|
||||
84
.antidote/tests/test_zsetopts.md
Normal file
84
.antidote/tests/test_zsetopts.md
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
# antidote respects setopts
|
||||
|
||||
## Setup
|
||||
|
||||
```zsh
|
||||
% source ./tests/_setup.zsh
|
||||
% source ./antidote.zsh
|
||||
%
|
||||
```
|
||||
|
||||
Set up a plugin that changes Zsh options
|
||||
```zsh
|
||||
% plugin_file=$ANTIDOTE_HOME/lampoon/xmas/xmas.plugin.zsh
|
||||
% mkdir -p $plugin_file:h && touch $plugin_file
|
||||
% echo "unsetopt noaliases" >>$plugin_file
|
||||
% echo "setopt autocd" >>$plugin_file
|
||||
% echo "lampoon/xmas" >$ZDOTDIR/.zsh_plugins.txt
|
||||
%
|
||||
```
|
||||
|
||||
## Test that plugins that run setopts work
|
||||
|
||||
Verify initial state
|
||||
```zsh
|
||||
% setopt noaliases
|
||||
% set -o | grep noaliases
|
||||
noaliases on
|
||||
% set -o | grep autocd
|
||||
autocd off
|
||||
%
|
||||
```
|
||||
|
||||
Load the plugins and see if the option took
|
||||
```zsh
|
||||
% antidote load &>/dev/null #=> --exit 0
|
||||
% set -o | grep noaliases
|
||||
noaliases off
|
||||
% set -o | grep autocd
|
||||
autocd on
|
||||
% # cleanup
|
||||
% setopt noaliases no_autocd
|
||||
%
|
||||
```
|
||||
|
||||
Tests to ensure [#86](https://github.com/mattmc3/antidote/issues/86) stays fixed.
|
||||
Check that stderr is empty.
|
||||
```zsh
|
||||
% setopt posix_identifiers
|
||||
% antidote -v 3>&1 2>&3 >/dev/null #=> --exit 0
|
||||
|
||||
% antidote -h 3>&1 2>&3 >/dev/null #=> --exit 0
|
||||
|
||||
% antidote help 3>&1 2>&3 >/dev/null #=> --exit 0
|
||||
|
||||
% # cleanup
|
||||
% unsetopt posix_identifiers
|
||||
%
|
||||
```
|
||||
|
||||
## Clark Grizwold lighting ceremony!
|
||||
|
||||
<iframe src="https://giphy.com/embed/gB9wIPXav2Ryg" width="480" height="270" frameBorder="0" class="giphy-embed" allowFullScreen></iframe><p><a href="https://giphy.com/gifs/comedy-retro-christmas-lights-gB9wIPXav2Ryg">via GIPHY</a></p>
|
||||
|
||||
```zsh
|
||||
% optcnt=$(setopt | wc -l | tr -d ' ')
|
||||
% echo $optcnt #=> --regex ^\d+$
|
||||
% test $optcnt -lt 10 && echo "less than 10 enabled zsh opts"
|
||||
less than 10 enabled zsh opts
|
||||
% # now lets turn on all the lights
|
||||
% echo '$ZDOTDIR/custom/plugins/grizwold' >$ZDOTDIR/.zsh_plugins.txt
|
||||
% antidote load
|
||||
% optcnt=$(setopt | wc -l | tr -d ' ')
|
||||
% test $optcnt -gt 150 && echo "zillions of enabled zsh options (>150)"
|
||||
zillions of enabled zsh options (>150)
|
||||
%
|
||||
```
|
||||
|
||||
## Teardown
|
||||
|
||||
```zsh
|
||||
% unsetopt $grizwold_zopts
|
||||
% t_teardown
|
||||
%
|
||||
```
|
||||
25
.antidote/tests/testdata/.zplugins_fake_load.zsh
vendored
Normal file
25
.antidote/tests/testdata/.zplugins_fake_load.zsh
vendored
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
fpath+=( $HOME/.cache/antidote/foo/bar )
|
||||
source $HOME/.cache/antidote/foo/bar/bar.plugin.zsh
|
||||
fpath+=( $HOME/.cache/antidote/foo/qux )
|
||||
source $HOME/.cache/antidote/foo/qux/qux.plugin.zsh
|
||||
fpath+=( $HOME/.cache/antidote/foo/bar )
|
||||
source $HOME/.cache/antidote/foo/bar/bar.plugin.zsh
|
||||
fpath+=( $HOME/.cache/antidote/foo/bar )
|
||||
export PATH="$HOME/.cache/antidote/foo/bar:$PATH"
|
||||
fpath+=( $HOME/.cache/antidote/ohmy/ohmy/lib )
|
||||
source $HOME/.cache/antidote/ohmy/ohmy/lib/lib1.zsh
|
||||
source $HOME/.cache/antidote/ohmy/ohmy/lib/lib2.zsh
|
||||
source $HOME/.cache/antidote/ohmy/ohmy/lib/lib3.zsh
|
||||
fpath+=( $HOME/.cache/antidote/ohmy/ohmy/plugins/extract )
|
||||
source $HOME/.cache/antidote/ohmy/ohmy/plugins/extract/extract.plugin.zsh
|
||||
fpath=( $HOME/.cache/antidote/ohmy/ohmy/plugins/docker $fpath )
|
||||
source $HOME/.cache/antidote/ohmy/ohmy/plugins/docker/docker.plugin.zsh
|
||||
fpath+=( $HOME/.cache/antidote/ohmy/ohmy/plugins/docker )
|
||||
source $HOME/.cache/antidote/ohmy/ohmy/plugins/docker/docker.plugin.zsh
|
||||
if ! (( $+functions[zsh-defer] )); then
|
||||
fpath+=( $HOME/.cache/antidote/getantidote/zsh-defer )
|
||||
source $HOME/.cache/antidote/getantidote/zsh-defer/zsh-defer.plugin.zsh
|
||||
fi
|
||||
fpath+=( $HOME/.cache/antidote/ohmy/ohmy/plugins/magic-enter )
|
||||
zsh-defer source $HOME/.cache/antidote/ohmy/ohmy/plugins/magic-enter/magic-enter.plugin.zsh
|
||||
source $HOME/.cache/antidote/ohmy/ohmy/custom/themes/pretty.zsh-theme
|
||||
34
.antidote/tests/testdata/.zplugins_fake_zcompile_static.zsh
vendored
Normal file
34
.antidote/tests/testdata/.zplugins_fake_zcompile_static.zsh
vendored
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
function {
|
||||
0=${(%):-%x}
|
||||
local staticfile=${0:A}
|
||||
[[ -e ${staticfile} ]] || return 1
|
||||
if [[ ! -s ${staticfile}.zwc || ${staticfile} -nt ${staticfile}.zwc ]]; then
|
||||
builtin autoload -Uz zrecompile
|
||||
zrecompile -pq ${staticfile}
|
||||
fi
|
||||
}
|
||||
fpath+=( $HOME/.cache/antidote/foo/bar )
|
||||
source $HOME/.cache/antidote/foo/bar/bar.plugin.zsh
|
||||
fpath+=( $HOME/.cache/antidote/foo/qux )
|
||||
source $HOME/.cache/antidote/foo/qux/qux.plugin.zsh
|
||||
fpath+=( $HOME/.cache/antidote/foo/bar )
|
||||
source $HOME/.cache/antidote/foo/bar/bar.plugin.zsh
|
||||
fpath+=( $HOME/.cache/antidote/foo/bar )
|
||||
export PATH="$HOME/.cache/antidote/foo/bar:$PATH"
|
||||
fpath+=( $HOME/.cache/antidote/ohmy/ohmy/lib )
|
||||
source $HOME/.cache/antidote/ohmy/ohmy/lib/lib1.zsh
|
||||
source $HOME/.cache/antidote/ohmy/ohmy/lib/lib2.zsh
|
||||
source $HOME/.cache/antidote/ohmy/ohmy/lib/lib3.zsh
|
||||
fpath+=( $HOME/.cache/antidote/ohmy/ohmy/plugins/extract )
|
||||
source $HOME/.cache/antidote/ohmy/ohmy/plugins/extract/extract.plugin.zsh
|
||||
fpath=( $HOME/.cache/antidote/ohmy/ohmy/plugins/docker $fpath )
|
||||
source $HOME/.cache/antidote/ohmy/ohmy/plugins/docker/docker.plugin.zsh
|
||||
fpath+=( $HOME/.cache/antidote/ohmy/ohmy/plugins/docker )
|
||||
source $HOME/.cache/antidote/ohmy/ohmy/plugins/docker/docker.plugin.zsh
|
||||
if ! (( $+functions[zsh-defer] )); then
|
||||
fpath+=( $HOME/.cache/antidote/getantidote/zsh-defer )
|
||||
source $HOME/.cache/antidote/getantidote/zsh-defer/zsh-defer.plugin.zsh
|
||||
fi
|
||||
fpath+=( $HOME/.cache/antidote/ohmy/ohmy/plugins/magic-enter )
|
||||
zsh-defer source $HOME/.cache/antidote/ohmy/ohmy/plugins/magic-enter/magic-enter.plugin.zsh
|
||||
source $HOME/.cache/antidote/ohmy/ohmy/custom/themes/pretty.zsh-theme
|
||||
25
.antidote/tests/testdata/.zsh_plugins.zsh
vendored
Normal file
25
.antidote/tests/testdata/.zsh_plugins.zsh
vendored
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
fpath+=( $HOME/foo/bar )
|
||||
source $HOME/foo/bar/bar.plugin.zsh
|
||||
fpath+=( $ZSH_CUSTOM/plugins/myplugin )
|
||||
source $ZSH_CUSTOM/plugins/myplugin/myplugin.plugin.zsh
|
||||
fpath+=( $HOME/.cache/antidote/foo/bar )
|
||||
source $HOME/.cache/antidote/foo/bar/bar.plugin.zsh
|
||||
fpath+=( $HOME/.cache/antidote/foo/qux )
|
||||
source $HOME/.cache/antidote/foo/qux/qux.plugin.zsh
|
||||
fpath+=( $HOME/.cache/antidote/foo/bar )
|
||||
source $HOME/.cache/antidote/foo/bar/bar.plugin.zsh
|
||||
fpath+=( $HOME/.cache/antidote/foo/bar )
|
||||
export PATH="$HOME/.cache/antidote/foo/bar:$PATH"
|
||||
fpath+=( $HOME/.cache/antidote/ohmy/ohmy/lib )
|
||||
source $HOME/.cache/antidote/ohmy/ohmy/lib/lib1.zsh
|
||||
source $HOME/.cache/antidote/ohmy/ohmy/lib/lib2.zsh
|
||||
source $HOME/.cache/antidote/ohmy/ohmy/lib/lib3.zsh
|
||||
fpath+=( $HOME/.cache/antidote/ohmy/ohmy/plugins/extract )
|
||||
source $HOME/.cache/antidote/ohmy/ohmy/plugins/extract/extract.plugin.zsh
|
||||
if ! (( $+functions[zsh-defer] )); then
|
||||
fpath+=( $HOME/.cache/antidote/getantidote/zsh-defer )
|
||||
source $HOME/.cache/antidote/getantidote/zsh-defer/zsh-defer.plugin.zsh
|
||||
fi
|
||||
fpath+=( $HOME/.cache/antidote/ohmy/ohmy/plugins/magic-enter )
|
||||
zsh-defer source $HOME/.cache/antidote/ohmy/ohmy/plugins/magic-enter/magic-enter.plugin.zsh
|
||||
source $HOME/.cache/antidote/ohmy/ohmy/custom/themes/pretty.zsh-theme
|
||||
2
.antidote/tests/testdata/.zsh_plugins_empty.txt
vendored
Normal file
2
.antidote/tests/testdata/.zsh_plugins_empty.txt
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
# comments
|
||||
# nothing here
|
||||
32
.antidote/tests/testdata/.zsh_plugins_multi_defer.zsh
vendored
Normal file
32
.antidote/tests/testdata/.zsh_plugins_multi_defer.zsh
vendored
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
fpath+=( $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-history-substring-search )
|
||||
source $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-history-substring-search/zsh-history-substring-search.plugin.zsh
|
||||
if ! (( $+functions[zsh-defer] )); then
|
||||
fpath+=( $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-getantidote-SLASH-zsh-defer )
|
||||
source $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-getantidote-SLASH-zsh-defer/zsh-defer.plugin.zsh
|
||||
fi
|
||||
fpath+=( $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-syntax-highlighting )
|
||||
zsh-defer source $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-syntax-highlighting/zsh-syntax-highlighting.plugin.zsh
|
||||
if is-macos; then
|
||||
fpath+=( $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-ohmy-SLASH-ohmy/plugins/macos )
|
||||
source $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-ohmy-SLASH-ohmy/plugins/macos/macos.plugin.zsh
|
||||
fi
|
||||
if ! (( $+functions[zsh-defer] )); then
|
||||
fpath+=( $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-getantidote-SLASH-zsh-defer )
|
||||
source $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-getantidote-SLASH-zsh-defer/zsh-defer.plugin.zsh
|
||||
fi
|
||||
fpath+=( $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-autosuggestions )
|
||||
zsh-defer source $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-autosuggestions/zsh-autosuggestions.plugin.zsh
|
||||
if ! (( $+functions[zsh-defer] )); then
|
||||
fpath+=( $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-getantidote-SLASH-zsh-defer )
|
||||
source $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-getantidote-SLASH-zsh-defer/zsh-defer.plugin.zsh
|
||||
fi
|
||||
fpath+=( $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-zdharma-continuum-SLASH-fast-syntax-highlighting )
|
||||
zsh-defer source $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-zdharma-continuum-SLASH-fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh
|
||||
fpath+=( $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-dracula-SLASH-zsh )
|
||||
source $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-dracula-SLASH-zsh/dracula.zsh-theme
|
||||
fpath+=( $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-peterhurford-SLASH-up.zsh )
|
||||
source $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-peterhurford-SLASH-up.zsh/up.plugin.zsh
|
||||
fpath+=( $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-rummik-SLASH-zsh-tailf )
|
||||
source $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-rummik-SLASH-zsh-tailf/tailf.plugin.zsh
|
||||
fpath+=( $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-rupa-SLASH-z )
|
||||
source $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-rupa-SLASH-z/z.sh
|
||||
20
.antidote/tests/testdata/.zsh_plugins_no_defer.zsh
vendored
Normal file
20
.antidote/tests/testdata/.zsh_plugins_no_defer.zsh
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
fpath+=( $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-history-substring-search )
|
||||
source $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-history-substring-search/zsh-history-substring-search.plugin.zsh
|
||||
fpath+=( $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-syntax-highlighting )
|
||||
source $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-syntax-highlighting/zsh-syntax-highlighting.plugin.zsh
|
||||
if is-macos; then
|
||||
fpath+=( $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-ohmy-SLASH-ohmy/plugins/macos )
|
||||
source $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-ohmy-SLASH-ohmy/plugins/macos/macos.plugin.zsh
|
||||
fi
|
||||
fpath+=( $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-autosuggestions )
|
||||
source $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-autosuggestions/zsh-autosuggestions.plugin.zsh
|
||||
fpath+=( $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-zdharma-continuum-SLASH-fast-syntax-highlighting )
|
||||
source $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-zdharma-continuum-SLASH-fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh
|
||||
fpath+=( $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-dracula-SLASH-zsh )
|
||||
source $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-dracula-SLASH-zsh/dracula.zsh-theme
|
||||
fpath+=( $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-peterhurford-SLASH-up.zsh )
|
||||
source $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-peterhurford-SLASH-up.zsh/up.plugin.zsh
|
||||
fpath+=( $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-rummik-SLASH-zsh-tailf )
|
||||
source $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-rummik-SLASH-zsh-tailf/tailf.plugin.zsh
|
||||
fpath+=( $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-rupa-SLASH-z )
|
||||
source $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-rupa-SLASH-z/z.sh
|
||||
29
.antidote/tests/testdata/.zsh_plugins_purged.txt
vendored
Normal file
29
.antidote/tests/testdata/.zsh_plugins_purged.txt
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
# local plugins
|
||||
~/foo/bar
|
||||
$ZSH_CUSTOM path:plugins/myplugin
|
||||
|
||||
# repo plugins
|
||||
# foo/bar
|
||||
git@github.com:foo/qux.git # trailing comments
|
||||
|
||||
# kind:clone
|
||||
getantidote/zsh-defer kind:clone # more trailing comments
|
||||
|
||||
# kind:zsh
|
||||
# foo/bar kind:zsh
|
||||
|
||||
# kind:fpath
|
||||
# foo/bar kind:fpath
|
||||
|
||||
# kind:path
|
||||
# foo/bar kind:path
|
||||
|
||||
# subpath plugins
|
||||
ohmy/ohmy path:lib
|
||||
ohmy/ohmy path:plugins/extract
|
||||
|
||||
# deferred
|
||||
ohmy/ohmy path:plugins/magic-enter kind:defer
|
||||
|
||||
# theme
|
||||
ohmy/ohmy path:custom/themes/pretty.zsh-theme
|
||||
30
.antidote/tests/testdata/.zsh_plugins_repos.txt
vendored
Normal file
30
.antidote/tests/testdata/.zsh_plugins_repos.txt
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
# comments
|
||||
user/repo
|
||||
|
||||
# blank lines
|
||||
|
||||
# regular repos
|
||||
https://github.com/user/repo
|
||||
http://github.com/user/repo.git
|
||||
https://github.com/user/repo
|
||||
git@github.com:user/repo
|
||||
|
||||
# annotations
|
||||
bar/baz path:plugins/qux
|
||||
bar/baz path:themes/qux.zsh-theme
|
||||
|
||||
# branch
|
||||
foobar/foobar branch:baz
|
||||
|
||||
# defer
|
||||
https://github.com/foo/qux kind:defer
|
||||
https://github.com/foo/baz kind:defer
|
||||
|
||||
# non repos
|
||||
foo
|
||||
~/.zplugins/bar
|
||||
$ZDOTDIR/plugins/bar
|
||||
|
||||
# dupes
|
||||
user/repo
|
||||
https://github.com/user/repo
|
||||
6
.antidote/tests/testdata/real/.zsh_plugins.crlf.txt
vendored
Normal file
6
.antidote/tests/testdata/real/.zsh_plugins.crlf.txt
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
# CRLF file
|
||||
rupa/z
|
||||
zsh-users/zsh-syntax-highlighting
|
||||
zsh-users/zsh-completions
|
||||
zsh-users/zsh-autosuggestions
|
||||
zsh-users/zsh-history-substring-search
|
||||
52
.antidote/tests/testdata/real/.zsh_plugins.txt
vendored
Normal file
52
.antidote/tests/testdata/real/.zsh_plugins.txt
vendored
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
# paths
|
||||
#$ZDOTDIR/aliases.zsh
|
||||
$ZSH_CUSTOM/plugins/myplugin
|
||||
|
||||
# plugins
|
||||
zsh-users/zsh-history-substring-search
|
||||
https://github.com/zsh-users/zsh-autosuggestions
|
||||
|
||||
# git@ repo URLs aren't good for CI... revisit
|
||||
# git@github.com:zsh-users/zsh-completions.git
|
||||
|
||||
# kind:zsh
|
||||
zsh-users/zsh-syntax-highlighting kind:zsh
|
||||
|
||||
# kind:clone
|
||||
zsh-users/antigen kind:clone
|
||||
|
||||
# kind:fpath
|
||||
sindresorhus/pure kind:fpath
|
||||
|
||||
# kind:path
|
||||
romkatv/zsh-bench kind:path
|
||||
|
||||
# kind:autoload
|
||||
mattmc3/zman path:functions kind:autoload
|
||||
|
||||
# fpath-rule
|
||||
ohmyzsh/ohmyzsh path:plugins/gradle fpath-rule:prepend
|
||||
ohmyzsh/ohmyzsh path:plugins/docker fpath-rule:append
|
||||
|
||||
# conditional
|
||||
ohmyzsh/ohmyzsh path:plugins/macos conditional:is-macos
|
||||
|
||||
# branches
|
||||
mattmc3/antidote branch:pz
|
||||
|
||||
# subpath plugins
|
||||
ohmyzsh/ohmyzsh path:lib/clipboard.zsh
|
||||
ohmyzsh/ohmyzsh path:plugins/extract
|
||||
ohmyzsh/ohmyzsh path:plugins/magic-enter
|
||||
ohmyzsh/ohmyzsh path:plugins/fancy-ctrl-z
|
||||
|
||||
# deferred
|
||||
zdharma-continuum/fast-syntax-highlighting kind:defer
|
||||
|
||||
# theme
|
||||
dracula/zsh
|
||||
|
||||
# non-conforming plugins
|
||||
peterhurford/up.zsh
|
||||
rummik/zsh-tailf
|
||||
rupa/z
|
||||
43
.antidote/tests/testdata/real/.zsh_plugins.zsh
vendored
Normal file
43
.antidote/tests/testdata/real/.zsh_plugins.zsh
vendored
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
fpath+=( $ZSH_CUSTOM/plugins/myplugin )
|
||||
source $ZSH_CUSTOM/plugins/myplugin/myplugin.plugin.zsh
|
||||
fpath+=( $ANTIDOTE_HOME/zsh-users/zsh-history-substring-search )
|
||||
source $ANTIDOTE_HOME/zsh-users/zsh-history-substring-search/zsh-history-substring-search.plugin.zsh
|
||||
fpath+=( $ANTIDOTE_HOME/zsh-users/zsh-autosuggestions )
|
||||
source $ANTIDOTE_HOME/zsh-users/zsh-autosuggestions/zsh-autosuggestions.plugin.zsh
|
||||
fpath+=( $ANTIDOTE_HOME/zsh-users/zsh-syntax-highlighting )
|
||||
source $ANTIDOTE_HOME/zsh-users/zsh-syntax-highlighting/zsh-syntax-highlighting.plugin.zsh
|
||||
fpath+=( $ANTIDOTE_HOME/sindresorhus/pure )
|
||||
export PATH="$ANTIDOTE_HOME/romkatv/zsh-bench:$PATH"
|
||||
fpath+=( $ANTIDOTE_HOME/mattmc3/zman/functions )
|
||||
builtin autoload -Uz $fpath[-1]/*(N.:t)
|
||||
fpath=( $ANTIDOTE_HOME/ohmyzsh/ohmyzsh/plugins/gradle $fpath )
|
||||
source $ANTIDOTE_HOME/ohmyzsh/ohmyzsh/plugins/gradle/gradle.plugin.zsh
|
||||
fpath+=( $ANTIDOTE_HOME/ohmyzsh/ohmyzsh/plugins/docker )
|
||||
source $ANTIDOTE_HOME/ohmyzsh/ohmyzsh/plugins/docker/docker.plugin.zsh
|
||||
if is-macos; then
|
||||
fpath+=( $ANTIDOTE_HOME/ohmyzsh/ohmyzsh/plugins/macos )
|
||||
source $ANTIDOTE_HOME/ohmyzsh/ohmyzsh/plugins/macos/macos.plugin.zsh
|
||||
fi
|
||||
fpath+=( $ANTIDOTE_HOME/mattmc3/antidote )
|
||||
source $ANTIDOTE_HOME/mattmc3/antidote/pz.plugin.zsh
|
||||
source $ANTIDOTE_HOME/ohmyzsh/ohmyzsh/lib/clipboard.zsh
|
||||
fpath+=( $ANTIDOTE_HOME/ohmyzsh/ohmyzsh/plugins/extract )
|
||||
source $ANTIDOTE_HOME/ohmyzsh/ohmyzsh/plugins/extract/extract.plugin.zsh
|
||||
fpath+=( $ANTIDOTE_HOME/ohmyzsh/ohmyzsh/plugins/magic-enter )
|
||||
source $ANTIDOTE_HOME/ohmyzsh/ohmyzsh/plugins/magic-enter/magic-enter.plugin.zsh
|
||||
fpath+=( $ANTIDOTE_HOME/ohmyzsh/ohmyzsh/plugins/fancy-ctrl-z )
|
||||
source $ANTIDOTE_HOME/ohmyzsh/ohmyzsh/plugins/fancy-ctrl-z/fancy-ctrl-z.plugin.zsh
|
||||
if ! (( $+functions[zsh-defer] )); then
|
||||
fpath+=( $ANTIDOTE_HOME/romkatv/zsh-defer )
|
||||
source $ANTIDOTE_HOME/romkatv/zsh-defer/zsh-defer.plugin.zsh
|
||||
fi
|
||||
fpath+=( $ANTIDOTE_HOME/zdharma-continuum/fast-syntax-highlighting )
|
||||
zsh-defer source $ANTIDOTE_HOME/zdharma-continuum/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh
|
||||
fpath+=( $ANTIDOTE_HOME/dracula/zsh )
|
||||
source $ANTIDOTE_HOME/dracula/zsh/dracula.zsh-theme
|
||||
fpath+=( $ANTIDOTE_HOME/peterhurford/up.zsh )
|
||||
source $ANTIDOTE_HOME/peterhurford/up.zsh/up.plugin.zsh
|
||||
fpath+=( $ANTIDOTE_HOME/rummik/zsh-tailf )
|
||||
source $ANTIDOTE_HOME/rummik/zsh-tailf/tailf.plugin.zsh
|
||||
fpath+=( $ANTIDOTE_HOME/rupa/z )
|
||||
source $ANTIDOTE_HOME/rupa/z/z.sh
|
||||
15
.antidote/tests/testdata/real/repo-list.txt
vendored
Normal file
15
.antidote/tests/testdata/real/repo-list.txt
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
https://github.com/dracula/zsh $ANTIDOTE_HOME/dracula/zsh
|
||||
https://github.com/mattmc3/antidote $ANTIDOTE_HOME/mattmc3/antidote
|
||||
https://github.com/mattmc3/zman $ANTIDOTE_HOME/mattmc3/zman
|
||||
https://github.com/ohmyzsh/ohmyzsh $ANTIDOTE_HOME/ohmyzsh/ohmyzsh
|
||||
https://github.com/peterhurford/up.zsh $ANTIDOTE_HOME/peterhurford/up.zsh
|
||||
https://github.com/romkatv/zsh-bench $ANTIDOTE_HOME/romkatv/zsh-bench
|
||||
https://github.com/romkatv/zsh-defer $ANTIDOTE_HOME/romkatv/zsh-defer
|
||||
https://github.com/rummik/zsh-tailf $ANTIDOTE_HOME/rummik/zsh-tailf
|
||||
https://github.com/rupa/z $ANTIDOTE_HOME/rupa/z
|
||||
https://github.com/sindresorhus/pure $ANTIDOTE_HOME/sindresorhus/pure
|
||||
https://github.com/zdharma-continuum/fast-syntax-highlighting $ANTIDOTE_HOME/zdharma-continuum/fast-syntax-highlighting
|
||||
https://github.com/zsh-users/antigen $ANTIDOTE_HOME/zsh-users/antigen
|
||||
https://github.com/zsh-users/zsh-autosuggestions $ANTIDOTE_HOME/zsh-users/zsh-autosuggestions
|
||||
https://github.com/zsh-users/zsh-history-substring-search $ANTIDOTE_HOME/zsh-users/zsh-history-substring-search
|
||||
https://github.com/zsh-users/zsh-syntax-highlighting $ANTIDOTE_HOME/zsh-users/zsh-syntax-highlighting
|
||||
2
.antidote/tests/testdata/script-foobar.zsh
vendored
Normal file
2
.antidote/tests/testdata/script-foobar.zsh
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
fpath+=( $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-foo-SLASH-bar )
|
||||
source $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-foo-SLASH-bar/bar.plugin.zsh
|
||||
2
.antidote/tests/testdata/script-fooqux.zsh
vendored
Normal file
2
.antidote/tests/testdata/script-fooqux.zsh
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
fpath+=( $ANTIDOTE_HOME/git-AT-github.com-COLON-foo-SLASH-qux )
|
||||
source $ANTIDOTE_HOME/git-AT-github.com-COLON-foo-SLASH-qux/qux.plugin.zsh
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
echo "sourcing foo/qux..."
|
||||
plugins=($plugins foo/qux)
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
echo "sourcing foo/bar..."
|
||||
plugins=($plugins foo/bar)
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
echo "sourcing foo/baz..."
|
||||
plugins=($plugins foo/baz)
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
#!/bin/zsh
|
||||
echo _baz completion
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
#!/bin/zsh
|
||||
function baz {
|
||||
echo baz function
|
||||
}
|
||||
baz "$@"
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
# fake foo/bar
|
||||
echo "sourcing getantidote/zsh-defer..."
|
||||
plugins=($plugins getantidote/zsh-defer)
|
||||
function zsh-defer {
|
||||
$@
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
echo "sourcing pretty.zsh-theme..."
|
||||
themes=($themes ohmy:pretty)
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
echo "sourcing ugly.zsh-theme..."
|
||||
themes=($themes ohmy:ugly)
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
echo "sourcing ohmy/lib/lib1.zsh..."
|
||||
libs=($libs ohmy:lib1)
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
echo "sourcing ohmy/lib/lib2.zsh..."
|
||||
libs=($libs ohmy:lib2)
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
echo "sourcing ohmy/lib/lib3.zsh..."
|
||||
libs=($libs ohmy:lib2)
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
echo "sourcing oh-my.sh..."
|
||||
plugins=($plugins ohmy/ohmy)
|
||||
|
|
@ -0,0 +1 @@
|
|||
#compdef
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
echo "sourcing docker.plugin.zsh..."
|
||||
plugins+=(ohmy:docker)
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
echo "sourcing extract.plugin.zsh..."
|
||||
plugins+=(ohmy:extract)
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
#!/bin/zsh
|
||||
function macos_func {
|
||||
echo macos_func "$@"
|
||||
}
|
||||
macos_func "$@"
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
echo "sourcing macos.plugin.zsh..."
|
||||
plugins+=(ohmy:macos)
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
echo "sourcing magic-enter.plugin.zsh..."
|
||||
plugins+=(ohmy:magic-enter)
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
echo "sourcing pretty.zsh-theme..."
|
||||
themes=($themes ohmy:pretty)
|
||||
|
|
@ -0,0 +1 @@
|
|||
https://github.com/foo/bar
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
echo "sourcing foo/bar..."
|
||||
plugins=($plugins foo/bar)
|
||||
|
|
@ -0,0 +1 @@
|
|||
https://github.com/foo/baz
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
echo "sourcing foo/baz..."
|
||||
plugins=($plugins foo/baz)
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
#!/bin/zsh
|
||||
echo _baz completion
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
#!/bin/zsh
|
||||
function baz {
|
||||
echo baz function
|
||||
}
|
||||
baz "$@"
|
||||
|
|
@ -0,0 +1 @@
|
|||
git@github.com:foo/qux
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
echo "sourcing foo/qux..."
|
||||
plugins=($plugins foo/qux)
|
||||
|
|
@ -0,0 +1 @@
|
|||
https://github.com/getantidote/zsh-defer
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
# fake foo/bar
|
||||
echo "sourcing getantidote/zsh-defer..."
|
||||
plugins=($plugins getantidote/zsh-defer)
|
||||
function zsh-defer {
|
||||
$@
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
https://github.com/ohmy/ohmy
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
echo "sourcing pretty.zsh-theme..."
|
||||
themes=($themes ohmy:pretty)
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
echo "sourcing ugly.zsh-theme..."
|
||||
themes=($themes ohmy:ugly)
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
echo "sourcing ohmy/lib/lib1.zsh..."
|
||||
libs=($libs ohmy:lib1)
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
echo "sourcing ohmy/lib/lib2.zsh..."
|
||||
libs=($libs ohmy:lib2)
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
echo "sourcing ohmy/lib/lib3.zsh..."
|
||||
libs=($libs ohmy:lib2)
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
echo "sourcing oh-my.sh..."
|
||||
plugins=($plugins ohmy/ohmy)
|
||||
|
|
@ -0,0 +1 @@
|
|||
#compdef
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
echo "sourcing docker.plugin.zsh..."
|
||||
plugins+=(ohmy:docker)
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
echo "sourcing extract.plugin.zsh..."
|
||||
plugins+=(ohmy:extract)
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
#!/bin/zsh
|
||||
function macos_func {
|
||||
echo macos_func "$@"
|
||||
}
|
||||
macos_func "$@"
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
echo "sourcing macos.plugin.zsh..."
|
||||
plugins+=(ohmy:macos)
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
echo "sourcing magic-enter.plugin.zsh..."
|
||||
plugins+=(ohmy:magic-enter)
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
echo "sourcing pretty.zsh-theme..."
|
||||
themes=($themes ohmy:pretty)
|
||||
29
.antidote/tests/tmp_home/.zsh/.zplugins_fake_load
Normal file
29
.antidote/tests/tmp_home/.zsh/.zplugins_fake_load
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
# repo plugins
|
||||
foo/bar
|
||||
git@github.com:foo/qux.git # trailing comments
|
||||
|
||||
# kind:clone
|
||||
getantidote/zsh-defer kind:clone # more trailing comments
|
||||
|
||||
# kind:zsh
|
||||
foo/bar kind:zsh
|
||||
|
||||
# kind:fpath
|
||||
foo/bar kind:fpath
|
||||
|
||||
# kind:path
|
||||
foo/bar kind:path
|
||||
|
||||
# subpath plugins
|
||||
ohmy/ohmy path:lib
|
||||
ohmy/ohmy path:plugins/extract
|
||||
|
||||
# fpath-rule
|
||||
ohmy/ohmy path:plugins/docker fpath-rule:prepend
|
||||
ohmy/ohmy path:plugins/docker fpath-rule:append
|
||||
|
||||
# deferred
|
||||
ohmy/ohmy path:plugins/magic-enter kind:defer
|
||||
|
||||
# theme
|
||||
ohmy/ohmy path:custom/themes/pretty.zsh-theme
|
||||
29
.antidote/tests/tmp_home/.zsh/.zsh_plugins.txt
Normal file
29
.antidote/tests/tmp_home/.zsh/.zsh_plugins.txt
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
# local plugins
|
||||
~/foo/bar
|
||||
$ZSH_CUSTOM path:plugins/myplugin
|
||||
|
||||
# repo plugins
|
||||
foo/bar
|
||||
git@github.com:foo/qux.git # trailing comments
|
||||
|
||||
# kind:clone
|
||||
getantidote/zsh-defer kind:clone # more trailing comments
|
||||
|
||||
# kind:zsh
|
||||
foo/bar kind:zsh
|
||||
|
||||
# kind:fpath
|
||||
foo/bar kind:fpath
|
||||
|
||||
# kind:path
|
||||
foo/bar kind:path
|
||||
|
||||
# subpath plugins
|
||||
ohmy/ohmy path:lib
|
||||
ohmy/ohmy path:plugins/extract
|
||||
|
||||
# deferred
|
||||
ohmy/ohmy path:plugins/magic-enter kind:defer
|
||||
|
||||
# theme
|
||||
ohmy/ohmy path:custom/themes/pretty.zsh-theme
|
||||
1
.antidote/tests/tmp_home/.zsh/aliases.zsh
Normal file
1
.antidote/tests/tmp_home/.zsh/aliases.zsh
Normal file
|
|
@ -0,0 +1 @@
|
|||
echo "sourcing aliases.zsh..."
|
||||
2
.antidote/tests/tmp_home/.zsh/custom/lib/lib1.zsh
Normal file
2
.antidote/tests/tmp_home/.zsh/custom/lib/lib1.zsh
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
echo "sourcing custom lib1.zsh..."
|
||||
libs=($libs custom:lib1)
|
||||
2
.antidote/tests/tmp_home/.zsh/custom/lib/lib2.zsh
Normal file
2
.antidote/tests/tmp_home/.zsh/custom/lib/lib2.zsh
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
echo "sourcing custom lib2.zsh..."
|
||||
libs=($libs custom:lib2)
|
||||
|
|
@ -0,0 +1,187 @@
|
|||
() {
|
||||
setopt interactivecomments
|
||||
typeset -ga grizwold_zopts=(
|
||||
noaliases
|
||||
aliasfuncdef
|
||||
allexport
|
||||
noalwayslastprompt
|
||||
alwaystoend
|
||||
appendcreate
|
||||
noappendhistory
|
||||
autocd
|
||||
autocontinue
|
||||
noautolist
|
||||
noautomenu
|
||||
autonamedirs
|
||||
noautoparamkeys
|
||||
noautoparamslash
|
||||
autopushd
|
||||
noautoremoveslash
|
||||
autoresume
|
||||
nobadpattern
|
||||
nobanghist
|
||||
nobareglobqual
|
||||
bashautolist
|
||||
bashrematch
|
||||
nobeep
|
||||
nobgnice
|
||||
braceccl
|
||||
bsdecho
|
||||
nocaseglob
|
||||
nocasematch
|
||||
cbases
|
||||
cdablevars
|
||||
cdsilent
|
||||
chasedots
|
||||
chaselinks
|
||||
nocheckjobs
|
||||
nocheckrunningjobs
|
||||
# noclobber
|
||||
combiningchars
|
||||
completealiases
|
||||
completeinword
|
||||
continueonerror
|
||||
correct
|
||||
correctall
|
||||
cprecedences
|
||||
cshjunkiehistory
|
||||
cshjunkieloops
|
||||
cshjunkiequotes
|
||||
cshnullcmd
|
||||
cshnullglob
|
||||
nodebugbeforecmd
|
||||
dvorak
|
||||
emacs
|
||||
noequals
|
||||
# errexit
|
||||
# errreturn
|
||||
noevallineno
|
||||
# noexec
|
||||
extendedglob
|
||||
extendedhistory
|
||||
noflowcontrol
|
||||
# forcefloat
|
||||
nofunctionargzero
|
||||
noglob
|
||||
noglobalexport
|
||||
# noglobalrcs
|
||||
globassign
|
||||
globcomplete
|
||||
globdots
|
||||
globstarshort
|
||||
globsubst
|
||||
nohashcmds
|
||||
nohashdirs
|
||||
hashexecutablesonly
|
||||
nohashlistall
|
||||
histallowclobber
|
||||
nohistbeep
|
||||
histexpiredupsfirst
|
||||
histfcntllock
|
||||
histfindnodups
|
||||
histignorealldups
|
||||
histignoredups
|
||||
histignorespace
|
||||
histlexwords
|
||||
histnofunctions
|
||||
histnostore
|
||||
histreduceblanks
|
||||
nohistsavebycopy
|
||||
histsavenodups
|
||||
histsubstpattern
|
||||
histverify
|
||||
nohup
|
||||
ignorebraces
|
||||
ignoreclosebraces
|
||||
ignoreeof
|
||||
incappendhistory
|
||||
incappendhistorytime
|
||||
# interactive
|
||||
interactivecomments
|
||||
# ksharrays
|
||||
kshautoload
|
||||
kshglob
|
||||
# kshoptionprint
|
||||
kshtypeset
|
||||
kshzerosubscript
|
||||
nolistambiguous
|
||||
nolistbeep
|
||||
listpacked
|
||||
listrowsfirst
|
||||
nolisttypes
|
||||
localloops
|
||||
# localoptions
|
||||
localpatterns
|
||||
localtraps
|
||||
# login
|
||||
longlistjobs
|
||||
magicequalsubst
|
||||
mailwarning
|
||||
markdirs
|
||||
menucomplete
|
||||
# monitor
|
||||
nomultibyte
|
||||
nomultifuncdef
|
||||
nomultios
|
||||
nonomatch
|
||||
nonotify
|
||||
nullglob
|
||||
numericglobsort
|
||||
octalzeroes
|
||||
overstrike
|
||||
pathdirs
|
||||
pathscript
|
||||
pipefail
|
||||
posixaliases
|
||||
posixargzero
|
||||
posixbuiltins
|
||||
posixcd
|
||||
posixidentifiers
|
||||
posixjobs
|
||||
# posixstrings
|
||||
posixtraps
|
||||
printeightbit
|
||||
printexitvalue
|
||||
# privileged
|
||||
promptbang
|
||||
nopromptcr
|
||||
# nopromptpercent
|
||||
nopromptsp
|
||||
promptsubst
|
||||
pushdignoredups
|
||||
pushdminus
|
||||
pushdsilent
|
||||
pushdtohome
|
||||
rcexpandparam
|
||||
rcquotes
|
||||
# norcs
|
||||
recexact
|
||||
rematchpcre
|
||||
# restricted
|
||||
rmstarsilent
|
||||
rmstarwait
|
||||
sharehistory
|
||||
shfileexpansion
|
||||
shglob
|
||||
# shinstdin
|
||||
shnullcmd
|
||||
shoptionletters
|
||||
noshortloops
|
||||
shwordsplit
|
||||
# singlecommand
|
||||
singlelinezle
|
||||
# sourcetrace
|
||||
sunkeyboardhack
|
||||
transientrprompt
|
||||
trapsasync
|
||||
typesetsilent
|
||||
nounset
|
||||
# verbose
|
||||
# vi
|
||||
warncreateglobal
|
||||
warnnestedvar
|
||||
# xtrace
|
||||
# zle
|
||||
)
|
||||
setopt $grizwold_zopts
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue