removed windows and linux split subdir
This commit is contained in:
parent
83dda10fa8
commit
065b982734
280 changed files with 9053 additions and 426 deletions
16
.antidote/.bumpversion.cfg
Normal file
16
.antidote/.bumpversion.cfg
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
[bumpversion]
|
||||||
|
current_version = 1.9.7
|
||||||
|
parse = v?(?P<major>\d+)\.(?P<minor>\d+)\.(?P<revision>\d+)
|
||||||
|
serialize = {major}.{minor}.{revision}
|
||||||
|
|
||||||
|
[bumpversion:file:functions/__antidote_version]
|
||||||
|
|
||||||
|
[bumpversion:file:tests/README.md]
|
||||||
|
|
||||||
|
[bumpversion:file:tests/test_antidote.md]
|
||||||
|
|
||||||
|
[bumpversion:file:tests/test_antidote_core.md]
|
||||||
|
|
||||||
|
[bumpversion:file:tests/test_cmd_update.md]
|
||||||
|
|
||||||
|
[bumpversion:file:README.md]
|
||||||
19
.antidote/.editorconfig
Normal file
19
.antidote/.editorconfig
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
end_of_line = lf
|
||||||
|
insert_final_newline = true
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
|
||||||
|
[*.crlf.*]
|
||||||
|
end_of_line = crlf
|
||||||
|
|
||||||
|
[*.md]
|
||||||
|
trim_trailing_whitespace = false
|
||||||
|
|
||||||
|
[makefile]
|
||||||
|
indent_style = tab
|
||||||
|
indent_size = 4
|
||||||
77
.antidote/.github/CODE_OF_CONDUCT.md
vendored
Normal file
77
.antidote/.github/CODE_OF_CONDUCT.md
vendored
Normal file
|
|
@ -0,0 +1,77 @@
|
||||||
|
|
||||||
|
# Contributor Covenant Code of Conduct
|
||||||
|
|
||||||
|
## Our Pledge
|
||||||
|
|
||||||
|
In the interest of fostering an open and welcoming environment, we as
|
||||||
|
contributors and maintainers pledge to make participation in our project and
|
||||||
|
our community a harassment-free experience for everyone, regardless of age, body
|
||||||
|
size, disability, ethnicity, sex characteristics, gender identity and expression,
|
||||||
|
level of experience, education, socio-economic status, nationality, personal
|
||||||
|
appearance, race, religion, or sexual identity and orientation.
|
||||||
|
|
||||||
|
## Our Standards
|
||||||
|
|
||||||
|
Examples of behavior that contributes to creating a positive environment
|
||||||
|
include:
|
||||||
|
|
||||||
|
* Using welcoming and inclusive language
|
||||||
|
* Being respectful of differing viewpoints and experiences
|
||||||
|
* Gracefully accepting constructive criticism
|
||||||
|
* Focusing on what is best for the community
|
||||||
|
* Showing empathy towards other community members
|
||||||
|
|
||||||
|
Examples of unacceptable behavior by participants include:
|
||||||
|
|
||||||
|
* The use of sexualized language or imagery and unwelcome sexual attention or
|
||||||
|
advances
|
||||||
|
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||||
|
* Public or private harassment
|
||||||
|
* Publishing others' private information, such as a physical or electronic
|
||||||
|
address, without explicit permission
|
||||||
|
* Other conduct which could reasonably be considered inappropriate in a
|
||||||
|
professional setting
|
||||||
|
|
||||||
|
## Our Responsibilities
|
||||||
|
|
||||||
|
Project maintainers are responsible for clarifying the standards of acceptable
|
||||||
|
behavior and are expected to take appropriate and fair corrective action in
|
||||||
|
response to any instances of unacceptable behavior.
|
||||||
|
|
||||||
|
Project maintainers have the right and responsibility to remove, edit, or
|
||||||
|
reject comments, commits, code, wiki edits, issues, and other contributions
|
||||||
|
that are not aligned to this Code of Conduct, or to ban temporarily or
|
||||||
|
permanently any contributor for other behaviors that they deem inappropriate,
|
||||||
|
threatening, offensive, or harmful.
|
||||||
|
|
||||||
|
## Scope
|
||||||
|
|
||||||
|
This Code of Conduct applies within all project spaces, and it also applies when
|
||||||
|
an individual is representing the project or its community in public spaces.
|
||||||
|
Examples of representing a project or community include using an official
|
||||||
|
project e-mail address, posting via an official social media account, or acting
|
||||||
|
as an appointed representative at an online or offline event. Representation of
|
||||||
|
a project may be further defined and clarified by project maintainers.
|
||||||
|
|
||||||
|
## Enforcement
|
||||||
|
|
||||||
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||||
|
reported by contacting the project team at getantidote@gmail.com. All
|
||||||
|
complaints will be reviewed and investigated and will result in a response that
|
||||||
|
is deemed necessary and appropriate to the circumstances. The project team is
|
||||||
|
obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||||
|
Further details of specific enforcement policies may be posted separately.
|
||||||
|
|
||||||
|
Project maintainers who do not follow or enforce the Code of Conduct in good
|
||||||
|
faith may face temporary or permanent repercussions as determined by other
|
||||||
|
members of the project's leadership.
|
||||||
|
|
||||||
|
## Attribution
|
||||||
|
|
||||||
|
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
||||||
|
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
||||||
|
|
||||||
|
[homepage]: https://www.contributor-covenant.org
|
||||||
|
|
||||||
|
For answers to common questions about this code of conduct, see
|
||||||
|
https://www.contributor-covenant.org/faq
|
||||||
23
.antidote/.github/workflows/test.yml
vendored
Normal file
23
.antidote/.github/workflows/test.yml
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
name: test
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
pull_request:
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: [macos-latest, ubuntu-latest]
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
repository: "aureliojargas/clitest"
|
||||||
|
path: bin/clitest
|
||||||
|
- run: sudo apt install zsh
|
||||||
|
if: ${{ runner.os == 'Linux' }}
|
||||||
|
- run: PATH=$GITHUB_WORKSPACE/bin/clitest:$PATH make test
|
||||||
|
shell: zsh {0}
|
||||||
12
.antidote/.gitignore
vendored
Normal file
12
.antidote/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
~*
|
||||||
|
*.zwc
|
||||||
|
*.zwc.old
|
||||||
|
.cache/
|
||||||
|
!/tests/**/.cache/
|
||||||
|
.tmp/
|
||||||
|
.plugins/
|
||||||
|
.todo/
|
||||||
|
sandbox/
|
||||||
|
*.old
|
||||||
|
**/realzdotdir/zsh_plugins.zsh
|
||||||
|
foo*.*
|
||||||
22
.antidote/LICENSE
Normal file
22
.antidote/LICENSE
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2015-2017 Carlos Alexandro Becker
|
||||||
|
Copyright (c) 2021-2024 Matt McElheny
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
161
.antidote/README.md
Normal file
161
.antidote/README.md
Normal file
|
|
@ -0,0 +1,161 @@
|
||||||
|
# antidote
|
||||||
|
|
||||||
|
[](/LICENSE)
|
||||||
|

|
||||||
|
|
||||||
|
<a title="GetAntidote"
|
||||||
|
href="https://antidote.sh"
|
||||||
|
align="right">
|
||||||
|
<img align="right"
|
||||||
|
height="80"
|
||||||
|
alt="GetAntidote Logo"
|
||||||
|
src="https://avatars.githubusercontent.com/u/101279220?s=80&v=4">
|
||||||
|
</a>
|
||||||
|
|
||||||
|
> [Get the cure][antidote]</blockquote>
|
||||||
|
|
||||||
|
[Antidote][antidote] is a feature-complete Zsh implementation of the legacy
|
||||||
|
[Antibody][antibody] plugin manager, which in turn was derived from [Antigen][antigen].
|
||||||
|
Antidote not only aims to provide continuity for those legacy plugin managers, but also
|
||||||
|
to delight new users with high-performance, easy-to-use Zsh plugin management.
|
||||||
|
|
||||||
|
## NOTICE
|
||||||
|
|
||||||
|
**The planned upcoming 2.0 release will stop defaulting to compatibility with
|
||||||
|
antibody.** If maintaining compatibility with antibody is important to you, you can
|
||||||
|
ensure that your config remains compatible by add the following `zstyle` to your config
|
||||||
|
**now**, before the 2.0 release goes live:
|
||||||
|
|
||||||
|
```zsh
|
||||||
|
zstyle ':antidote:compatibility-mode' 'antibody' 'on'
|
||||||
|
```
|
||||||
|
|
||||||
|
Breaking compatibility by default will allow antidote to continue to grow and gain new
|
||||||
|
features, as well as fix some long-standing issues that have always been present in
|
||||||
|
antibody, for example:
|
||||||
|
|
||||||
|
- In 2.0, `fpath` can be fully set at the beginning of your bundles in you static file,
|
||||||
|
making setting up completion bundles properly way easier and less frustrating
|
||||||
|
([#74](https://github.com/mattmc3/antidote/discussions/74),
|
||||||
|
[#144](https://github.com/mattmc3/antidote/issues/144)).
|
||||||
|
- bundles will no longer default to using fugly directory names
|
||||||
|
($ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-foo-SLASH-bar), making
|
||||||
|
`zstyle ':antidote:bundle' use-friendly-names on` obsolete.
|
||||||
|
- probably some other minor deviations as well
|
||||||
|
|
||||||
|
Just to be clear, if you don't specifically care about backwards compatibility with
|
||||||
|
antibody, you do not need to change a thing. 2.x will not break your 1.x antidote
|
||||||
|
config. If you do care, be sure to add the compatibility mode `zstyle` above to your
|
||||||
|
config **now**, before the 2.0 release.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
Basic usage should look really familiar to you if you have used Antibody or Antigen.
|
||||||
|
Bundles (aka: Zsh plugins) are stored in a file typically called `.zsh_plugins.txt`.
|
||||||
|
|
||||||
|
```zsh
|
||||||
|
# .zsh_plugins.txt
|
||||||
|
rupa/z # some bash plugins work too
|
||||||
|
sindresorhus/pure # enhance your prompt
|
||||||
|
|
||||||
|
# you can even use Oh My Zsh plugins
|
||||||
|
getantidote/use-omz
|
||||||
|
ohmyzsh/ohmyzsh path:lib
|
||||||
|
ohmyzsh/ohmyzsh path:plugins/extract
|
||||||
|
|
||||||
|
# add fish-like features
|
||||||
|
zsh-users/zsh-syntax-highlighting
|
||||||
|
zsh-users/zsh-autosuggestions
|
||||||
|
zsh-users/zsh-history-substring-search
|
||||||
|
```
|
||||||
|
|
||||||
|
A typical `.zshrc` might then look like:
|
||||||
|
|
||||||
|
```zsh
|
||||||
|
# .zshrc
|
||||||
|
source /path-to-antidote/antidote.zsh
|
||||||
|
antidote load ${ZDOTDIR:-$HOME}/.zsh_plugins.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
The full documentation can be found at [https://antidote.sh][antidote].
|
||||||
|
|
||||||
|
## Help getting started
|
||||||
|
|
||||||
|
If you want to see a full-featured example Zsh configuration using antidote, you can
|
||||||
|
have a look at this [example zdotdir](https://github.com/getantidote/zdotdir) project.
|
||||||
|
Feel free to incorporate code or plugins from it into your own dotfiles, or you can fork
|
||||||
|
it to get started building your own Zsh config from scratch driven by antidote.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
### Install with git
|
||||||
|
|
||||||
|
You can install the latest release of antidote by cloning it with `git`:
|
||||||
|
|
||||||
|
```zsh
|
||||||
|
# first, run this from an interactive zsh terminal session:
|
||||||
|
git clone --depth=1 https://github.com/mattmc3/antidote.git ${ZDOTDIR:-$HOME}/.antidote
|
||||||
|
```
|
||||||
|
|
||||||
|
### Install with a package manager
|
||||||
|
|
||||||
|
antidote may also be available in your system's package manager:
|
||||||
|
|
||||||
|
- [macOS homebrew](https://formulae.brew.sh/formula/antidote): `brew install antidote`
|
||||||
|
- [Arch AUR](https://aur.archlinux.org/packages/zsh-antidote): `yay -S zsh-antidote`
|
||||||
|
- [Nix Home-Manager](https://mipmip.github.io/home-manager-option-search/?query=antidote) : `programs.zsh.antidote.enable = true;`
|
||||||
|
|
||||||
|
## Performance
|
||||||
|
|
||||||
|
antidote supports ultra-high performance plugin loads using a static plugin file.
|
||||||
|
It also allows deferred loading for [plugins that support it](https://github.com/romkatv/zsh-defer#caveats).
|
||||||
|
|
||||||
|
```zsh
|
||||||
|
# .zsh_plugins.txt
|
||||||
|
# some plugins support deferred loading
|
||||||
|
zdharma-continuum/fast-syntax-highlighting kind:defer
|
||||||
|
zsh-users/zsh-autosuggestions kind:defer
|
||||||
|
zsh-users/zsh-history-substring-search kind:defer
|
||||||
|
```
|
||||||
|
|
||||||
|
```zsh
|
||||||
|
# .zshrc
|
||||||
|
# Lazy-load antidote and generate the static load file only when needed
|
||||||
|
zsh_plugins=${ZDOTDIR:-$HOME}/.zsh_plugins
|
||||||
|
if [[ ! ${zsh_plugins}.zsh -nt ${zsh_plugins}.txt ]]; then
|
||||||
|
(
|
||||||
|
source /path-to-antidote/antidote.zsh
|
||||||
|
antidote bundle <${zsh_plugins}.txt >${zsh_plugins}.zsh
|
||||||
|
)
|
||||||
|
fi
|
||||||
|
source ${zsh_plugins}.zsh
|
||||||
|
```
|
||||||
|
|
||||||
|
## Benchmarks
|
||||||
|
|
||||||
|
You can see how antidote compares with other setups [here][benchmarks].
|
||||||
|
|
||||||
|
## Plugin authors
|
||||||
|
|
||||||
|
If you authored a Zsh plugin, the recommended snippet for antidote is:
|
||||||
|
|
||||||
|
```zsh
|
||||||
|
antidote install gh_user/gh_repo
|
||||||
|
```
|
||||||
|
|
||||||
|
If your plugin is hosted somewhere other than GitHub, you can use this:
|
||||||
|
|
||||||
|
```zsh
|
||||||
|
antidote install https://bitbucket.org/bb_user/bb_repo
|
||||||
|
```
|
||||||
|
|
||||||
|
## Credits
|
||||||
|
|
||||||
|
A big thank you to [Carlos](https://github.com/caarlos0) for all his work on
|
||||||
|
[antibody] over the years.
|
||||||
|
|
||||||
|
[antigen]: https://github.com/zsh-users/antigen
|
||||||
|
[antibody]: https://github.com/getantibody/antibody
|
||||||
|
[antidote]: https://antidote.sh
|
||||||
|
[benchmarks]: https://github.com/romkatv/zsh-bench/blob/master/doc/linux-desktop.md
|
||||||
|
[zsh]: https://www.zsh.org
|
||||||
17
.antidote/antidote
Normal file
17
.antidote/antidote
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
#!/bin/zsh
|
||||||
|
|
||||||
|
### antidote - the cure to slow zsh plugin management
|
||||||
|
#
|
||||||
|
# https://antidote.sh
|
||||||
|
# run `antidote -h` for usage
|
||||||
|
#
|
||||||
|
# Note: this gets overridden if using `antidote init`.
|
||||||
|
#
|
||||||
|
function antidote {
|
||||||
|
0=${(%):-%x}
|
||||||
|
if ! typeset -f antidote-main > /dev/null; then
|
||||||
|
source ${0:A:h}/antidote.zsh
|
||||||
|
fi
|
||||||
|
antidote-main "$@"
|
||||||
|
}
|
||||||
|
antidote "$@"
|
||||||
17
.antidote/antidote.zsh
Normal file
17
.antidote/antidote.zsh
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
# shell prereq
|
||||||
|
if test -z "$ZSH_VERSION"; then
|
||||||
|
shellname=$(ps -p $$ -oargs= | awk 'NR=1{print $1}')
|
||||||
|
echo >&2 "antidote: Expecting zsh. Found '$shellname'."
|
||||||
|
return 1
|
||||||
|
else
|
||||||
|
builtin autoload -Uz is-at-least
|
||||||
|
if ! is-at-least 5.4.2; then
|
||||||
|
echo >&2 "antidote: Unsupported Zsh version '$ZSH_VERSION'. Expecting Zsh >5.4.2."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
typeset -f __antidote_setup &>/dev/null && unfunction __antidote_setup
|
||||||
|
0=${(%):-%N}
|
||||||
|
builtin autoload -Uz ${0:A:h}/functions/__antidote_setup
|
||||||
|
__antidote_setup
|
||||||
|
fi
|
||||||
38
.antidote/functions/__antidote_bulk_clone
Normal file
38
.antidote/functions/__antidote_bulk_clone
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
#!/bin/zsh
|
||||||
|
|
||||||
|
### Generate background clone commands
|
||||||
|
#function __antidote_bulk_clone {
|
||||||
|
emulate -L zsh; setopt local_options $_adote_funcopts
|
||||||
|
|
||||||
|
# Allow the user to define zsh-defer repo in case they want to fork it.
|
||||||
|
local zsh_defer_bundle
|
||||||
|
zstyle -s ':antidote:defer' bundle 'zsh_defer_bundle' \
|
||||||
|
|| zsh_defer_bundle='romkatv/zsh-defer'
|
||||||
|
|
||||||
|
# get a list of clonable repos from a bundle file
|
||||||
|
$__adote_awkcmd -v ZSH_DEFER_BUNDLE=$zsh_defer_bundle '
|
||||||
|
BEGIN { RS="[\r\n]" }
|
||||||
|
|
||||||
|
# initialize vars
|
||||||
|
{ bundle=""; opts="--kind clone" }
|
||||||
|
|
||||||
|
# skip blank or commented lines
|
||||||
|
/^ *(#.+)?$/ { next }
|
||||||
|
|
||||||
|
# clone zsh-defer
|
||||||
|
/kind:defer/ { print "antidote-script --kind clone " ZSH_DEFER_BUNDLE " &" }
|
||||||
|
|
||||||
|
# handle user/repo and URL forms
|
||||||
|
$1~/^[^\/]+\/[^\/]+$/ { bundle=$1 }
|
||||||
|
$1~/^(https?:|(ssh|git)@)/ { bundle=$1 }
|
||||||
|
|
||||||
|
# find branch annotation if it exists
|
||||||
|
match($0, /branch:[^\t ]+/) { opts=opts " --branch " substr($0, RSTART+7, RLENGTH-7) }
|
||||||
|
|
||||||
|
# print result
|
||||||
|
bundle!=""{ print "antidote-script", opts, bundle, "&" }
|
||||||
|
|
||||||
|
END { print "wait" }
|
||||||
|
|
||||||
|
' "$@" | sort | uniq
|
||||||
|
#}
|
||||||
46
.antidote/functions/__antidote_bundle_dir
Normal file
46
.antidote/functions/__antidote_bundle_dir
Normal file
|
|
@ -0,0 +1,46 @@
|
||||||
|
#!/bin/zsh
|
||||||
|
|
||||||
|
### Get the name of the bundle dir.
|
||||||
|
#function __antidote_bundle_dir {
|
||||||
|
emulate -L zsh; setopt local_options $_adote_funcopts
|
||||||
|
|
||||||
|
# If the bundle is a repo/URL, then by default we use the legacy antibody format:
|
||||||
|
# `$ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-autosuggestions`
|
||||||
|
# With `zstyle ':antidote:bundle' use-friendly-names on`, we can simplify to
|
||||||
|
# `$ANTIDOTE_HOME/zsh-users/zsh-autosuggestions`
|
||||||
|
# If the bundle is a file, use its parent directory.
|
||||||
|
# Otherwise, just assume the bundle is a directory.
|
||||||
|
local MATCH MBEGIN MEND; local -a match mbegin mend # appease 'warn_create_global'
|
||||||
|
|
||||||
|
local bundle="$1"
|
||||||
|
local bundle_type="$(__antidote_bundle_type $bundle)"
|
||||||
|
|
||||||
|
# handle repo bundle paths
|
||||||
|
if [[ "$bundle_type" == (repo|url|sshurl) ]] && [[ ! -e "$bundle_path" ]]; then
|
||||||
|
if zstyle -t ':antidote:bundle' use-friendly-names; then
|
||||||
|
# user/repo format
|
||||||
|
# ex: $ANTIDOTE_HOME/zsh-users/zsh-autosuggestions
|
||||||
|
bundle=${bundle%.git}
|
||||||
|
bundle=${bundle:gs/\:/\/}
|
||||||
|
local parts=( ${(ps./.)bundle} )
|
||||||
|
if [[ $#parts -gt 1 ]]; then
|
||||||
|
print $(antidote-home)/${parts[-2]}/${parts[-1]}
|
||||||
|
else
|
||||||
|
print $(antidote-home)/$bundle
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# sanitize URL for safe use as a dir name
|
||||||
|
# ex: $ANTIDOTE_HOME/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-autosuggestions
|
||||||
|
local url=$(__antidote_tourl $bundle)
|
||||||
|
url=${url%.git}
|
||||||
|
url=${url:gs/\@/-AT-}
|
||||||
|
url=${url:gs/\:/-COLON-}
|
||||||
|
url=${url:gs/\//-SLASH-}
|
||||||
|
print $(antidote-home)/$url
|
||||||
|
fi
|
||||||
|
elif [[ -f "$bundle" ]]; then
|
||||||
|
print ${bundle:A:h}
|
||||||
|
else
|
||||||
|
print ${bundle}
|
||||||
|
fi
|
||||||
|
#}
|
||||||
17
.antidote/functions/__antidote_bundle_name
Normal file
17
.antidote/functions/__antidote_bundle_name
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
#!/bin/zsh
|
||||||
|
|
||||||
|
### Get the short name of the bundle.
|
||||||
|
#function __antidote_bundle_name {
|
||||||
|
emulate -L zsh; setopt local_options $_adote_funcopts
|
||||||
|
local MATCH MBEGIN MEND; local -a match mbegin mend # appease 'warn_create_global'
|
||||||
|
local bundle=$1
|
||||||
|
local bundle_type="$(__antidote_bundle_type $bundle)"
|
||||||
|
if [[ "$bundle_type" == (url|sshurl) ]] ; then
|
||||||
|
bundle=${bundle%.git}
|
||||||
|
bundle=${bundle:gs/\:/\/}
|
||||||
|
local parts=(${(ps./.)bundle})
|
||||||
|
print ${parts[-2]}/${parts[-1]}
|
||||||
|
else
|
||||||
|
print $bundle | sed -e "s|^\~/|$HOME/|" -e "s|^$HOME|\$HOME|"
|
||||||
|
fi
|
||||||
|
#}
|
||||||
47
.antidote/functions/__antidote_bundle_type
Normal file
47
.antidote/functions/__antidote_bundle_type
Normal file
|
|
@ -0,0 +1,47 @@
|
||||||
|
#!/bin/zsh
|
||||||
|
|
||||||
|
### Determine bundle type:
|
||||||
|
### - ? - unknown
|
||||||
|
### - empty - empty string
|
||||||
|
### - file - an existing file
|
||||||
|
### - dir - an existing directory
|
||||||
|
### - path - an non-existant path
|
||||||
|
### - relpath - a relative path
|
||||||
|
### - repo - a git repo (user/repo format)
|
||||||
|
### - sshurl - a git repo (SSH format)
|
||||||
|
### - url - a git repo (URL format)
|
||||||
|
### - word - a word
|
||||||
|
#function __antidote_bundle_type {
|
||||||
|
emulate -L zsh; setopt local_options $_adote_funcopts
|
||||||
|
local bundle=$1
|
||||||
|
|
||||||
|
# Try to expand path bundles with '$' and '~' prefixes so that we get a more
|
||||||
|
# granular result than 'path'.
|
||||||
|
if [[ $bundle == '~/'* ]]; then
|
||||||
|
bundle="${HOME}/${bundle#\~/*}"
|
||||||
|
elif [[ $bundle == '$'* ]] && [[ $bundle != *'('* ]] && [[ $bundle != *';'* ]]; then
|
||||||
|
bundle=$(eval print $bundle)
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Determine the bundle type.
|
||||||
|
local result
|
||||||
|
if [[ -e "$bundle" ]]; then
|
||||||
|
[[ -f $bundle ]] && result=file || result=dir
|
||||||
|
elif [[ -z "${bundle// }" ]]; then
|
||||||
|
result=empty
|
||||||
|
else
|
||||||
|
case "$bundle" in
|
||||||
|
(/|~|'$')*) result=path ;;
|
||||||
|
*://*) result=url ;;
|
||||||
|
*@*:*/*) result=sshurl ;;
|
||||||
|
*(:|@)*) result='?' ;;
|
||||||
|
*/*/*) result=relpath ;;
|
||||||
|
*/) result=relpath ;;
|
||||||
|
*/*) result=repo ;;
|
||||||
|
*) result=word ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
typeset -g REPLY=$result
|
||||||
|
print $result
|
||||||
|
#}
|
||||||
27
.antidote/functions/__antidote_bundle_zcompile
Normal file
27
.antidote/functions/__antidote_bundle_zcompile
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
#!/bin/zsh
|
||||||
|
|
||||||
|
### Compile bundles
|
||||||
|
#function __antidote_bundle_zcompile {
|
||||||
|
emulate -L zsh; setopt local_options $_adote_funcopts
|
||||||
|
builtin autoload -Uz zrecompile
|
||||||
|
|
||||||
|
local -a bundles
|
||||||
|
if [[ -z "$1" ]]; then
|
||||||
|
bundles=($(antidote-list --dirs))
|
||||||
|
elif [[ -f "$1" ]]; then
|
||||||
|
zrecompile -pq "$1"
|
||||||
|
return
|
||||||
|
elif [[ -d "$1" ]]; then
|
||||||
|
bundles=($1)
|
||||||
|
else
|
||||||
|
bundles=($(antidote-path "$1"))
|
||||||
|
fi
|
||||||
|
|
||||||
|
local bundle zfile
|
||||||
|
for bundle in $bundles; do
|
||||||
|
for zfile in ${bundle}/**/*.zsh{,-theme}(N); do
|
||||||
|
[[ $zfile != */test-data/* ]] || continue
|
||||||
|
zrecompile -pq "$zfile"
|
||||||
|
done
|
||||||
|
done
|
||||||
|
# }
|
||||||
15
.antidote/functions/__antidote_collect_input
Normal file
15
.antidote/functions/__antidote_collect_input
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
#!/bin/zsh
|
||||||
|
|
||||||
|
### Collect <redirected or piped| input
|
||||||
|
#function __antidote_collect_input {
|
||||||
|
local -a input=()
|
||||||
|
if (( $# > 0 )); then
|
||||||
|
input=("${(s.\n.)${@}}")
|
||||||
|
elif [[ ! -t 0 ]]; then
|
||||||
|
local data
|
||||||
|
while IFS= read -r data || [[ -n "$data" ]]; do
|
||||||
|
input+=("$data")
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
printf '%s\n' "${input[@]}"
|
||||||
|
#}
|
||||||
32
.antidote/functions/__antidote_del
Normal file
32
.antidote/functions/__antidote_del
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
#!/bin/zsh
|
||||||
|
# Call me paranoid, but I want to be really certain antidote will never rm something it
|
||||||
|
# shouldn't. This function wraps rm to double check that any paths being removed are
|
||||||
|
# valid. If it's not in your $HOME or $TMPDIR, we need to block it.
|
||||||
|
|
||||||
|
#function __antidote_del {
|
||||||
|
emulate -L zsh; setopt local_options
|
||||||
|
|
||||||
|
local -a rmflags rmpaths
|
||||||
|
local p
|
||||||
|
|
||||||
|
while (( $# )); do
|
||||||
|
case "$1" in
|
||||||
|
--) shift; break ;;
|
||||||
|
-*) rmflags+=($1) ;;
|
||||||
|
*) break ;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
|
(( $# > 0 )) || return 1
|
||||||
|
|
||||||
|
for p in $@; do
|
||||||
|
p="${p:a}"
|
||||||
|
if [[ "$p" != $HOME/* ]] && [[ "$p" != ${TMPDIR:-/tmp}/* ]]; then
|
||||||
|
print -ru2 -- "antidote: Blocked attempt to rm path: '$p'."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
command rm ${rmflags[@]} -- "$@"
|
||||||
|
#}
|
||||||
13
.antidote/functions/__antidote_filter_defers
Normal file
13
.antidote/functions/__antidote_filter_defers
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
#!/bin/zsh
|
||||||
|
|
||||||
|
### Filter all but the first defer block.
|
||||||
|
#function __antidote_filter_defers {
|
||||||
|
emulate -L zsh; setopt local_options $_adote_funcopts
|
||||||
|
$__adote_awkcmd '
|
||||||
|
# filter all but the first time we source zsh-defer (a 4 line if statement)
|
||||||
|
BEGIN { skip=0; found=0 }
|
||||||
|
skip>0 { skip-- }
|
||||||
|
/^if.+functions\[zsh\-defer\]/ { if(!found) found=1; else skip=4 }
|
||||||
|
skip==0 { print }
|
||||||
|
' "$@"
|
||||||
|
#}
|
||||||
29
.antidote/functions/__antidote_get_cachedir
Normal file
29
.antidote/functions/__antidote_get_cachedir
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
#!/bin/zsh
|
||||||
|
|
||||||
|
### Get the default cache directory per OS
|
||||||
|
#function __antidote_get_cachedir {
|
||||||
|
emulate -L zsh; setopt local_options $_adote_funcopts
|
||||||
|
|
||||||
|
local result
|
||||||
|
if [[ "${OSTYPE}" == darwin* ]]; then
|
||||||
|
result=$HOME/Library/Caches
|
||||||
|
elif [[ "${OSTYPE}" == (cygwin|msys)* ]]; then
|
||||||
|
result=${LOCALAPPDATA:-$LocalAppData}
|
||||||
|
if type cygpath > /dev/null; then
|
||||||
|
result=$(cygpath "$result")
|
||||||
|
fi
|
||||||
|
elif [[ -n "$XDG_CACHE_HOME" ]]; then
|
||||||
|
result=$XDG_CACHE_HOME
|
||||||
|
else
|
||||||
|
result=$HOME/.cache
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -n "$1" ]]; then
|
||||||
|
if [[ $result == *\\* ]] && [[ $result != */* ]]; then
|
||||||
|
result+="\\$1"
|
||||||
|
else
|
||||||
|
result+="/$1"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
print -r -- $result
|
||||||
|
#}
|
||||||
8
.antidote/functions/__antidote_indent
Normal file
8
.antidote/functions/__antidote_indent
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
#!/bin/zsh
|
||||||
|
|
||||||
|
### Indent strings
|
||||||
|
#function __antidote_indent {
|
||||||
|
emulate -L zsh; setopt local_options $_adote_funcopts
|
||||||
|
local -a lines=("${(@f)$(__antidote_collect_input "$@")}")
|
||||||
|
printf ' %s\n' $lines
|
||||||
|
#}
|
||||||
17
.antidote/functions/__antidote_initfiles
Normal file
17
.antidote/functions/__antidote_initfiles
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
#!/bin/zsh
|
||||||
|
|
||||||
|
### Get the path to a plugin's init file.
|
||||||
|
#function __antidote_initfiles {
|
||||||
|
emulate -L zsh; setopt local_options $_adote_funcopts
|
||||||
|
typeset -ga reply=()
|
||||||
|
local dir=${1:A}
|
||||||
|
local initfiles=($dir/${dir:A:t}.plugin.zsh(N))
|
||||||
|
[[ $#initfiles -gt 0 ]] || initfiles=($dir/*.plugin.zsh(N))
|
||||||
|
[[ $#initfiles -gt 0 ]] || initfiles=($dir/*.zsh(N))
|
||||||
|
[[ $#initfiles -gt 0 ]] || initfiles=($dir/*.sh(N))
|
||||||
|
[[ $#initfiles -gt 0 ]] || initfiles=($dir/*.zsh-theme(N))
|
||||||
|
|
||||||
|
typeset -ga reply=($initfiles)
|
||||||
|
printf "%s\n" ${(u)initfiles[@]}
|
||||||
|
(( $#initfiles )) || return 1
|
||||||
|
#}
|
||||||
60
.antidote/functions/__antidote_load_prep
Normal file
60
.antidote/functions/__antidote_load_prep
Normal file
|
|
@ -0,0 +1,60 @@
|
||||||
|
#!/bin/zsh
|
||||||
|
|
||||||
|
### Prep to load
|
||||||
|
#function __antidote_load_prep {
|
||||||
|
emulate -L zsh; setopt local_options $_adote_funcopts
|
||||||
|
|
||||||
|
# pass in bundle file, read from zstyle, or use default .zsh_plugins.txt
|
||||||
|
local bundlefile="$1"
|
||||||
|
if [[ -z "$bundlefile" ]]; then
|
||||||
|
zstyle -s ':antidote:bundle' file 'bundlefile' ||
|
||||||
|
bundlefile=${ZDOTDIR:-$HOME}/.zsh_plugins.txt
|
||||||
|
fi
|
||||||
|
|
||||||
|
# pass in static file, read from zstyle, change extension, or use default .zsh_plugins.zsh
|
||||||
|
local staticfile="$2"
|
||||||
|
if [[ -z "$staticfile" ]]; then
|
||||||
|
zstyle -s ':antidote:static' file 'staticfile'
|
||||||
|
if [[ -z "$staticfile" ]]; then
|
||||||
|
if [[ -z "$bundlefile:t:r" ]]; then
|
||||||
|
staticfile=${bundlefile}.zsh
|
||||||
|
else
|
||||||
|
staticfile=${bundlefile:r}.zsh
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ! -e "$bundlefile" ]]; then
|
||||||
|
# the files can't have the same name
|
||||||
|
print -ru2 -- "antidote: bundle file not found '$bundlefile'."
|
||||||
|
return 1
|
||||||
|
elif [[ "$bundlefile" == "$staticfile" ]]; then
|
||||||
|
# the files can't have the same name
|
||||||
|
print -ru2 -- "antidote: bundle file and static file are the same '$bundlefile'."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# regenerate the static file based on whether the bundle file is newer and whether
|
||||||
|
# antidote home exists and is ready to be loaded
|
||||||
|
local force_bundle=0
|
||||||
|
if ! zstyle -t ':antidote:load:checkfile' disabled; then
|
||||||
|
local loadable_check_path="$(antidote-home)/.antidote.load"
|
||||||
|
if [[ ! -e $loadable_check_path ]]; then
|
||||||
|
force_bundle=1
|
||||||
|
[[ -d $loadable_check_path:h ]] || mkdir -p $loadable_check_path:h
|
||||||
|
touch $loadable_check_path
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ! $staticfile -nt $bundlefile ]] || [[ $force_bundle -eq 1 ]]; then
|
||||||
|
mkdir -p "${staticfile:A:h}"
|
||||||
|
antidote bundle <"$bundlefile" >|"$staticfile"
|
||||||
|
if [[ -r "${staticfile}.zwc" ]] && ! zstyle -t ':antidote:static' zcompile; then
|
||||||
|
__antidote_del -f -- "${staticfile}.zwc"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# tell antidote-load what to source
|
||||||
|
typeset -g REPLY=$staticfile
|
||||||
|
#print $REPLY
|
||||||
|
#}
|
||||||
41
.antidote/functions/__antidote_parse_bundles
Normal file
41
.antidote/functions/__antidote_parse_bundles
Normal file
|
|
@ -0,0 +1,41 @@
|
||||||
|
#!/bin/zsh
|
||||||
|
|
||||||
|
### Parse antidote's bundle DSL.
|
||||||
|
#function __antidote_parse_bundles {
|
||||||
|
emulate -L zsh; setopt local_options $_adote_funcopts
|
||||||
|
$__adote_awkcmd '
|
||||||
|
BEGIN { RS="[\r\n]" }
|
||||||
|
|
||||||
|
# skip comments and empty lines
|
||||||
|
/^ *$/ || /^ *#/ {next}
|
||||||
|
|
||||||
|
# strip trailing comments
|
||||||
|
{ sub(/[ \t]#.*$/,"",$0) }
|
||||||
|
|
||||||
|
# escape leading $ variables
|
||||||
|
{ sub(/^\$/,"\\$",$0) }
|
||||||
|
|
||||||
|
# handle extension functionality (eg :use ohmyzsh)
|
||||||
|
$1~/^:/ {
|
||||||
|
sub(/^:/,"",$1)
|
||||||
|
printf "antidote-script-" $1
|
||||||
|
for (i=2; i<=NF; i++) {
|
||||||
|
printf " %s",$i
|
||||||
|
}
|
||||||
|
printf "\n"
|
||||||
|
next
|
||||||
|
}
|
||||||
|
|
||||||
|
# move flags to front and call antidote-script
|
||||||
|
{
|
||||||
|
sub(/ #.*$/,"",$0)
|
||||||
|
printf "antidote-script"
|
||||||
|
for (i=2; i<=NF; i++) {
|
||||||
|
sub(/^/,"--",$i)
|
||||||
|
sub(/:/," ",$i)
|
||||||
|
printf " %s",$i
|
||||||
|
}
|
||||||
|
printf " %s\n",$1
|
||||||
|
}
|
||||||
|
' "$@"
|
||||||
|
#}
|
||||||
8
.antidote/functions/__antidote_print_path
Normal file
8
.antidote/functions/__antidote_print_path
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
#!/bin/zsh
|
||||||
|
### Pretty print a path
|
||||||
|
|
||||||
|
if zstyle -t ':antidote:compatibility-mode' 'antibody'; then
|
||||||
|
echo "$1"
|
||||||
|
else
|
||||||
|
echo "$1" | sed -e "s|^$HOME/|\$HOME/|"
|
||||||
|
fi
|
||||||
39
.antidote/functions/__antidote_setup
Normal file
39
.antidote/functions/__antidote_setup
Normal file
|
|
@ -0,0 +1,39 @@
|
||||||
|
#!/bin/zsh
|
||||||
|
|
||||||
|
### Setup antidote.
|
||||||
|
#function __antidote_setup {
|
||||||
|
0=${(%):-%x}
|
||||||
|
fpath=( "${0:A:h}" $fpath )
|
||||||
|
local fn
|
||||||
|
for fn in ${0:A:h}/*; do
|
||||||
|
[[ ${fn:t} != '__antidote_setup' ]] || continue
|
||||||
|
if typeset -f ${fn:t} > /dev/null; then
|
||||||
|
unfunction -- ${fn:t}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# autoload extensionless function files
|
||||||
|
[[ -z "${fn:e}" ]] && autoload -Uz "${fn}"
|
||||||
|
done
|
||||||
|
|
||||||
|
# man pages
|
||||||
|
if [[ "$MANPATH" != *"${0:A:h:h}/man"* ]]; then
|
||||||
|
export MANPATH="${0:A:h:h}/man:$MANPATH"
|
||||||
|
fi
|
||||||
|
|
||||||
|
builtin autoload -Uz is-at-least
|
||||||
|
if is-at-least 5.8; then
|
||||||
|
# the -F option was added in 5.8
|
||||||
|
typeset -gHa _adote_zparopt_flags=( -D -M -F )
|
||||||
|
else
|
||||||
|
typeset -gHa _adote_zparopt_flags=( -D -M )
|
||||||
|
fi
|
||||||
|
|
||||||
|
typeset -gHa _adote_funcopts=( extended_glob no_monitor pipefail )
|
||||||
|
if zstyle -t ':antidote:tests' set-warn-options; then
|
||||||
|
typeset -gHa _adote_funcopts=( $_adote_funcopts warn_create_global warn_nested_var )
|
||||||
|
fi
|
||||||
|
|
||||||
|
gawk --version &>/dev/null && typeset -gH __adote_awkcmd=gawk || typeset -gH __adote_awkcmd=awk
|
||||||
|
typeset -gHi __adote_ksh_arrays
|
||||||
|
typeset -gHi __adote_sh_glob
|
||||||
|
#}
|
||||||
13
.antidote/functions/__antidote_tourl
Normal file
13
.antidote/functions/__antidote_tourl
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
#!/bin/zsh
|
||||||
|
|
||||||
|
### Get the url from a repo bundle.
|
||||||
|
#function __antidote_tourl {
|
||||||
|
emulate -L zsh; setopt local_options $_adote_funcopts
|
||||||
|
|
||||||
|
local bundle=$1
|
||||||
|
local url=$bundle
|
||||||
|
if [[ $bundle != *://* && $bundle != git@*:*/* ]]; then
|
||||||
|
url=https://github.com/$bundle
|
||||||
|
fi
|
||||||
|
print $url
|
||||||
|
#}
|
||||||
27
.antidote/functions/__antidote_usage
Normal file
27
.antidote/functions/__antidote_usage
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
#!/bin/zsh
|
||||||
|
|
||||||
|
### Print usage.
|
||||||
|
#function __antidote_usage {
|
||||||
|
emulate -L zsh; setopt local_options $_adote_funcopts
|
||||||
|
cat<<EOS
|
||||||
|
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
|
||||||
|
EOS
|
||||||
|
#}
|
||||||
11
.antidote/functions/__antidote_version
Normal file
11
.antidote/functions/__antidote_version
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
#!/bin/zsh
|
||||||
|
|
||||||
|
### Get the antidote version.
|
||||||
|
#function __antidote_version {
|
||||||
|
emulate -L zsh; setopt local_options $_adote_funcopts
|
||||||
|
0=${(%):-%x}
|
||||||
|
local ver='1.9.7'
|
||||||
|
local gitsha=$(git -C "${0:A:h:h}" rev-parse --short HEAD 2>/dev/null)
|
||||||
|
[[ -z "$gitsha" ]] || ver="$ver ($gitsha)"
|
||||||
|
print "antidote version $ver"
|
||||||
|
#}
|
||||||
123
.antidote/functions/_antidote
Normal file
123
.antidote/functions/_antidote
Normal file
|
|
@ -0,0 +1,123 @@
|
||||||
|
#compdef antidote
|
||||||
|
|
||||||
|
function _antidote_subcommands {
|
||||||
|
local usage=$(
|
||||||
|
antidote --help |
|
||||||
|
${__adote_awkcmd:-awk} '
|
||||||
|
BEGIN{OFS=":"; p=0}
|
||||||
|
/^commands:$/ {p=1; next}
|
||||||
|
!p{next}
|
||||||
|
{ for(i=3; i<=NF; i++) { $2=$2" "$i } }
|
||||||
|
{ print $1,$2 }
|
||||||
|
'
|
||||||
|
)
|
||||||
|
local -a subcommands=("${(@f)usage}")
|
||||||
|
_describe -t subcommands 'subcommand' subcommands "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
function _antidote_installed_bundles {
|
||||||
|
local -a bundles=("${(@f)$(antidote list -s)}")
|
||||||
|
_describe 'installed bundles' bundles
|
||||||
|
}
|
||||||
|
|
||||||
|
function _antidote_bundle_kinds {
|
||||||
|
local -a kinds=(
|
||||||
|
'autoload' 'clone' 'defer' 'fpath' 'path' 'zsh'
|
||||||
|
)
|
||||||
|
_describe 'bundle kinds' kinds
|
||||||
|
}
|
||||||
|
|
||||||
|
function _antidote {
|
||||||
|
typeset -A opt_args
|
||||||
|
local context state line
|
||||||
|
local curcontext="$curcontext"
|
||||||
|
local ret=1
|
||||||
|
|
||||||
|
_arguments -C \
|
||||||
|
'(- *)'{-v,--version}'[Show version]' \
|
||||||
|
'(- *)'{-h,--help}'[Show usage information]' \
|
||||||
|
'1: :_antidote_subcommands' \
|
||||||
|
'*:: :->subcmds' && return 0
|
||||||
|
|
||||||
|
case "$state" in
|
||||||
|
(subcmds)
|
||||||
|
case $words[1] in
|
||||||
|
(bundle)
|
||||||
|
_arguments \
|
||||||
|
'(- *)'{-h,--help}'[Show usage information]' \
|
||||||
|
&& ret=0
|
||||||
|
;;
|
||||||
|
(help)
|
||||||
|
_arguments \
|
||||||
|
'(- *)'{-h,--help}'[Show usage information]' \
|
||||||
|
&& ret=0
|
||||||
|
;;
|
||||||
|
(home)
|
||||||
|
_arguments \
|
||||||
|
'(- *)'{-h,--help}'[Show usage information]' \
|
||||||
|
&& ret=0
|
||||||
|
;;
|
||||||
|
(init)
|
||||||
|
_arguments \
|
||||||
|
'(- *)'{-h,--help}'[Show usage information]' \
|
||||||
|
&& ret=0
|
||||||
|
;;
|
||||||
|
(install|script)
|
||||||
|
_arguments \
|
||||||
|
'(- *)'{-h,--help}'[Show usage information]' \
|
||||||
|
'(-k --kind)'{-k,--kind}'[The kind of bundle]:kinds:_antidote_bundle_kinds' \
|
||||||
|
'(-p --path)'{-p,--path}'[A relative subpath within the bundle where the plugin is located]' \
|
||||||
|
'(-a --autoload)'{-a,--autoload}'[A relative subpath within the bundle where autoload function files are located]' \
|
||||||
|
'(-c --conditional)'{-c,--conditional}'[A conditional function used to check whether to load the bundle]' \
|
||||||
|
'(-b --branch)'{-b,--branch}'[The git branch to use]' \
|
||||||
|
'(--pre)--pre[A function to be called prior to loading the bundle]' \
|
||||||
|
'(--post)--post[A function to be called after loading the bundle]' \
|
||||||
|
&& ret=0
|
||||||
|
;;
|
||||||
|
(list)
|
||||||
|
_arguments \
|
||||||
|
'(- *)'{-h,--help}'[Show usage information]' \
|
||||||
|
'(-s --short)'{-s,--short}'[Show shortened repos where possible]' \
|
||||||
|
'(-d --dirs)'{-d,--dirs}'[Show only bundle directories]' \
|
||||||
|
'(-u --url)'{-u,--url}'[Show bundle URLs]' \
|
||||||
|
&& ret=0
|
||||||
|
;;
|
||||||
|
(load)
|
||||||
|
_arguments \
|
||||||
|
'(- *)'{-h,--help}'[Show usage information]' \
|
||||||
|
&& ret=0
|
||||||
|
;;
|
||||||
|
(path)
|
||||||
|
_arguments \
|
||||||
|
'(- *)'{-h,--help}'[Show usage information]' \
|
||||||
|
&& ret=0
|
||||||
|
;;
|
||||||
|
(purge)
|
||||||
|
_arguments \
|
||||||
|
'(- *)'{-h,--help}'[Show usage information]' \
|
||||||
|
'(-a --all)'{-a,--all}'[Purge all cloned bundles]' \
|
||||||
|
"*::antidote bundles:_antidote_installed_bundles" \
|
||||||
|
&& ret=0
|
||||||
|
;;
|
||||||
|
(update)
|
||||||
|
_arguments \
|
||||||
|
'(- *)'{-h,--help}'[Show usage information]' \
|
||||||
|
'(-s --selp)'{-s,--self}'[Update antidote]' \
|
||||||
|
'(-b --bundles)'{-b,--bundles}'[Update bundles]' \
|
||||||
|
&& ret=0
|
||||||
|
;;
|
||||||
|
(*)
|
||||||
|
_arguments \
|
||||||
|
'(- *)'{-h,--help}'[Show usage information]' \
|
||||||
|
'*: :_files' \
|
||||||
|
&& ret=0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
return ret
|
||||||
|
}
|
||||||
|
_antidote "$@"
|
||||||
|
|
||||||
|
# vim: ft=zsh sw=2 ts=2 et
|
||||||
16
.antidote/functions/antidote
Normal file
16
.antidote/functions/antidote
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
#!/bin/zsh
|
||||||
|
|
||||||
|
### antidote - the cure to slow zsh plugin management
|
||||||
|
#
|
||||||
|
# https://antidote.sh
|
||||||
|
# run `antidote -h` for usage
|
||||||
|
#
|
||||||
|
# Note: this gets overridden if using `antidote init`.
|
||||||
|
#
|
||||||
|
#function antidote {
|
||||||
|
0=${(%):-%x}
|
||||||
|
if ! typeset -f antidote-main > /dev/null; then
|
||||||
|
source ${0:A:h:h}/antidote.zsh
|
||||||
|
fi
|
||||||
|
antidote-main "$@"
|
||||||
|
#}
|
||||||
49
.antidote/functions/antidote-bundle
Normal file
49
.antidote/functions/antidote-bundle
Normal file
|
|
@ -0,0 +1,49 @@
|
||||||
|
#!/bin/zsh
|
||||||
|
|
||||||
|
### Clone bundle(s) and generate the static load script.
|
||||||
|
#
|
||||||
|
# usage: antidote bundle [-h|--help] <bundle>...
|
||||||
|
#
|
||||||
|
|
||||||
|
### Clone bundle(s) and generate the static load script.
|
||||||
|
#function antidote-bundle {
|
||||||
|
# Download a bundle and prints its Zsh source line.
|
||||||
|
emulate -L zsh; setopt local_options $_adote_funcopts
|
||||||
|
|
||||||
|
local o_help
|
||||||
|
zparseopts $_adote_zparopt_flags -- h=o_help -help=h || return 1
|
||||||
|
|
||||||
|
if (( $#o_help )); then
|
||||||
|
antidote-help bundle
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
# handle bundles as newline delimited arg strings,
|
||||||
|
# or as <redirected or piped| input
|
||||||
|
local -a bundles=("${(@f)$(__antidote_collect_input "$@")}")
|
||||||
|
(( $#bundles )) || return 1
|
||||||
|
|
||||||
|
# output static file compilation
|
||||||
|
local -a zcompile_script=(
|
||||||
|
"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'
|
||||||
|
'}'
|
||||||
|
)
|
||||||
|
if zstyle -t ':antidote:static' zcompile; then
|
||||||
|
printf '%s\n' $zcompile_script
|
||||||
|
fi
|
||||||
|
|
||||||
|
# antidote-script also clones, but this way we can do it all at once in parallel!
|
||||||
|
if (( $#bundles > 1 )); then
|
||||||
|
source <(printf '%s\n' $bundles | __antidote_bulk_clone)
|
||||||
|
fi
|
||||||
|
|
||||||
|
# generate bundle script
|
||||||
|
source <(printf '%s\n' $bundles | __antidote_parse_bundles) | __antidote_filter_defers
|
||||||
|
#}
|
||||||
32
.antidote/functions/antidote-help
Normal file
32
.antidote/functions/antidote-help
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
#!/bin/zsh
|
||||||
|
|
||||||
|
### Show antidote documentation.
|
||||||
|
#
|
||||||
|
# usage: antidote [-h|--help] [<command>]
|
||||||
|
# antidote help [<command>]
|
||||||
|
#
|
||||||
|
|
||||||
|
#function antidote-help {
|
||||||
|
emulate -L zsh; setopt local_options $_adote_funcopts
|
||||||
|
|
||||||
|
local o_help
|
||||||
|
zparseopts $_adote_zparopt_flags -- h=o_help -help=h || return 1
|
||||||
|
|
||||||
|
local manpage
|
||||||
|
|
||||||
|
if (( $#o_help )); then
|
||||||
|
manpage=antidote-help
|
||||||
|
elif [[ "$1" == antidote ]]; then
|
||||||
|
manpage=antidote
|
||||||
|
elif [[ -n "$1" ]]; then
|
||||||
|
manpage="antidote-${1}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if (( $+commands[man] )) && [[ -n "$manpage" ]]; then
|
||||||
|
man "$manpage" || {
|
||||||
|
__antidote_usage && return 1
|
||||||
|
}
|
||||||
|
else
|
||||||
|
__antidote_usage
|
||||||
|
fi
|
||||||
|
#}
|
||||||
29
.antidote/functions/antidote-home
Normal file
29
.antidote/functions/antidote-home
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
#!/bin/zsh
|
||||||
|
|
||||||
|
### Print where antidote is cloning bundles.
|
||||||
|
#
|
||||||
|
# usage: antidote home [-h|--help]
|
||||||
|
#
|
||||||
|
# Can be overridden by setting `$ANTIDOTE_HOME`.
|
||||||
|
#
|
||||||
|
#function antidote-home {
|
||||||
|
emulate -L zsh; setopt local_options $_adote_funcopts
|
||||||
|
|
||||||
|
typeset -g REPLY=
|
||||||
|
local o_help
|
||||||
|
zparseopts $_adote_zparopt_flags -- h=o_help -help=h || return 1
|
||||||
|
|
||||||
|
if (( $#o_help )); then
|
||||||
|
antidote-help home
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
local result
|
||||||
|
if [[ -n "$ANTIDOTE_HOME" ]]; then
|
||||||
|
result=$ANTIDOTE_HOME
|
||||||
|
else
|
||||||
|
result=$(__antidote_get_cachedir "antidote")
|
||||||
|
fi
|
||||||
|
print $result
|
||||||
|
typeset -g REPLY=$result
|
||||||
|
#}
|
||||||
33
.antidote/functions/antidote-init
Normal file
33
.antidote/functions/antidote-init
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
#!/bin/zsh
|
||||||
|
|
||||||
|
### Initialize the shell for dynamic bundles.
|
||||||
|
#
|
||||||
|
# usage: antidote init [-h|--help]
|
||||||
|
# source <(antidote init)
|
||||||
|
#
|
||||||
|
# This function changes how the `antidote` command works by sourcing the results of
|
||||||
|
# `antidote bundle` instead of just generating the Zsh script.
|
||||||
|
#function antidote-init {
|
||||||
|
local o_help
|
||||||
|
zparseopts $_adote_zparopt_flags -- h=o_help -help=h || return 1
|
||||||
|
|
||||||
|
if (( $#o_help )); then
|
||||||
|
antidote-help init
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
local script=(
|
||||||
|
'#!/usr/bin/env zsh'
|
||||||
|
'function antidote {'
|
||||||
|
' case "$1" in'
|
||||||
|
' bundle)'
|
||||||
|
' source <( antidote-main $@ ) || antidote-main $@'
|
||||||
|
' ;;'
|
||||||
|
' *)'
|
||||||
|
' antidote-main $@'
|
||||||
|
' ;;'
|
||||||
|
' esac'
|
||||||
|
'}'
|
||||||
|
)
|
||||||
|
printf "%s\n" "${script[@]}"
|
||||||
|
#}
|
||||||
65
.antidote/functions/antidote-install
Normal file
65
.antidote/functions/antidote-install
Normal file
|
|
@ -0,0 +1,65 @@
|
||||||
|
#!/bin/zsh
|
||||||
|
|
||||||
|
### Clone a new bundle and add it to your plugins file.
|
||||||
|
|
||||||
|
# usage: antidote install [-h|--help] [-k|--kind <kind>] [-p|--path <path>]
|
||||||
|
# [-c|--conditional <func>] [-b|--branch <branch>]
|
||||||
|
# [--pre <func>] [--post <func>]
|
||||||
|
# [-a|--autoload <path>] <bundle> [<bundlefile>]
|
||||||
|
#function antidote-install {
|
||||||
|
emulate -L zsh; setopt local_options $_adote_funcopts
|
||||||
|
|
||||||
|
local -A flag_to_annotation=(
|
||||||
|
'-a' autoload
|
||||||
|
'-b' branch
|
||||||
|
'-c' conditional
|
||||||
|
'-h' help
|
||||||
|
'-k' kind
|
||||||
|
'-p' path
|
||||||
|
)
|
||||||
|
local -a annotations=()
|
||||||
|
local arg
|
||||||
|
while (( $# )); do
|
||||||
|
arg="$1"
|
||||||
|
case "$arg" in
|
||||||
|
-h|--help)
|
||||||
|
antidote-help install
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
--) shift; break ;;
|
||||||
|
--*) annotations+=( "${arg#*--}:$2" ); shift ;;
|
||||||
|
-*) annotations+=( $flag_to_annotation[$arg]:$2 ); shift ;;
|
||||||
|
*) break ;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ $# -eq 0 ]]; then
|
||||||
|
print -ru2 "antidote: error: required argument 'bundle' not provided, try --help"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
local bundle=$1
|
||||||
|
local bundlefile=$2
|
||||||
|
if [[ -z "$bundlefile" ]]; then
|
||||||
|
zstyle -s ':antidote:bundle' file 'bundlefile' ||
|
||||||
|
bundlefile=${ZDOTDIR:-$HOME}/.zsh_plugins.txt
|
||||||
|
fi
|
||||||
|
|
||||||
|
local bundledir=$(__antidote_bundle_dir $bundle)
|
||||||
|
if [[ -d "$bundledir" ]]; then
|
||||||
|
print -ru2 "antidote: error: $bundle already installed: $bundledir"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# use antidote bundle to clone our bundle
|
||||||
|
local bundlestr=$bundle
|
||||||
|
(( $#annotations )) && bundlestr+=" $annotations"
|
||||||
|
antidote-bundle "$bundlestr" >/dev/null
|
||||||
|
if [[ $? -ne 0 ]]; then
|
||||||
|
print -ru2 "antidote: unable to install bundle '$bundle'."
|
||||||
|
else
|
||||||
|
print "Adding bundle to '$bundlefile':"
|
||||||
|
print $bundlestr | tee -a $bundlefile
|
||||||
|
fi
|
||||||
|
#}
|
||||||
48
.antidote/functions/antidote-list
Normal file
48
.antidote/functions/antidote-list
Normal file
|
|
@ -0,0 +1,48 @@
|
||||||
|
#!/bin/zsh
|
||||||
|
|
||||||
|
### List cloned bundles.
|
||||||
|
#
|
||||||
|
# usage: antidote list [-h|--help] [-s|--short] [-d|--dirs] [-u|--url]
|
||||||
|
#
|
||||||
|
#function antidote-list {
|
||||||
|
emulate -L zsh; setopt local_options $_adote_funcopts
|
||||||
|
|
||||||
|
local o_help o_short o_url o_dirs
|
||||||
|
zparseopts $_adote_zparopt_flags -- \
|
||||||
|
h=o_help -help=h \
|
||||||
|
s=o_short -short=s \
|
||||||
|
u=o_url -url=u \
|
||||||
|
d=o_dirs -dirs=d ||
|
||||||
|
return 1
|
||||||
|
|
||||||
|
if (( $#o_help )); then
|
||||||
|
antidote-help list
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $# -ne 0 ]]; then
|
||||||
|
print -ru2 "antidote: error: unexpected $1, try --help"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
local bundledir
|
||||||
|
local output=()
|
||||||
|
local bundles=($(antidote-home)/**/.git(/N))
|
||||||
|
|
||||||
|
for bundledir in $bundles; do
|
||||||
|
bundledir=${bundledir:h}
|
||||||
|
local url=$(git -C "$bundledir" config remote.origin.url)
|
||||||
|
if (( $#o_dirs )); then
|
||||||
|
output+=($bundledir)
|
||||||
|
elif (( $#o_url )); then
|
||||||
|
output+=($url)
|
||||||
|
elif (( $#o_short )); then
|
||||||
|
url=${url%.git}
|
||||||
|
url=${url#https://github.com/}
|
||||||
|
output+=($url)
|
||||||
|
else
|
||||||
|
output+=("$(printf '%-64s %s\n' $url $bundledir)")
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
(( $#output )) && printf '%s\n' ${(o)output}
|
||||||
|
#}
|
||||||
26
.antidote/functions/antidote-load
Normal file
26
.antidote/functions/antidote-load
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
#!/bin/zsh
|
||||||
|
|
||||||
|
### Statically source all bundles from the plugins file.
|
||||||
|
#
|
||||||
|
# usage: antidote load [-h|--help] [<bundlefile> [<staticfile>]]
|
||||||
|
#
|
||||||
|
#function antidote-load {
|
||||||
|
if [[ "$1" == (-h|--help) ]]; then
|
||||||
|
antidote-help load
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
# We can't use LOCAL_OPTIONS because sourcing plugins means we'd lose any Zsh options
|
||||||
|
# set in those plugins, so we delegate all the work to __antidote_load_prep where
|
||||||
|
# we can safely use LOCAL_OPTIONS. For this function, we should do the bare minimum
|
||||||
|
# so the user can set whatever crazy Zsh options they want, and antidote doesn't need
|
||||||
|
# to concern itself with that.
|
||||||
|
#
|
||||||
|
# "Is your house on fire, Clark? No, Aunt Bethany, those are the user's Zsh options."
|
||||||
|
#
|
||||||
|
typeset -g REPLY=
|
||||||
|
__antidote_load_prep "$@" || return 1
|
||||||
|
[[ -f "$REPLY" ]] || return 2
|
||||||
|
source "$REPLY"
|
||||||
|
unset REPLY
|
||||||
|
#}
|
||||||
49
.antidote/functions/antidote-main
Normal file
49
.antidote/functions/antidote-main
Normal file
|
|
@ -0,0 +1,49 @@
|
||||||
|
#!/bin/zsh
|
||||||
|
|
||||||
|
### The main controller for antidote.
|
||||||
|
# The reason we use `antidote-main` instead putting all of this in `antidote`
|
||||||
|
# is that this allows the `antidote` function to be overridden via `antidote init`.
|
||||||
|
# The init command switches antidote from static mode to dynamic mode, but this
|
||||||
|
# core functionality remains.
|
||||||
|
#function antidote-main {
|
||||||
|
0=${(%):-%x}
|
||||||
|
|
||||||
|
[[ -o KSH_ARRAYS ]] && __adote_ksh_arrays=1 && unsetopt KSH_ARRAYS
|
||||||
|
[[ -o SH_GLOB ]] && __adote_sh_glob=1 && unsetopt SH_GLOB
|
||||||
|
|
||||||
|
local o_help o_version
|
||||||
|
zparseopts ${_adote_zparopt_flags} -- \
|
||||||
|
h=o_help -help=h \
|
||||||
|
v=o_version -version=v ||
|
||||||
|
return 1
|
||||||
|
|
||||||
|
local ret=0
|
||||||
|
|
||||||
|
if (( ${#o_version} )); then
|
||||||
|
__antidote_version
|
||||||
|
|
||||||
|
elif (( ${#o_help} )); then
|
||||||
|
antidote-help "$@"
|
||||||
|
|
||||||
|
elif [[ ${#} -eq 0 ]]; then
|
||||||
|
antidote-help
|
||||||
|
ret=2
|
||||||
|
|
||||||
|
elif [[ "${1}" = help ]]; then
|
||||||
|
local manpage=${2:-antidote}
|
||||||
|
antidote-help $manpage
|
||||||
|
|
||||||
|
elif (( $+functions[antidote-${1}] )); then
|
||||||
|
local cmd=${1}; shift
|
||||||
|
antidote-${cmd} "$@"
|
||||||
|
ret=$?
|
||||||
|
|
||||||
|
else
|
||||||
|
print -ru2 "antidote: command not found '${1}'"
|
||||||
|
ret=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
(( __adote_ksh_arrays )) && __adote_ksh_arrays=0 && setopt KSH_ARRAYS
|
||||||
|
(( __adote_sh_glob )) && __adote_sh_glob=0 && setopt SH_GLOB
|
||||||
|
return $ret
|
||||||
|
#}
|
||||||
39
.antidote/functions/antidote-path
Normal file
39
.antidote/functions/antidote-path
Normal file
|
|
@ -0,0 +1,39 @@
|
||||||
|
#!/bin/zsh
|
||||||
|
|
||||||
|
### Print the path of a cloned bundle.
|
||||||
|
#
|
||||||
|
# usage: antidote path [-h|--help] <bundle>
|
||||||
|
#
|
||||||
|
#function antidote-path {
|
||||||
|
emulate -L zsh; setopt local_options $_adote_funcopts
|
||||||
|
|
||||||
|
local o_help
|
||||||
|
zparseopts $_adote_zparopt_flags -- h=o_help -help=h || return 1
|
||||||
|
|
||||||
|
if (( $#o_help )); then
|
||||||
|
antidote-help path
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
local -a bundles=("${(@f)$(__antidote_collect_input "$@")}")
|
||||||
|
if (( $#bundles == 0 )); then
|
||||||
|
print -ru2 "antidote: error: required argument 'bundle' not provided, try --help"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
local bundle bundledir
|
||||||
|
local -a results=()
|
||||||
|
for bundle in $bundles; do
|
||||||
|
if [[ $bundle == '$'* ]] && [[ $bundle != *'('* ]] && [[ $bundle != *';'* ]]; then
|
||||||
|
bundle=$(eval print $bundle)
|
||||||
|
fi
|
||||||
|
bundledir=$(__antidote_bundle_dir $bundle)
|
||||||
|
if [[ ! -d $bundledir ]]; then
|
||||||
|
print -ru2 "antidote: error: $bundle does not exist in cloned paths"
|
||||||
|
return 1
|
||||||
|
else
|
||||||
|
results+=("$bundledir")
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
print -l -- $results
|
||||||
|
#}
|
||||||
83
.antidote/functions/antidote-purge
Normal file
83
.antidote/functions/antidote-purge
Normal file
|
|
@ -0,0 +1,83 @@
|
||||||
|
#!/bin/zsh
|
||||||
|
|
||||||
|
### Remove a cloned bundle.
|
||||||
|
#
|
||||||
|
# usage: antidote purge [-h|--help] <bundle>
|
||||||
|
# antidote purge [-a|--all]
|
||||||
|
#
|
||||||
|
#function antidote-purge {
|
||||||
|
emulate -L zsh; setopt local_options $_adote_funcopts
|
||||||
|
|
||||||
|
local o_help o_all
|
||||||
|
zparseopts $_adote_zparopt_flags -- \
|
||||||
|
h=o_help -help=h \
|
||||||
|
a=o_all -all=a ||
|
||||||
|
return 1
|
||||||
|
|
||||||
|
if (( $#o_help )); then
|
||||||
|
antidote-help purge
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $# -eq 0 ]] && ! (( $#o_all )); then
|
||||||
|
print -ru2 "antidote: error: required argument 'bundle' not provided, try --help"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
local bundlefile
|
||||||
|
zstyle -s ':antidote:bundle' file 'bundlefile' ||
|
||||||
|
bundlefile=${ZDOTDIR:-$HOME}/.zsh_plugins.txt
|
||||||
|
|
||||||
|
if (( $#o_all )); then
|
||||||
|
# last chance to save the user from themselves
|
||||||
|
local antidote_home="$(antidote-home)"
|
||||||
|
local REPLY
|
||||||
|
zstyle -s ':antidote:purge:all' answer 'REPLY' || {
|
||||||
|
read -q "REPLY?You are about to permanently remove '$antidote_home' and all its contents!"$'\n'"Are you sure [Y/n]? "
|
||||||
|
print
|
||||||
|
}
|
||||||
|
[[ ${REPLY:u} == "Y" ]] || return 1
|
||||||
|
# remove antidote home and static cache file
|
||||||
|
__antidote_del -rf -- "$antidote_home"
|
||||||
|
|
||||||
|
if [[ -e "${bundlefile:r}.zsh" ]]; then
|
||||||
|
zstyle -s ':antidote:purge:all' answer 'REPLY' || {
|
||||||
|
read -q "REPLY?You are about to remove '${bundlefile:t:r}.zsh'"$'\n'"Are you sure [Y/n]? "
|
||||||
|
print
|
||||||
|
}
|
||||||
|
if [[ ${REPLY:u} == "Y" ]]; then
|
||||||
|
local dtstmp=$(date -u '+%Y%m%d_%H%M%S')
|
||||||
|
command mv -f "${bundlefile:r}.zsh" "${bundlefile:r}.${dtstmp}.bak"
|
||||||
|
print "'"${bundlefile:r}.zsh"' backed up to '${bundlefile:t:r}.${dtstmp}.bak'"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
print "Antidote purge complete. Be sure to start a new Zsh session."
|
||||||
|
|
||||||
|
else
|
||||||
|
local bundle=$1
|
||||||
|
# make sure the user isn't trying to do something out-of-bounds
|
||||||
|
if [[ -e "$bundle" ]]; then
|
||||||
|
print -ru2 "antidote: error: '$bundle' is not a repo and cannot be removed by antidote."
|
||||||
|
return 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
local bundledir=$(__antidote_bundle_dir $bundle)
|
||||||
|
if [[ ! -d "$bundledir" ]]; then
|
||||||
|
print -ru2 "antidote: error: $bundle does not exist at the expected location: $bundledir"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# remove
|
||||||
|
__antidote_del -rf "$bundledir"
|
||||||
|
print "Removed '$bundle'."
|
||||||
|
|
||||||
|
# attempt to comment out the bundle from .zsh_plugins.txt
|
||||||
|
if [[ -e "$bundlefile" ]]; then
|
||||||
|
local tmpfile="${bundlefile}.antidote.tmp"
|
||||||
|
$__adote_awkcmd -v pat="$bundle" '$0~"^[[:blank:]]*"pat{print "# " $0;next}1' <$bundlefile >|$tmpfile
|
||||||
|
command cat "$tmpfile" > "$bundlefile"
|
||||||
|
__antidote_del -f "$tmpfile"
|
||||||
|
print "Bundle '$bundle' was commented out in '$bundlefile'."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
#}
|
||||||
213
.antidote/functions/antidote-script
Normal file
213
.antidote/functions/antidote-script
Normal file
|
|
@ -0,0 +1,213 @@
|
||||||
|
#!/bin/zsh
|
||||||
|
|
||||||
|
### Generate the Zsh script to load a plugin.
|
||||||
|
#
|
||||||
|
# usage: antidote script [-h|--help] [-k|--kind <kind>] [-p|--path <path>]
|
||||||
|
# [-c|--conditional <func>] [-b|--branch <branch>]
|
||||||
|
# [--pre <func>] [--post <func>]
|
||||||
|
# [-a|--autoload <path>] <bundle>
|
||||||
|
# <kind> : zsh,path,fpath,defer,clone,autoload
|
||||||
|
# <path> : Relative path from the bundle root
|
||||||
|
# <branch> : The git branch
|
||||||
|
# <bundle> : A bundle can be a directory, a zsh script, or a git repo
|
||||||
|
#
|
||||||
|
|
||||||
|
### Generate the Zsh script to load a plugin.
|
||||||
|
#function antidote-script {
|
||||||
|
emulate -L zsh; setopt local_options $_adote_funcopts
|
||||||
|
local MATCH MBEGIN MEND; local -a match mbegin mend # appease 'warn_create_global'
|
||||||
|
local REPLY=
|
||||||
|
|
||||||
|
local o_help o_kind o_path o_branch o_cond o_autoload o_pre o_post o_fpath_rule
|
||||||
|
zparseopts $_adote_zparopt_flags -- \
|
||||||
|
h=o_help -help=h \
|
||||||
|
a:=o_autoload -autoload:=a \
|
||||||
|
b:=o_branch -branch:=b \
|
||||||
|
k:=o_kind -kind:=k \
|
||||||
|
p:=o_path -path:=p \
|
||||||
|
-pre:=o_pre \
|
||||||
|
-post:=o_post \
|
||||||
|
-fpath-rule:=o_fpath_rule \
|
||||||
|
c:=o_cond -conditional:=c ||
|
||||||
|
return 1
|
||||||
|
|
||||||
|
# set defaults
|
||||||
|
(( $#o_kind )) || o_kind=(--kind zsh)
|
||||||
|
if ! (( $#o_fpath_rule )); then
|
||||||
|
zstyle -a ':antidote:fpath' rule 'o_fpath_rule' || o_fpath_rule=(append)
|
||||||
|
fi
|
||||||
|
|
||||||
|
# strip '=' or ':' from beginning of arg values
|
||||||
|
local re='^[=:]?(.+)$'
|
||||||
|
[[ $o_kind[-1] =~ $re ]] && o_kind[-1]=$match
|
||||||
|
[[ $o_autoload[-1] =~ $re ]] && o_autoload[-1]=$match
|
||||||
|
[[ $o_path[-1] =~ $re ]] && o_path[-1]=$match
|
||||||
|
[[ $o_cond[-1] =~ $re ]] && o_cond[-1]=$match
|
||||||
|
[[ $o_branch[-1] =~ $re ]] && o_branch[-1]=$match
|
||||||
|
[[ $o_pre[-1] =~ $re ]] && o_pre[-1]=$match
|
||||||
|
[[ $o_post[-1] =~ $re ]] && o_post[-1]=$match
|
||||||
|
[[ $o_fpath_rule[-1] =~ $re ]] && o_fpath_rule[-1]=$match
|
||||||
|
|
||||||
|
local supported_kind_vals=(autoload clone defer fpath path zsh)
|
||||||
|
if (( $#o_kind )) && ! (( $supported_kind_vals[(Ie)$o_kind[-1]] )); then
|
||||||
|
print -ru2 "antidote: error: unexpected kind value: '$o_kind[-1]'" && return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If no fpath_rule is set, use the zstyle
|
||||||
|
if ! (( $#o_fpath_rule )); then
|
||||||
|
local zstyle_fpath_rule
|
||||||
|
zstyle -s ':antidote:fpath' rule 'zstyle_fpath_rule'
|
||||||
|
[[ -z "$zstyle_fpath_rule" ]] || o_fpath_rule=($zstyle_fpath_rule)
|
||||||
|
fi
|
||||||
|
|
||||||
|
local supported_fpath_rules=(append prepend)
|
||||||
|
if ! (( $supported_fpath_rules[(Ie)$o_fpath_rule[-1]] )); then
|
||||||
|
print -ru2 "antidote: error: unexpected fpath rule: '$o_fpath_rule[-1]'" && return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
local bundle=$1
|
||||||
|
if [[ -z "$bundle" ]]; then
|
||||||
|
print -ru2 "antidote: error: bundle argument expected" && return 1
|
||||||
|
fi
|
||||||
|
local bundle_name=$(__antidote_bundle_name $bundle)
|
||||||
|
|
||||||
|
# replace ~/ with $HOME/
|
||||||
|
if [[ "$bundle" == '~/'* ]]; then
|
||||||
|
bundle=$HOME/${bundle#'~/'*}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# set the path to the bundle (repo or local)
|
||||||
|
local bundle_path
|
||||||
|
[[ -e "$bundle" ]] && bundle_path=$bundle || bundle_path=$(__antidote_bundle_dir $bundle)
|
||||||
|
|
||||||
|
# handle cloning repo bundles
|
||||||
|
local bundle_type
|
||||||
|
bundle_type="$(__antidote_bundle_type $bundle)"
|
||||||
|
if [[ "$bundle_type" == (repo|url|sshurl) ]] && [[ ! -e "$bundle_path" ]]; then
|
||||||
|
local giturl=$(__antidote_tourl $bundle)
|
||||||
|
print -ru2 "# antidote cloning $bundle_name..."
|
||||||
|
git clone --quiet --depth 1 --recurse-submodules --shallow-submodules $o_branch $giturl $bundle_path
|
||||||
|
[[ $? -eq 0 ]] || return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# if we only needed to clone the bundle, compile and we're done
|
||||||
|
if [[ "$o_kind[-1]" == "clone" ]]; then
|
||||||
|
if zstyle -t ":antidote:bundle:$bundle" zcompile; then
|
||||||
|
__antidote_bundle_zcompile $bundle_path
|
||||||
|
fi
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
# add path to bundle
|
||||||
|
[[ -n "$o_path[-1]" ]] && bundle_path+="/$o_path[-1]"
|
||||||
|
|
||||||
|
# handle defer pre-reqs first
|
||||||
|
local dopts zsh_defer='zsh-defer'
|
||||||
|
zstyle -s ":antidote:bundle:${bundle}" defer-options 'dopts'
|
||||||
|
[[ -n "$dopts" ]] && zsh_defer="zsh-defer $dopts"
|
||||||
|
|
||||||
|
# generate the script
|
||||||
|
local -a script=()
|
||||||
|
|
||||||
|
# add pre-load function
|
||||||
|
(( $#o_pre )) && script+=("$o_pre[-1]")
|
||||||
|
|
||||||
|
# handle defers
|
||||||
|
local source_cmd="source"
|
||||||
|
local zsh_defer_bundle
|
||||||
|
zstyle -s ':antidote:defer' bundle 'zsh_defer_bundle' \
|
||||||
|
|| zsh_defer_bundle='romkatv/zsh-defer'
|
||||||
|
if [[ "$o_kind[-1]" == "defer" ]]; then
|
||||||
|
source_cmd="${zsh_defer} source"
|
||||||
|
script+=(
|
||||||
|
'if ! (( $+functions[zsh-defer] )); then'
|
||||||
|
"$(antidote-script $zsh_defer_bundle | __antidote_indent)"
|
||||||
|
'fi'
|
||||||
|
)
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Let's make the path a little nicer to deal with
|
||||||
|
local print_bundle_path="$(__antidote_print_path "$bundle_path")"
|
||||||
|
|
||||||
|
# handle autoloading before sourcing
|
||||||
|
if (( $#o_autoload )); then
|
||||||
|
if [[ "$o_fpath_rule[-1]" == prepend ]]; then
|
||||||
|
script+=("fpath=( ${print_bundle_path}/${o_autoload[-1]} \$fpath )")
|
||||||
|
script+=("builtin autoload -Uz \$fpath[1]/*(N.:t)")
|
||||||
|
else
|
||||||
|
script+=("fpath+=( ${print_bundle_path}/${o_autoload[-1]} )")
|
||||||
|
script+=("builtin autoload -Uz \$fpath[-1]/*(N.:t)")
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# generate load script
|
||||||
|
bundle_type="$(__antidote_bundle_type $bundle_path)"
|
||||||
|
local fpath_script
|
||||||
|
if [[ "$o_fpath_rule[-1]" == prepend ]]; then
|
||||||
|
fpath_script="fpath=( $print_bundle_path \$fpath )"
|
||||||
|
else
|
||||||
|
fpath_script="fpath+=( $print_bundle_path )"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$o_kind[-1]" == fpath ]]; then
|
||||||
|
# fpath
|
||||||
|
script+="$fpath_script"
|
||||||
|
elif [[ "$o_kind[-1]" == path ]]; then
|
||||||
|
# path
|
||||||
|
script+="export PATH=\"$print_bundle_path:\$PATH\""
|
||||||
|
elif [[ "$o_kind[-1]" == autoload ]]; then
|
||||||
|
# autoload
|
||||||
|
script+=("$fpath_script")
|
||||||
|
if [[ "$o_fpath_rule[-1]" == prepend ]]; then
|
||||||
|
script+=("builtin autoload -Uz \$fpath[1]/*(N.:t)")
|
||||||
|
else
|
||||||
|
script+=("builtin autoload -Uz \$fpath[-1]/*(N.:t)")
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if zstyle -t ":antidote:bundle:$bundle" zcompile; then
|
||||||
|
__antidote_bundle_zcompile $bundle_path
|
||||||
|
fi
|
||||||
|
if [[ $bundle_type == file ]]; then
|
||||||
|
script+="$source_cmd $print_bundle_path"
|
||||||
|
else
|
||||||
|
# directory/default
|
||||||
|
local initfile initfiles
|
||||||
|
initfiles=(${(@f)$(__antidote_initfiles $bundle_path)})
|
||||||
|
# if no init file was found, assume the default
|
||||||
|
if [[ $#initfiles -eq 0 ]]; then
|
||||||
|
if (( $#o_path )); then
|
||||||
|
initfiles=($bundle_path/${bundle_path:t}.plugin.zsh)
|
||||||
|
else
|
||||||
|
initfiles=($bundle_path/${bundle_name:t}.plugin.zsh)
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
script+="$fpath_script"
|
||||||
|
local print_initfile
|
||||||
|
for initfile in $initfiles; do
|
||||||
|
print_initfile="$(__antidote_print_path "$initfile")"
|
||||||
|
script+="$source_cmd $print_initfile"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# add post-load function
|
||||||
|
if (( $#o_post )); then
|
||||||
|
if [[ "$o_kind[-1]" == "defer" ]]; then
|
||||||
|
script+=("${zsh_defer} $o_post[-1]")
|
||||||
|
else
|
||||||
|
script+=("$o_post[-1]")
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# mark bundle as loaded
|
||||||
|
# script+="zstyle ':antidote:bundle:${bundle_name}' loaded yes"
|
||||||
|
|
||||||
|
# wrap conditional
|
||||||
|
if [[ -n "$o_cond[-1]" ]]; then
|
||||||
|
print "if $o_cond[-1]; then"
|
||||||
|
printf " %s\n" $script
|
||||||
|
print "fi"
|
||||||
|
else
|
||||||
|
printf "%s\n" $script
|
||||||
|
fi
|
||||||
|
#}
|
||||||
94
.antidote/functions/antidote-update
Normal file
94
.antidote/functions/antidote-update
Normal file
|
|
@ -0,0 +1,94 @@
|
||||||
|
#!/bin/zsh
|
||||||
|
|
||||||
|
### Update antidote and its cloned bundles.
|
||||||
|
#
|
||||||
|
# usage: antidote update [-h|--help]
|
||||||
|
#
|
||||||
|
#function antidote-update {
|
||||||
|
0=${(%):-%x}
|
||||||
|
emulate -L zsh; setopt local_options $_adote_funcopts
|
||||||
|
|
||||||
|
local o_help o_self o_bundles
|
||||||
|
zparseopts $_adote_zparopt_flags -- \
|
||||||
|
h=o_help -help=h \
|
||||||
|
s=o_self -self=s \
|
||||||
|
b=o_bundles -bundles=b ||
|
||||||
|
return 1
|
||||||
|
|
||||||
|
if (( $#o_help )); then
|
||||||
|
antidote-help update
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
# colors
|
||||||
|
local green normal
|
||||||
|
if [[ $TERM = *256color* || $TERM = *rxvt* ]]; then
|
||||||
|
if (( $+commands[tput] )); then
|
||||||
|
green=$(tput setaf 2)
|
||||||
|
normal=$(tput sgr0)
|
||||||
|
else
|
||||||
|
green=$'\E[32m'
|
||||||
|
normal=$'\E[0m'
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if (( $#o_bundles )) || ! (( $#o_self )); then
|
||||||
|
print "Updating bundles..."
|
||||||
|
local bundledir url repo
|
||||||
|
|
||||||
|
# remove zcompiled files
|
||||||
|
__antidote_del -rf -- $(antidote-home)/**/*.zwc(N)
|
||||||
|
|
||||||
|
# remove check file
|
||||||
|
local loadable_check_path="$(antidote-home)/.antidote.load"
|
||||||
|
[[ -r "$loadable_check_path" ]] && __antidote_del -- "$loadable_check_path"
|
||||||
|
|
||||||
|
# update all bundles
|
||||||
|
for bundledir in $(antidote-list --dirs); do
|
||||||
|
url=$(git -C "$bundledir" config remote.origin.url)
|
||||||
|
repo="${url:h:t}/${${url:t}%.git}"
|
||||||
|
print "antidote: checking for updates: $url"
|
||||||
|
() {
|
||||||
|
local oldsha=$(git -C "$1" rev-parse --short HEAD)
|
||||||
|
git -C "$1" pull --quiet --ff --rebase --autostash
|
||||||
|
git -C "$1" submodule --quiet sync --recursive
|
||||||
|
git -C "$1" submodule --quiet update --init --recursive --depth 1
|
||||||
|
local newsha=$(git -C "$1" rev-parse --short HEAD)
|
||||||
|
if [[ $oldsha != $newsha ]]; then
|
||||||
|
print "${green}antidote: updated: $2 ${oldsha} -> ${newsha}${normal}"
|
||||||
|
git -C "$1" --no-pager log --oneline --ancestry-path ${oldsha}..${newsha} 2>/dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
|
# recompile bundles
|
||||||
|
if zstyle -t ":antidote:bundle:$repo" zcompile; then
|
||||||
|
__antidote_bundle_zcompile $bundledir
|
||||||
|
fi
|
||||||
|
} "$bundledir" "$url" &
|
||||||
|
done
|
||||||
|
print "Waiting for bundle updates to complete..."
|
||||||
|
print ""
|
||||||
|
wait
|
||||||
|
print "${green}Bundle updates complete.${normal}"
|
||||||
|
print ""
|
||||||
|
fi
|
||||||
|
|
||||||
|
# update antidote
|
||||||
|
if (( $#o_self )) || ! (( $#o_bundles )); then
|
||||||
|
print "Updating antidote..."
|
||||||
|
if [[ -d "${0:A:h:h}/.git" ]]; then
|
||||||
|
git -C "${0:A:h:h}" pull --quiet --ff --rebase --autostash
|
||||||
|
print "antidote self-update complete.\n"
|
||||||
|
|
||||||
|
# setup antidote again
|
||||||
|
(( $+functions[__antidote_setup] )) && unfunction __antidote_setup
|
||||||
|
builtin autoload -Uz ${0:A:h}/__antidote_setup
|
||||||
|
__antidote_setup
|
||||||
|
|
||||||
|
# show antidote version
|
||||||
|
antidote -v
|
||||||
|
else
|
||||||
|
print "Self updating is disabled in this build."
|
||||||
|
print "Use your OS package manager to update antidote itself."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
#}
|
||||||
48
.antidote/makefile
Normal file
48
.antidote/makefile
Normal file
|
|
@ -0,0 +1,48 @@
|
||||||
|
# Do not remove ##? comments. They are used by 'help' to construct the help docs.
|
||||||
|
##? antidote - the cure to slow zsh plugin management
|
||||||
|
##?
|
||||||
|
##? Usage: make <command>"
|
||||||
|
##?
|
||||||
|
##? Commands:
|
||||||
|
|
||||||
|
.DEFAULT_GOAL := help
|
||||||
|
all : build buildman test unittest bump-maj bump-min bump-rev help
|
||||||
|
.PHONY : all
|
||||||
|
|
||||||
|
##? help display this makefile's help information
|
||||||
|
help:
|
||||||
|
@grep "^##?" makefile | cut -c 5-
|
||||||
|
|
||||||
|
##? build run build tasks like generating man pages
|
||||||
|
build:
|
||||||
|
./tools/buildman
|
||||||
|
./tools/run-clitests
|
||||||
|
./tools/bumpver revision
|
||||||
|
|
||||||
|
##? buildman rebuild man pages
|
||||||
|
buildman:
|
||||||
|
./tools/buildman
|
||||||
|
|
||||||
|
##? test run tests
|
||||||
|
test:
|
||||||
|
./tools/run-clitests
|
||||||
|
|
||||||
|
##? unittest run only unittests
|
||||||
|
unittest:
|
||||||
|
./tools/run-clitests --unit
|
||||||
|
|
||||||
|
##? bump-maj bump the major version (X.0.0)
|
||||||
|
bump-maj:
|
||||||
|
./tools/bumpver major
|
||||||
|
|
||||||
|
##? bump-min bump the minor version (0.X.0)
|
||||||
|
bump-min:
|
||||||
|
./tools/bumpver minor
|
||||||
|
|
||||||
|
##? bump-rev bump the revision version (0.0.X)
|
||||||
|
bump-rev:
|
||||||
|
./tools/bumpver revision
|
||||||
|
|
||||||
|
##? bumpver bump the revision version (0.0.X)
|
||||||
|
bumpver:
|
||||||
|
./tools/bumpver revision
|
||||||
102
.antidote/man/antidote-bundle.md
Normal file
102
.antidote/man/antidote-bundle.md
Normal file
|
|
@ -0,0 +1,102 @@
|
||||||
|
---
|
||||||
|
title: antidote-bundle
|
||||||
|
section: 1
|
||||||
|
header: Antidote Manual
|
||||||
|
---
|
||||||
|
|
||||||
|
# NAME
|
||||||
|
|
||||||
|
**antidote bundle** - download a bundle and print its source line
|
||||||
|
|
||||||
|
# SYNOPSIS
|
||||||
|
|
||||||
|
| antidote bundle [\<bundles\>...]
|
||||||
|
|
||||||
|
# DESCRIPTION
|
||||||
|
|
||||||
|
**antidote-bundle** assembles your Zsh plugins. Bundles can be git repos, or local files or directories. If a plugin is a repo, it will be cloned if necessary. The zsh code necessary to load (source) the plugin is then printed.
|
||||||
|
|
||||||
|
| antidote bundle gituser/gitrepo
|
||||||
|
| antidote bundle $ZSH_CUSTOM/plugins/myplugin
|
||||||
|
| antidote bundle ${ZDOTDIR:-\$HOME}/.zlibs/myfile.zsh
|
||||||
|
|
||||||
|
Bundles also support annotations. Annotations allow you have finer grained control over your plugins. Annotations are used in the form \'keyword:value\'.
|
||||||
|
|
||||||
|
`kind`
|
||||||
|
: - **zsh**: A zsh plugin. This is the default kind of bundle.
|
||||||
|
: - **fpath**: Only add the plugin to your _\$fpath_.
|
||||||
|
: - **path**: Add the plugin to your _\$PATH_.
|
||||||
|
: - **clone**: Only clone a plugin, but don't do anything else with it.
|
||||||
|
: - **defer**: Defers loading of a plugin using \'romkatv/zsh-defer\'.
|
||||||
|
: - **autoload**: Autoload all the files in the plugin directory as zsh functions.
|
||||||
|
|
||||||
|
`branch`
|
||||||
|
: The branch annotation allows you to change the default branch of a plugin's repo from **main** to a branch of your choosing.
|
||||||
|
|
||||||
|
`path`
|
||||||
|
: The path annotation allows you to use a subdirectory or file within a plugin's structure instead of the root plugin (eg: \'path:plugins/subplugin\').
|
||||||
|
|
||||||
|
`conditional`
|
||||||
|
: The conditonal annotation allows you to wrap an **if** statement around a plugin's load script. Supply the name of a zero argument zsh function to conditional to perform the test (eg: \'conditional:is-macos\').
|
||||||
|
|
||||||
|
`pre` / `post`
|
||||||
|
: The pre and post annotations allow you to call a function before or after a plugin's load script. This is helpful when configuring plugins, since the configuration functions will only run for active plugins. Supply the name of a zero argument zsh function to pre or post.
|
||||||
|
|
||||||
|
`autoload`
|
||||||
|
: The autoload annotation allows you to autoload a zsh functions directory in addition to however the plugin was loaded as specified by \'kind\'. Supply a relative path to autoload (eg: \'autoload:functions\').
|
||||||
|
|
||||||
|
Cloned repo directory names can be overridden with the following **zstyle**:
|
||||||
|
|
||||||
|
| zstyle \':antidote:bundle\' use-friendly-names \'yes\'
|
||||||
|
|
||||||
|
# OPTIONS
|
||||||
|
|
||||||
|
-h, \--help
|
||||||
|
: Show the help documentation.
|
||||||
|
|
||||||
|
[*\<bundles\>...*]
|
||||||
|
: Zsh plugin bundles
|
||||||
|
|
||||||
|
# EXAMPLES
|
||||||
|
|
||||||
|
Using the **kind:** annotation...
|
||||||
|
|
||||||
|
| # a regular plugin (kind:zsh is implied, so it's unnecessary)
|
||||||
|
| antidote bundle zsh-users/zsh-history-substring-search kind:zsh
|
||||||
|
|
||||||
|
| # add prompt plugins to $fpath
|
||||||
|
| antidote bundle sindresorhus/pure kind:fpath
|
||||||
|
|
||||||
|
| # add utility plugins to $PATH
|
||||||
|
| antidote bundle romkatv/zsh-bench kind:path
|
||||||
|
|
||||||
|
| # clone a repo for use in other ways
|
||||||
|
| antidote bundle mbadolato/iTerm2-Color-Schemes kind:clone
|
||||||
|
|
||||||
|
| # autoload a functions directory
|
||||||
|
| antidote bundle sorin-ionescu/prezto path:modules/utility/functions kind:autoload
|
||||||
|
|
||||||
|
| # defer a plugin to speed up load times
|
||||||
|
| antidote bundle olets/zsh-abbr kind:defer
|
||||||
|
|
||||||
|
Using the **branch:** annotation...
|
||||||
|
|
||||||
|
| # don't use the main branch, use develop instead
|
||||||
|
| antidote bundle zsh-users/zsh-autosuggestions branch:develop
|
||||||
|
|
||||||
|
Using the **path:** annotation...
|
||||||
|
|
||||||
|
| # load oh-my-zsh
|
||||||
|
| antidote bundle ohmyzsh/ohmyzsh path:lib
|
||||||
|
| antidote bundle ohmyzsh/ohmyzsh path:plugins/git
|
||||||
|
|
||||||
|
Using the **conditional:** annotation...
|
||||||
|
|
||||||
|
| # define a conditional function prior to loading antidote
|
||||||
|
| function is_macos {
|
||||||
|
| [[ $OSTYPE == darwin* ]] || return 1
|
||||||
|
| }
|
||||||
|
|
|
||||||
|
| # conditionally load a plugin using the function you made
|
||||||
|
| antidote bundle ohmyzsh/ohmyzsh path:plugins/macos conditional:is_macos
|
||||||
|
|
||||||
25
.antidote/man/antidote-help.md
Normal file
25
.antidote/man/antidote-help.md
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
---
|
||||||
|
title: antidote-help
|
||||||
|
section: 1
|
||||||
|
header: Antidote Manual
|
||||||
|
---
|
||||||
|
|
||||||
|
# NAME
|
||||||
|
|
||||||
|
**antidote help** - show antidote documentation
|
||||||
|
|
||||||
|
# SYNOPSIS
|
||||||
|
|
||||||
|
| antidote help [\<command\>]
|
||||||
|
|
||||||
|
# DESCRIPTION
|
||||||
|
|
||||||
|
**antidote-help** is used to show context-sensitive help for antidote and its commands.
|
||||||
|
|
||||||
|
# OPTIONS
|
||||||
|
|
||||||
|
-h, \--help
|
||||||
|
: Inception-style meta-help recursively.
|
||||||
|
|
||||||
|
[*\<command\>*]
|
||||||
|
: Show help for a specific command.
|
||||||
32
.antidote/man/antidote-home.md
Normal file
32
.antidote/man/antidote-home.md
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
---
|
||||||
|
title: antidote-home
|
||||||
|
section: 1
|
||||||
|
header: Antidote Manual
|
||||||
|
---
|
||||||
|
|
||||||
|
# NAME
|
||||||
|
|
||||||
|
**antidote home** - print where antidote is cloning bundles
|
||||||
|
|
||||||
|
# SYNOPSIS
|
||||||
|
|
||||||
|
| antidote home
|
||||||
|
|
||||||
|
# DESCRIPTION
|
||||||
|
|
||||||
|
**antidote-home** shows you where antidote stores its cloned repos. It is not the home of the antidote utility itself.
|
||||||
|
|
||||||
|
| antidote home
|
||||||
|
|
||||||
|
You can override antidote's default home directory by setting the _\$ANTIDOTE_HOME_ variable in your **.zshrc**.
|
||||||
|
|
||||||
|
# OPTIONS
|
||||||
|
|
||||||
|
-h, \--help
|
||||||
|
: Show the help documentation.
|
||||||
|
|
||||||
|
# EXAMPLES
|
||||||
|
|
||||||
|
You can clear out all your cloned repos like so:
|
||||||
|
|
||||||
|
| rm -rfi $(antidote home)
|
||||||
28
.antidote/man/antidote-init.md
Normal file
28
.antidote/man/antidote-init.md
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
---
|
||||||
|
title: antidote-init
|
||||||
|
section: 1
|
||||||
|
header: Antidote Manual
|
||||||
|
---
|
||||||
|
|
||||||
|
# NAME
|
||||||
|
|
||||||
|
**antidote init** - initialize the shell for dynamic bundles
|
||||||
|
|
||||||
|
# SYNOPSIS
|
||||||
|
|
||||||
|
| source <(antidote init)
|
||||||
|
|
||||||
|
# DESCRIPTION
|
||||||
|
|
||||||
|
**antidote-init** changes how the **antidote** command works by causing **antidote bundle** to automatically source its own output instead of just generating the Zsh script for a static file.
|
||||||
|
|
||||||
|
This behavior exists mainly to support legacy antigen/antibody usage. Static bundling is highly recommended for the best performance. However, dynamic bundling may be preferable for some scenarios, so you can rely on this functionality remaining a key feature in **antidote** to support users preferring dynamic bundles.
|
||||||
|
|
||||||
|
Typical usage involves adding this snippet to your **.zshrc** before using **antidote bundle** commands:
|
||||||
|
|
||||||
|
| source <(antidote init)
|
||||||
|
|
||||||
|
# OPTIONS
|
||||||
|
|
||||||
|
-h, \--help
|
||||||
|
: Show the help documentation.
|
||||||
60
.antidote/man/antidote-install.md
Normal file
60
.antidote/man/antidote-install.md
Normal file
|
|
@ -0,0 +1,60 @@
|
||||||
|
---
|
||||||
|
title: antidote-install
|
||||||
|
section: 1
|
||||||
|
header: Antidote Manual
|
||||||
|
---
|
||||||
|
|
||||||
|
# NAME
|
||||||
|
|
||||||
|
**antidote install** - install a bundle
|
||||||
|
|
||||||
|
# SYNOPSIS
|
||||||
|
|
||||||
|
| antidote install [-h|\--help] [-k|\--kind \<kind\>] [-p|\--path \<path\>]
|
||||||
|
| [-a|\--autoload \<path\>] [-c|\--conditional \<func\>]
|
||||||
|
| [\--pre \<func\>] [\--post \<func\>]
|
||||||
|
| [-b|\--branch \<branch\>] \<bundle\> [\<bundlefile\>]
|
||||||
|
|
||||||
|
# DESCRIPTION
|
||||||
|
|
||||||
|
**antidote-install** clones a new bundle and adds it to your plugins file.
|
||||||
|
|
||||||
|
The default bundle file is **${ZDOTDIR:-\$HOME}/.zsh_plugins.txt**. This can be overridden with the following **zstyle**:
|
||||||
|
|
||||||
|
| zstyle \':antidote:bundle\' file /path/to/my/bundle_file.txt
|
||||||
|
|
||||||
|
# OPTIONS
|
||||||
|
|
||||||
|
-h, \--help
|
||||||
|
: Show the help documentation.
|
||||||
|
|
||||||
|
-k, \--kind <kind>
|
||||||
|
: The kind of bundle. Valid values: autoload, fpath, path, clone, defer, zsh.
|
||||||
|
|
||||||
|
-p, \--path <path>
|
||||||
|
: A relative subpath within the bundle where the plugin is located.
|
||||||
|
|
||||||
|
-b, \--branch <path>
|
||||||
|
: The git branch to use.
|
||||||
|
|
||||||
|
-a, \--autoload <path>
|
||||||
|
: A relative subpath within the bundle where autoload function files are located.
|
||||||
|
|
||||||
|
-c, \--conditional <func>
|
||||||
|
: A conditional function used to check whether to load the bundle.
|
||||||
|
|
||||||
|
\--pre <func>
|
||||||
|
: A function to be called prior to loading the bundle.
|
||||||
|
|
||||||
|
\--post <func>
|
||||||
|
: A function to be called after loading the bundle.
|
||||||
|
|
||||||
|
\<bundle\>
|
||||||
|
: Bundle to be installed.
|
||||||
|
|
||||||
|
[\<bundlefile\>]
|
||||||
|
: Bundle file to write to if not using the default. Defaults to **${ZDOTDIR:-\$HOME}/.zsh_plugins.txt** or zstyle setting.
|
||||||
|
|
||||||
|
# EXAMPLES
|
||||||
|
|
||||||
|
| antidote install zsh-users/zsh-history-substring-search
|
||||||
31
.antidote/man/antidote-list.md
Normal file
31
.antidote/man/antidote-list.md
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
---
|
||||||
|
title: antidote-list
|
||||||
|
section: 1
|
||||||
|
header: Antidote Manual
|
||||||
|
---
|
||||||
|
|
||||||
|
# NAME
|
||||||
|
|
||||||
|
**antidote list** - list cloned bundles
|
||||||
|
|
||||||
|
# SYNOPSIS
|
||||||
|
|
||||||
|
| antidote list [-h|\--help] [-s|\--short] [-d|\--dirs] [-u|\--url]
|
||||||
|
|
||||||
|
# DESCRIPTION
|
||||||
|
|
||||||
|
**antidote-list** lists the cloned bundles in **antidote home**.
|
||||||
|
|
||||||
|
# OPTIONS
|
||||||
|
|
||||||
|
-h, \--help
|
||||||
|
: Show the help documentation.
|
||||||
|
|
||||||
|
-s, \--short
|
||||||
|
: Show shortened repos where possible.
|
||||||
|
|
||||||
|
-d, \--dirs
|
||||||
|
: Show only bundle directories.
|
||||||
|
|
||||||
|
-u, \--url
|
||||||
|
: Show bundle URLs.
|
||||||
36
.antidote/man/antidote-load.md
Normal file
36
.antidote/man/antidote-load.md
Normal file
|
|
@ -0,0 +1,36 @@
|
||||||
|
---
|
||||||
|
title: antidote-load
|
||||||
|
section: 1
|
||||||
|
header: Antidote Manual
|
||||||
|
---
|
||||||
|
|
||||||
|
# NAME
|
||||||
|
|
||||||
|
**antidote load** - statically source bundles
|
||||||
|
|
||||||
|
# SYNOPSIS
|
||||||
|
|
||||||
|
| antidote load [\<bundlefile\> [\<staticfile\>]]
|
||||||
|
|
||||||
|
# DESCRIPTION
|
||||||
|
|
||||||
|
**antidote-load** will turn the bundle file into a static load file and then source it.
|
||||||
|
|
||||||
|
The default bundle file is **${ZDOTDIR:-\$HOME}/.zsh_plugins.txt**. This can be overridden with the following **zstyle**:
|
||||||
|
|
||||||
|
| zstyle \':antidote:bundle\' file /path/to/my/bundle_file.txt
|
||||||
|
|
||||||
|
The default static file is **${ZDOTDIR:-\$HOME}/.zsh_plugins.zsh**. This can be overridden with the following **zstyle**:
|
||||||
|
|
||||||
|
| zstyle \':antidote:static\' file /path/to/my/static_file.zsh
|
||||||
|
|
||||||
|
# OPTIONS
|
||||||
|
|
||||||
|
-h, \--help
|
||||||
|
: Show the help documentation.
|
||||||
|
|
||||||
|
[\<bundlefile\>]
|
||||||
|
: The plugins file to source if not using the default. Defaults to **${ZDOTDIR:-\$HOME}/.zsh_plugins.txt** or zstyle setting.
|
||||||
|
|
||||||
|
[\<staticfile\>]
|
||||||
|
: The static plugins file to generate if not using the default. Defaults to **${ZDOTDIR:-\$HOME}/.zsh_plugins.zsh** or zstyle setting.
|
||||||
25
.antidote/man/antidote-path.md
Normal file
25
.antidote/man/antidote-path.md
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
---
|
||||||
|
title: antidote-path
|
||||||
|
section: 1
|
||||||
|
header: Antidote Manual
|
||||||
|
---
|
||||||
|
|
||||||
|
# NAME
|
||||||
|
|
||||||
|
**antidote path** - print the path of a cloned bundle
|
||||||
|
|
||||||
|
# SYNOPSIS
|
||||||
|
|
||||||
|
| antidote path \<bundle\>
|
||||||
|
|
||||||
|
# DESCRIPTION
|
||||||
|
|
||||||
|
**antidote-path** prints the path of a cloned bundle.
|
||||||
|
|
||||||
|
# OPTIONS
|
||||||
|
|
||||||
|
-h, \--help
|
||||||
|
: Show the help documentation.
|
||||||
|
|
||||||
|
[\<bundle\>]
|
||||||
|
: The bundle whose cloned path will be printed.
|
||||||
32
.antidote/man/antidote-purge.md
Normal file
32
.antidote/man/antidote-purge.md
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
---
|
||||||
|
title: antidote-purge
|
||||||
|
section: 1
|
||||||
|
header: Antidote Manual
|
||||||
|
---
|
||||||
|
|
||||||
|
# NAME
|
||||||
|
|
||||||
|
**antidote purge** - remove a bundle
|
||||||
|
|
||||||
|
# SYNOPSIS
|
||||||
|
|
||||||
|
| antidote purge \<bundle\>
|
||||||
|
|
||||||
|
# DESCRIPTION
|
||||||
|
|
||||||
|
**antidote-purge** removes a cloned bundle.
|
||||||
|
|
||||||
|
# OPTIONS
|
||||||
|
|
||||||
|
-h, \--help
|
||||||
|
: Show the help documentation.
|
||||||
|
|
||||||
|
-a, \--all
|
||||||
|
: Purge all cloned bundles.
|
||||||
|
|
||||||
|
\<bundle\>
|
||||||
|
: Bundle to be purged.
|
||||||
|
|
||||||
|
# EXAMPLES
|
||||||
|
|
||||||
|
| antidote purge zsh-users/zsh-history-substring-search
|
||||||
32
.antidote/man/antidote-update.md
Normal file
32
.antidote/man/antidote-update.md
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
---
|
||||||
|
title: antidote-update
|
||||||
|
section: 1
|
||||||
|
header: Antidote Manual
|
||||||
|
---
|
||||||
|
|
||||||
|
# NAME
|
||||||
|
|
||||||
|
**antidote update** - update bundles
|
||||||
|
|
||||||
|
# SYNOPSIS
|
||||||
|
|
||||||
|
| antidote update [-h|\--help] [-s|\--self] [-b|\--bundles]
|
||||||
|
|
||||||
|
# DESCRIPTION
|
||||||
|
|
||||||
|
**antidote-update** updates antidote and its cloned bundles.
|
||||||
|
|
||||||
|
# OPTIONS
|
||||||
|
|
||||||
|
-h, \--help
|
||||||
|
: Show the help documentation.
|
||||||
|
|
||||||
|
-s, \--self
|
||||||
|
: Update antidote.
|
||||||
|
|
||||||
|
-b, \--bundles
|
||||||
|
: Update bundles.
|
||||||
|
|
||||||
|
# EXAMPLES
|
||||||
|
|
||||||
|
| antidote update
|
||||||
174
.antidote/man/antidote.md
Normal file
174
.antidote/man/antidote.md
Normal file
|
|
@ -0,0 +1,174 @@
|
||||||
|
---
|
||||||
|
title: antidote
|
||||||
|
section: 1
|
||||||
|
header: Antidote Manual
|
||||||
|
---
|
||||||
|
|
||||||
|
# NAME
|
||||||
|
|
||||||
|
**antidote** - the cure to slow zsh plugin management
|
||||||
|
|
||||||
|
# SYNOPSIS
|
||||||
|
|
||||||
|
| antidote [-v | --version] [-h | --help] \<command\> [\<args\> ...]
|
||||||
|
|
||||||
|
# DESCRIPTION
|
||||||
|
|
||||||
|
**antidote** is a Zsh plugin manager made from the ground up thinking about performance.
|
||||||
|
|
||||||
|
It is fast because it can do things concurrently, and generates an ultra-fast static plugin file that you can easily load from your Zsh config.
|
||||||
|
|
||||||
|
It is written natively in Zsh, is well tested, and picks up where Antigen and Antibody left off.
|
||||||
|
|
||||||
|
# OPTIONS
|
||||||
|
|
||||||
|
-h, \--help
|
||||||
|
: Show context-sensitive help for antidote.
|
||||||
|
|
||||||
|
-v, \--version
|
||||||
|
: Show currently installed antidote 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
|
||||||
|
|
||||||
|
# EXAMPLES
|
||||||
|
|
||||||
|
## A Simple Config
|
||||||
|
|
||||||
|
Create a _.zsh_plugins.txt_ file with a list of the plugins you want:
|
||||||
|
|
||||||
|
| # ${ZDOTDIR:-\$HOME}/.zsh_plugins.txt
|
||||||
|
| zsh-users/zsh-syntax-highlighting
|
||||||
|
| zsh-users/zsh-history-substring-search
|
||||||
|
| zsh-users/zsh-autosuggestions
|
||||||
|
|
||||||
|
Now, simply load your newly created static plugins file in your _.zshrc_.
|
||||||
|
|
||||||
|
| # ${ZDOTDIR:-\$HOME}/.zshrc
|
||||||
|
| source /path/to/antidote/antidote.zsh
|
||||||
|
| antidote load
|
||||||
|
|
||||||
|
## A More Advanced Config
|
||||||
|
|
||||||
|
Your _.zsh_plugins.txt_ file supports annotations. Annotations tell antidote how to do things like load plugins from alternate paths. This lets you use plugins from popular frameworks like Oh-My-Zsh:
|
||||||
|
|
||||||
|
| # ${ZDOTDIR:-\$HOME}/.zsh_plugins.txt
|
||||||
|
| ohmyzsh/ohmyzsh path:lib
|
||||||
|
| ohmyzsh/ohmyzsh path:plugins/git
|
||||||
|
| ohmyzsh/ohmyzsh path:plugins/magic-enter
|
||||||
|
| etc...
|
||||||
|
|
||||||
|
## Dynamic Bundling
|
||||||
|
|
||||||
|
Users familiar with legacy plugin managers like Antigen might prefer to use dynamic bundling. With dynamic bundling you sacrifice some performance to avoid having separate plugin files. To use dynamic bundling, we need to change how **antidote bundle** handles your plugins. We do this by sourcing the output from **antidote init**.
|
||||||
|
|
||||||
|
An example config might look like this:
|
||||||
|
|
||||||
|
| source /path/to/antidote/antidote.zsh
|
||||||
|
| source <(antidote init)
|
||||||
|
| antidote bundle zsh-users/zsh-autosuggestions
|
||||||
|
| antidote bundle ohmyzsh/ohmyzsh path:lib
|
||||||
|
| antidote bundle ohmyzsh/ohmyzsh path:plugins/git
|
||||||
|
|
||||||
|
Instead of calling **antidote bundle** over and over, you might prefer to load bundles with a HEREDOC.
|
||||||
|
|
||||||
|
| source /path/to/antidote/antidote.zsh
|
||||||
|
| source <(antidote init)
|
||||||
|
| antidote bundle <<EOBUNDLES
|
||||||
|
| zsh-users/zsh-syntax-highlighting # regular plugins
|
||||||
|
| ohmyzsh/ohmyzsh path:lib # directories
|
||||||
|
| ohmyzsh/ohmyzsh path:plugins/magic-enter # frameworks
|
||||||
|
| https://github.com/zsh-users/zsh-history-substring-search # URLs
|
||||||
|
| EOBUNDLES
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
To install antidote you can clone it with git:
|
||||||
|
|
||||||
|
| git clone --depth=1 https://github.com/mattmc3/antidote.git ${ZDOTDIR:-\$HOME}/.antidote
|
||||||
|
|
||||||
|
Then, simply add the following snippet to your .zshrc:
|
||||||
|
|
||||||
|
| source ${ZDOTDIR:-\$HOME}/.antidote/antidote.zsh
|
||||||
|
| antidote load
|
||||||
|
|
||||||
|
# CUSTOMIZATION
|
||||||
|
|
||||||
|
The location where antidote clones repositories can bu customized by setting **$ANTIDOTE_HOME**:
|
||||||
|
|
||||||
|
| ANTIDOTE_HOME=/path/to/my/repos
|
||||||
|
|
||||||
|
The bundle directory in ANTIDOTE_HOME can be changed to use friendly names with the following **zstyle**:
|
||||||
|
|
||||||
|
| zstyle \':antidote:bundle\' use-friendly-names on
|
||||||
|
|
||||||
|
The default bundle file is **${ZDOTDIR:-\$HOME}/.zsh_plugins.txt**. This can be overridden with the following **zstyle**:
|
||||||
|
|
||||||
|
| zstyle \':antidote:bundle\' file /path/to/my/bundle_file.txt
|
||||||
|
|
||||||
|
The default static file is **${ZDOTDIR:-\$HOME}/.zsh_plugins.zsh**. This can be overridden with the following **zstyle**:
|
||||||
|
|
||||||
|
| zstyle \':antidote:static\' file /path/to/my/static_file.zsh
|
||||||
|
|
||||||
|
The default options used by romkatv/zsh-defer can be changed with the following **zstyle**:
|
||||||
|
|
||||||
|
| zstyle ':antidote:bundle:*' defer-options '-a'
|
||||||
|
| zstyle ':antidote:bundle:foo/bar' defer-options '-p'
|
||||||
|
|
||||||
|
Bundles can be Zsh compiled with the following **zstyle**:
|
||||||
|
|
||||||
|
| zstyle ':antidote:bundle:*' zcompile 'yes'
|
||||||
|
|
||||||
|
Or, if you only want to zcompile specific bundles, you can set those individually:
|
||||||
|
|
||||||
|
| zstyle ':antidote:bundle:*' zcompile 'yes'
|
||||||
|
| zstyle ':antidote:bundle:zsh-users/zsh-syntax-highlighting' zcompile 'no'
|
||||||
|
|
||||||
|
The static file can be Zsh compiled with the following **zstyle**:
|
||||||
|
|
||||||
|
| zstyle ':antidote:static' zcompile 'yes'
|
||||||
|
|
||||||
|
Or, to Zsh compile everything, static file and all bundles:
|
||||||
|
|
||||||
|
| zstyle ':antidote:*' zcompile 'yes'
|
||||||
|
|
||||||
|
By default, antidote appends to the end of your $fpath. This is highly recommended, however if you really want to change that behavior, there's a zstyle for that:
|
||||||
|
|
||||||
|
| zstyle ':antidote:fpath' rule 'prepend'
|
||||||
|
|
||||||
|
By default, antidote uses romkatv/zsh-defer for deferred plugins. If there's a fork you'd prefer to use, you can specify that with this zstyle:
|
||||||
|
|
||||||
|
| zstyle ':antidote:defer' bundle 'getantidote/zsh-defer'
|
||||||
|
|
||||||
|
# SEE ALSO
|
||||||
|
|
||||||
|
For more information, visit https://antidote.sh
|
||||||
185
.antidote/man/man1/antidote-bundle.1
Normal file
185
.antidote/man/man1/antidote-bundle.1
Normal file
|
|
@ -0,0 +1,185 @@
|
||||||
|
.\" Automatically generated by Pandoc
|
||||||
|
.\"
|
||||||
|
.TH "antidote\-bundle" "1" "" "" "Antidote Manual"
|
||||||
|
.SH NAME
|
||||||
|
\f[B]antidote bundle\f[R] \- download a bundle and print its source line
|
||||||
|
.SH SYNOPSIS
|
||||||
|
.PP
|
||||||
|
antidote bundle [<bundles>\&...]
|
||||||
|
.SH DESCRIPTION
|
||||||
|
\f[B]antidote\-bundle\f[R] assembles your Zsh plugins.
|
||||||
|
Bundles can be git repos, or local files or directories.
|
||||||
|
If a plugin is a repo, it will be cloned if necessary.
|
||||||
|
The zsh code necessary to load (source) the plugin is then printed.
|
||||||
|
.PP
|
||||||
|
\ \ antidote bundle gituser/gitrepo
|
||||||
|
.PD 0
|
||||||
|
.P
|
||||||
|
.PD
|
||||||
|
\ \ antidote bundle $ZSH_CUSTOM/plugins/myplugin
|
||||||
|
.PD 0
|
||||||
|
.P
|
||||||
|
.PD
|
||||||
|
\ \ antidote bundle ${ZDOTDIR:\-$HOME}/.zlibs/myfile.zsh
|
||||||
|
.PP
|
||||||
|
Bundles also support annotations.
|
||||||
|
Annotations allow you have finer grained control over your plugins.
|
||||||
|
Annotations are used in the form \[aq]keyword:value\[aq].
|
||||||
|
.TP
|
||||||
|
\f[CR]kind\f[R]
|
||||||
|
.IP \[bu] 2
|
||||||
|
\f[B]zsh\f[R]: A zsh plugin.
|
||||||
|
This is the default kind of bundle.
|
||||||
|
.IP \[bu] 2
|
||||||
|
\f[B]fpath\f[R]: Only add the plugin to your \f[I]$fpath\f[R].
|
||||||
|
.IP \[bu] 2
|
||||||
|
\f[B]path\f[R]: Add the plugin to your \f[I]$PATH\f[R].
|
||||||
|
.IP \[bu] 2
|
||||||
|
\f[B]clone\f[R]: Only clone a plugin, but don\[cq]t do anything else
|
||||||
|
with it.
|
||||||
|
.IP \[bu] 2
|
||||||
|
\f[B]defer\f[R]: Defers loading of a plugin using
|
||||||
|
\[aq]romkatv/zsh\-defer\[aq].
|
||||||
|
.IP \[bu] 2
|
||||||
|
\f[B]autoload\f[R]: Autoload all the files in the plugin directory as
|
||||||
|
zsh functions.
|
||||||
|
.TP
|
||||||
|
\f[CR]branch\f[R]
|
||||||
|
The branch annotation allows you to change the default branch of a
|
||||||
|
plugin\[cq]s repo from \f[B]main\f[R] to a branch of your choosing.
|
||||||
|
.TP
|
||||||
|
\f[CR]path\f[R]
|
||||||
|
The path annotation allows you to use a subdirectory or file within a
|
||||||
|
plugin\[cq]s structure instead of the root plugin (eg:
|
||||||
|
\[aq]path:plugins/subplugin\[aq]).
|
||||||
|
.TP
|
||||||
|
\f[CR]conditional\f[R]
|
||||||
|
The conditonal annotation allows you to wrap an \f[B]if\f[R] statement
|
||||||
|
around a plugin\[cq]s load script.
|
||||||
|
Supply the name of a zero argument zsh function to conditional to
|
||||||
|
perform the test (eg: \[aq]conditional:is\-macos\[aq]).
|
||||||
|
.TP
|
||||||
|
\f[CR]pre\f[R] / \f[CR]post\f[R]
|
||||||
|
The pre and post annotations allow you to call a function before or
|
||||||
|
after a plugin\[cq]s load script.
|
||||||
|
This is helpful when configuring plugins, since the configuration
|
||||||
|
functions will only run for active plugins.
|
||||||
|
Supply the name of a zero argument zsh function to pre or post.
|
||||||
|
.TP
|
||||||
|
\f[CR]autoload\f[R]
|
||||||
|
The autoload annotation allows you to autoload a zsh functions directory
|
||||||
|
in addition to however the plugin was loaded as specified by
|
||||||
|
\[aq]kind\[aq].
|
||||||
|
Supply a relative path to autoload (eg: \[aq]autoload:functions\[aq]).
|
||||||
|
.PP
|
||||||
|
Cloned repo directory names can be overridden with the following
|
||||||
|
\f[B]zstyle\f[R]:
|
||||||
|
.PP
|
||||||
|
\ \ zstyle \[aq]:antidote:bundle\[aq] use\-friendly\-names \[aq]yes\[aq]
|
||||||
|
.SH OPTIONS
|
||||||
|
.TP
|
||||||
|
\-h, \-\-help
|
||||||
|
Show the help documentation.
|
||||||
|
.TP
|
||||||
|
[\f[I]<bundles>\&...\f[R]]
|
||||||
|
Zsh plugin bundles
|
||||||
|
.SH EXAMPLES
|
||||||
|
Using the \f[B]kind:\f[R] annotation\&...
|
||||||
|
.PP
|
||||||
|
\ \ # a regular plugin (kind:zsh is implied, so it\[cq]s unnecessary)
|
||||||
|
.PD 0
|
||||||
|
.P
|
||||||
|
.PD
|
||||||
|
\ \ antidote bundle zsh\-users/zsh\-history\-substring\-search kind:zsh
|
||||||
|
.PP
|
||||||
|
\ \ # add prompt plugins to $fpath
|
||||||
|
.PD 0
|
||||||
|
.P
|
||||||
|
.PD
|
||||||
|
\ \ antidote bundle sindresorhus/pure kind:fpath
|
||||||
|
.PP
|
||||||
|
\ \ # add utility plugins to $PATH
|
||||||
|
.PD 0
|
||||||
|
.P
|
||||||
|
.PD
|
||||||
|
\ \ antidote bundle romkatv/zsh\-bench kind:path
|
||||||
|
.PP
|
||||||
|
\ \ # clone a repo for use in other ways
|
||||||
|
.PD 0
|
||||||
|
.P
|
||||||
|
.PD
|
||||||
|
\ \ antidote bundle mbadolato/iTerm2\-Color\-Schemes kind:clone
|
||||||
|
.PP
|
||||||
|
\ \ # autoload a functions directory
|
||||||
|
.PD 0
|
||||||
|
.P
|
||||||
|
.PD
|
||||||
|
\ \ antidote bundle sorin\-ionescu/prezto path:modules/utility/functions
|
||||||
|
kind:autoload
|
||||||
|
.PP
|
||||||
|
\ \ # defer a plugin to speed up load times
|
||||||
|
.PD 0
|
||||||
|
.P
|
||||||
|
.PD
|
||||||
|
\ \ antidote bundle olets/zsh\-abbr kind:defer
|
||||||
|
.PP
|
||||||
|
Using the \f[B]branch:\f[R] annotation\&...
|
||||||
|
.PP
|
||||||
|
\ \ # don\[cq]t use the main branch, use develop instead
|
||||||
|
.PD 0
|
||||||
|
.P
|
||||||
|
.PD
|
||||||
|
\ \ antidote bundle zsh\-users/zsh\-autosuggestions branch:develop
|
||||||
|
.PP
|
||||||
|
Using the \f[B]path:\f[R] annotation\&...
|
||||||
|
.PP
|
||||||
|
\ \ # load oh\-my\-zsh
|
||||||
|
.PD 0
|
||||||
|
.P
|
||||||
|
.PD
|
||||||
|
\ \ antidote bundle ohmyzsh/ohmyzsh path:lib
|
||||||
|
.PD 0
|
||||||
|
.P
|
||||||
|
.PD
|
||||||
|
\ \ antidote bundle ohmyzsh/ohmyzsh path:plugins/git
|
||||||
|
.PP
|
||||||
|
Using the \f[B]conditional:\f[R] annotation\&...
|
||||||
|
.PP
|
||||||
|
\ \ # define a conditional function prior to loading antidote
|
||||||
|
.PD 0
|
||||||
|
.P
|
||||||
|
.PD
|
||||||
|
\ \ function is_macos {
|
||||||
|
.PD 0
|
||||||
|
.P
|
||||||
|
.PD
|
||||||
|
\ \ \ \ [[ $OSTYPE == darwin* ]] || return 1
|
||||||
|
.PD 0
|
||||||
|
.P
|
||||||
|
.PD
|
||||||
|
\ \ }
|
||||||
|
.PD 0
|
||||||
|
.P
|
||||||
|
.PD
|
||||||
|
.PD 0
|
||||||
|
.P
|
||||||
|
.PD
|
||||||
|
\ \ # conditionally load a plugin using the function you made
|
||||||
|
.PD 0
|
||||||
|
.P
|
||||||
|
.PD
|
||||||
|
\ \ antidote bundle ohmyzsh/ohmyzsh path:plugins/macos
|
||||||
|
conditional:is_macos
|
||||||
|
.SH BUGS
|
||||||
|
See GitHub Issues: \c
|
||||||
|
.UR https://github.com/mattmc3/antidote/issues
|
||||||
|
.UE \c
|
||||||
|
.SH AUTHORS
|
||||||
|
.IP \[bu] 2
|
||||||
|
Copyright (c) 2021\-2024 Matt McElheny
|
||||||
|
.IP \[bu] 2
|
||||||
|
antidote contributors: \c
|
||||||
|
.UR https://github.com/mattmc3/antidote/graphs/contributors
|
||||||
|
.UE \c
|
||||||
|
.SH LICENSE
|
||||||
|
MIT
|
||||||
31
.antidote/man/man1/antidote-help.1
Normal file
31
.antidote/man/man1/antidote-help.1
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
.\" Automatically generated by Pandoc
|
||||||
|
.\"
|
||||||
|
.TH "antidote\-help" "1" "" "" "Antidote Manual"
|
||||||
|
.SH NAME
|
||||||
|
\f[B]antidote help\f[R] \- show antidote documentation
|
||||||
|
.SH SYNOPSIS
|
||||||
|
.PP
|
||||||
|
antidote help [<command>]
|
||||||
|
.SH DESCRIPTION
|
||||||
|
\f[B]antidote\-help\f[R] is used to show context\-sensitive help for
|
||||||
|
antidote and its commands.
|
||||||
|
.SH OPTIONS
|
||||||
|
.TP
|
||||||
|
\-h, \-\-help
|
||||||
|
Inception\-style meta\-help recursively.
|
||||||
|
.TP
|
||||||
|
[\f[I]<command>\f[R]]
|
||||||
|
Show help for a specific command.
|
||||||
|
.SH BUGS
|
||||||
|
See GitHub Issues: \c
|
||||||
|
.UR https://github.com/mattmc3/antidote/issues
|
||||||
|
.UE \c
|
||||||
|
.SH AUTHORS
|
||||||
|
.IP \[bu] 2
|
||||||
|
Copyright (c) 2021\-2024 Matt McElheny
|
||||||
|
.IP \[bu] 2
|
||||||
|
antidote contributors: \c
|
||||||
|
.UR https://github.com/mattmc3/antidote/graphs/contributors
|
||||||
|
.UE \c
|
||||||
|
.SH LICENSE
|
||||||
|
MIT
|
||||||
38
.antidote/man/man1/antidote-home.1
Normal file
38
.antidote/man/man1/antidote-home.1
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
.\" Automatically generated by Pandoc
|
||||||
|
.\"
|
||||||
|
.TH "antidote\-home" "1" "" "" "Antidote Manual"
|
||||||
|
.SH NAME
|
||||||
|
\f[B]antidote home\f[R] \- print where antidote is cloning bundles
|
||||||
|
.SH SYNOPSIS
|
||||||
|
.PP
|
||||||
|
antidote home
|
||||||
|
.SH DESCRIPTION
|
||||||
|
\f[B]antidote\-home\f[R] shows you where antidote stores its cloned
|
||||||
|
repos.
|
||||||
|
It is not the home of the antidote utility itself.
|
||||||
|
.PP
|
||||||
|
\ \ antidote home
|
||||||
|
.PP
|
||||||
|
You can override antidote\[cq]s default home directory by setting the
|
||||||
|
\f[I]$ANTIDOTE_HOME\f[R] variable in your \f[B].zshrc\f[R].
|
||||||
|
.SH OPTIONS
|
||||||
|
.TP
|
||||||
|
\-h, \-\-help
|
||||||
|
Show the help documentation.
|
||||||
|
.SH EXAMPLES
|
||||||
|
You can clear out all your cloned repos like so:
|
||||||
|
.PP
|
||||||
|
\ \ rm \-rfi $(antidote home)
|
||||||
|
.SH BUGS
|
||||||
|
See GitHub Issues: \c
|
||||||
|
.UR https://github.com/mattmc3/antidote/issues
|
||||||
|
.UE \c
|
||||||
|
.SH AUTHORS
|
||||||
|
.IP \[bu] 2
|
||||||
|
Copyright (c) 2021\-2024 Matt McElheny
|
||||||
|
.IP \[bu] 2
|
||||||
|
antidote contributors: \c
|
||||||
|
.UR https://github.com/mattmc3/antidote/graphs/contributors
|
||||||
|
.UE \c
|
||||||
|
.SH LICENSE
|
||||||
|
MIT
|
||||||
40
.antidote/man/man1/antidote-init.1
Normal file
40
.antidote/man/man1/antidote-init.1
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
.\" Automatically generated by Pandoc
|
||||||
|
.\"
|
||||||
|
.TH "antidote\-init" "1" "" "" "Antidote Manual"
|
||||||
|
.SH NAME
|
||||||
|
\f[B]antidote init\f[R] \- initialize the shell for dynamic bundles
|
||||||
|
.SH SYNOPSIS
|
||||||
|
.PP
|
||||||
|
source <(antidote init)
|
||||||
|
.SH DESCRIPTION
|
||||||
|
\f[B]antidote\-init\f[R] changes how the \f[B]antidote\f[R] command
|
||||||
|
works by causing \f[B]antidote bundle\f[R] to automatically source its
|
||||||
|
own output instead of just generating the Zsh script for a static file.
|
||||||
|
.PP
|
||||||
|
This behavior exists mainly to support legacy antigen/antibody usage.
|
||||||
|
Static bundling is highly recommended for the best performance.
|
||||||
|
However, dynamic bundling may be preferable for some scenarios, so you
|
||||||
|
can rely on this functionality remaining a key feature in
|
||||||
|
\f[B]antidote\f[R] to support users preferring dynamic bundles.
|
||||||
|
.PP
|
||||||
|
Typical usage involves adding this snippet to your \f[B].zshrc\f[R]
|
||||||
|
before using \f[B]antidote bundle\f[R] commands:
|
||||||
|
.PP
|
||||||
|
\ source <(antidote init)
|
||||||
|
.SH OPTIONS
|
||||||
|
.TP
|
||||||
|
\-h, \-\-help
|
||||||
|
Show the help documentation.
|
||||||
|
.SH BUGS
|
||||||
|
See GitHub Issues: \c
|
||||||
|
.UR https://github.com/mattmc3/antidote/issues
|
||||||
|
.UE \c
|
||||||
|
.SH AUTHORS
|
||||||
|
.IP \[bu] 2
|
||||||
|
Copyright (c) 2021\-2024 Matt McElheny
|
||||||
|
.IP \[bu] 2
|
||||||
|
antidote contributors: \c
|
||||||
|
.UR https://github.com/mattmc3/antidote/graphs/contributors
|
||||||
|
.UE \c
|
||||||
|
.SH LICENSE
|
||||||
|
MIT
|
||||||
83
.antidote/man/man1/antidote-install.1
Normal file
83
.antidote/man/man1/antidote-install.1
Normal file
|
|
@ -0,0 +1,83 @@
|
||||||
|
.\" Automatically generated by Pandoc
|
||||||
|
.\"
|
||||||
|
.TH "antidote\-install" "1" "" "" "Antidote Manual"
|
||||||
|
.SH NAME
|
||||||
|
\f[B]antidote install\f[R] \- install a bundle
|
||||||
|
.SH SYNOPSIS
|
||||||
|
.PP
|
||||||
|
antidote install [\-h|\-\-help] [\-k|\-\-kind <kind>] [\-p|\-\-path
|
||||||
|
<path>]
|
||||||
|
.PD 0
|
||||||
|
.P
|
||||||
|
.PD
|
||||||
|
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ [\-a|\-\-autoload <path>]
|
||||||
|
[\-c|\-\-conditional <func>]
|
||||||
|
.PD 0
|
||||||
|
.P
|
||||||
|
.PD
|
||||||
|
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ [\-\-pre <func>] [\-\-post <func>]
|
||||||
|
.PD 0
|
||||||
|
.P
|
||||||
|
.PD
|
||||||
|
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ [\-b|\-\-branch <branch>] <bundle>
|
||||||
|
[<bundlefile>]
|
||||||
|
.SH DESCRIPTION
|
||||||
|
\f[B]antidote\-install\f[R] clones a new bundle and adds it to your
|
||||||
|
plugins file.
|
||||||
|
.PP
|
||||||
|
The default bundle file is
|
||||||
|
\f[B]${ZDOTDIR:\-$HOME}/.zsh_plugins.txt\f[R].
|
||||||
|
This can be overridden with the following \f[B]zstyle\f[R]:
|
||||||
|
.PP
|
||||||
|
\ \ zstyle \[aq]:antidote:bundle\[aq] file /path/to/my/bundle_file.txt
|
||||||
|
.SH OPTIONS
|
||||||
|
.TP
|
||||||
|
\-h, \-\-help
|
||||||
|
Show the help documentation.
|
||||||
|
.TP
|
||||||
|
\-k, \-\-kind
|
||||||
|
The kind of bundle.
|
||||||
|
Valid values: autoload, fpath, path, clone, defer, zsh.
|
||||||
|
.TP
|
||||||
|
\-p, \-\-path
|
||||||
|
A relative subpath within the bundle where the plugin is located.
|
||||||
|
.TP
|
||||||
|
\-b, \-\-branch
|
||||||
|
The git branch to use.
|
||||||
|
.TP
|
||||||
|
\-a, \-\-autoload
|
||||||
|
A relative subpath within the bundle where autoload function files are
|
||||||
|
located.
|
||||||
|
.TP
|
||||||
|
\-c, \-\-conditional
|
||||||
|
A conditional function used to check whether to load the bundle.
|
||||||
|
.TP
|
||||||
|
\-\-pre
|
||||||
|
A function to be called prior to loading the bundle.
|
||||||
|
.TP
|
||||||
|
\-\-post
|
||||||
|
A function to be called after loading the bundle.
|
||||||
|
.TP
|
||||||
|
<bundle>
|
||||||
|
Bundle to be installed.
|
||||||
|
.TP
|
||||||
|
[<bundlefile>]
|
||||||
|
Bundle file to write to if not using the default.
|
||||||
|
Defaults to \f[B]${ZDOTDIR:\-$HOME}/.zsh_plugins.txt\f[R] or zstyle
|
||||||
|
setting.
|
||||||
|
.SH EXAMPLES
|
||||||
|
.PP
|
||||||
|
\ \ antidote install zsh\-users/zsh\-history\-substring\-search
|
||||||
|
.SH BUGS
|
||||||
|
See GitHub Issues: \c
|
||||||
|
.UR https://github.com/mattmc3/antidote/issues
|
||||||
|
.UE \c
|
||||||
|
.SH AUTHORS
|
||||||
|
.IP \[bu] 2
|
||||||
|
Copyright (c) 2021\-2024 Matt McElheny
|
||||||
|
.IP \[bu] 2
|
||||||
|
antidote contributors: \c
|
||||||
|
.UR https://github.com/mattmc3/antidote/graphs/contributors
|
||||||
|
.UE \c
|
||||||
|
.SH LICENSE
|
||||||
|
MIT
|
||||||
38
.antidote/man/man1/antidote-list.1
Normal file
38
.antidote/man/man1/antidote-list.1
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
.\" Automatically generated by Pandoc
|
||||||
|
.\"
|
||||||
|
.TH "antidote\-list" "1" "" "" "Antidote Manual"
|
||||||
|
.SH NAME
|
||||||
|
\f[B]antidote list\f[R] \- list cloned bundles
|
||||||
|
.SH SYNOPSIS
|
||||||
|
.PP
|
||||||
|
antidote list [\-h|\-\-help] [\-s|\-\-short] [\-d|\-\-dirs]
|
||||||
|
[\-u|\-\-url]
|
||||||
|
.SH DESCRIPTION
|
||||||
|
\f[B]antidote\-list\f[R] lists the cloned bundles in \f[B]antidote
|
||||||
|
home\f[R].
|
||||||
|
.SH OPTIONS
|
||||||
|
.TP
|
||||||
|
\-h, \-\-help
|
||||||
|
Show the help documentation.
|
||||||
|
.TP
|
||||||
|
\-s, \-\-short
|
||||||
|
Show shortened repos where possible.
|
||||||
|
.TP
|
||||||
|
\-d, \-\-dirs
|
||||||
|
Show only bundle directories.
|
||||||
|
.TP
|
||||||
|
\-u, \-\-url
|
||||||
|
Show bundle URLs.
|
||||||
|
.SH BUGS
|
||||||
|
See GitHub Issues: \c
|
||||||
|
.UR https://github.com/mattmc3/antidote/issues
|
||||||
|
.UE \c
|
||||||
|
.SH AUTHORS
|
||||||
|
.IP \[bu] 2
|
||||||
|
Copyright (c) 2021\-2024 Matt McElheny
|
||||||
|
.IP \[bu] 2
|
||||||
|
antidote contributors: \c
|
||||||
|
.UR https://github.com/mattmc3/antidote/graphs/contributors
|
||||||
|
.UE \c
|
||||||
|
.SH LICENSE
|
||||||
|
MIT
|
||||||
50
.antidote/man/man1/antidote-load.1
Normal file
50
.antidote/man/man1/antidote-load.1
Normal file
|
|
@ -0,0 +1,50 @@
|
||||||
|
.\" Automatically generated by Pandoc
|
||||||
|
.\"
|
||||||
|
.TH "antidote\-load" "1" "" "" "Antidote Manual"
|
||||||
|
.SH NAME
|
||||||
|
\f[B]antidote load\f[R] \- statically source bundles
|
||||||
|
.SH SYNOPSIS
|
||||||
|
.PP
|
||||||
|
antidote load [<bundlefile> [<staticfile>]]
|
||||||
|
.SH DESCRIPTION
|
||||||
|
\f[B]antidote\-load\f[R] will turn the bundle file into a static load
|
||||||
|
file and then source it.
|
||||||
|
.PP
|
||||||
|
The default bundle file is
|
||||||
|
\f[B]${ZDOTDIR:\-$HOME}/.zsh_plugins.txt\f[R].
|
||||||
|
This can be overridden with the following \f[B]zstyle\f[R]:
|
||||||
|
.PP
|
||||||
|
\ \ zstyle \[aq]:antidote:bundle\[aq] file /path/to/my/bundle_file.txt
|
||||||
|
.PP
|
||||||
|
The default static file is
|
||||||
|
\f[B]${ZDOTDIR:\-$HOME}/.zsh_plugins.zsh\f[R].
|
||||||
|
This can be overridden with the following \f[B]zstyle\f[R]:
|
||||||
|
.PP
|
||||||
|
\ \ zstyle \[aq]:antidote:static\[aq] file /path/to/my/static_file.zsh
|
||||||
|
.SH OPTIONS
|
||||||
|
.TP
|
||||||
|
\-h, \-\-help
|
||||||
|
Show the help documentation.
|
||||||
|
.TP
|
||||||
|
[<bundlefile>]
|
||||||
|
The plugins file to source if not using the default.
|
||||||
|
Defaults to \f[B]${ZDOTDIR:\-$HOME}/.zsh_plugins.txt\f[R] or zstyle
|
||||||
|
setting.
|
||||||
|
.TP
|
||||||
|
[<staticfile>]
|
||||||
|
The static plugins file to generate if not using the default.
|
||||||
|
Defaults to \f[B]${ZDOTDIR:\-$HOME}/.zsh_plugins.zsh\f[R] or zstyle
|
||||||
|
setting.
|
||||||
|
.SH BUGS
|
||||||
|
See GitHub Issues: \c
|
||||||
|
.UR https://github.com/mattmc3/antidote/issues
|
||||||
|
.UE \c
|
||||||
|
.SH AUTHORS
|
||||||
|
.IP \[bu] 2
|
||||||
|
Copyright (c) 2021\-2024 Matt McElheny
|
||||||
|
.IP \[bu] 2
|
||||||
|
antidote contributors: \c
|
||||||
|
.UR https://github.com/mattmc3/antidote/graphs/contributors
|
||||||
|
.UE \c
|
||||||
|
.SH LICENSE
|
||||||
|
MIT
|
||||||
30
.antidote/man/man1/antidote-path.1
Normal file
30
.antidote/man/man1/antidote-path.1
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
.\" Automatically generated by Pandoc
|
||||||
|
.\"
|
||||||
|
.TH "antidote\-path" "1" "" "" "Antidote Manual"
|
||||||
|
.SH NAME
|
||||||
|
\f[B]antidote path\f[R] \- print the path of a cloned bundle
|
||||||
|
.SH SYNOPSIS
|
||||||
|
.PP
|
||||||
|
antidote path <bundle>
|
||||||
|
.SH DESCRIPTION
|
||||||
|
\f[B]antidote\-path\f[R] prints the path of a cloned bundle.
|
||||||
|
.SH OPTIONS
|
||||||
|
.TP
|
||||||
|
\-h, \-\-help
|
||||||
|
Show the help documentation.
|
||||||
|
.TP
|
||||||
|
[<bundle>]
|
||||||
|
The bundle whose cloned path will be printed.
|
||||||
|
.SH BUGS
|
||||||
|
See GitHub Issues: \c
|
||||||
|
.UR https://github.com/mattmc3/antidote/issues
|
||||||
|
.UE \c
|
||||||
|
.SH AUTHORS
|
||||||
|
.IP \[bu] 2
|
||||||
|
Copyright (c) 2021\-2024 Matt McElheny
|
||||||
|
.IP \[bu] 2
|
||||||
|
antidote contributors: \c
|
||||||
|
.UR https://github.com/mattmc3/antidote/graphs/contributors
|
||||||
|
.UE \c
|
||||||
|
.SH LICENSE
|
||||||
|
MIT
|
||||||
36
.antidote/man/man1/antidote-purge.1
Normal file
36
.antidote/man/man1/antidote-purge.1
Normal file
|
|
@ -0,0 +1,36 @@
|
||||||
|
.\" Automatically generated by Pandoc
|
||||||
|
.\"
|
||||||
|
.TH "antidote\-purge" "1" "" "" "Antidote Manual"
|
||||||
|
.SH NAME
|
||||||
|
\f[B]antidote purge\f[R] \- remove a bundle
|
||||||
|
.SH SYNOPSIS
|
||||||
|
.PP
|
||||||
|
antidote purge <bundle>
|
||||||
|
.SH DESCRIPTION
|
||||||
|
\f[B]antidote\-purge\f[R] removes a cloned bundle.
|
||||||
|
.SH OPTIONS
|
||||||
|
.TP
|
||||||
|
\-h, \-\-help
|
||||||
|
Show the help documentation.
|
||||||
|
.TP
|
||||||
|
\-a, \-\-all
|
||||||
|
Purge all cloned bundles.
|
||||||
|
.TP
|
||||||
|
<bundle>
|
||||||
|
Bundle to be purged.
|
||||||
|
.SH EXAMPLES
|
||||||
|
.PP
|
||||||
|
\ \ antidote purge zsh\-users/zsh\-history\-substring\-search
|
||||||
|
.SH BUGS
|
||||||
|
See GitHub Issues: \c
|
||||||
|
.UR https://github.com/mattmc3/antidote/issues
|
||||||
|
.UE \c
|
||||||
|
.SH AUTHORS
|
||||||
|
.IP \[bu] 2
|
||||||
|
Copyright (c) 2021\-2024 Matt McElheny
|
||||||
|
.IP \[bu] 2
|
||||||
|
antidote contributors: \c
|
||||||
|
.UR https://github.com/mattmc3/antidote/graphs/contributors
|
||||||
|
.UE \c
|
||||||
|
.SH LICENSE
|
||||||
|
MIT
|
||||||
36
.antidote/man/man1/antidote-update.1
Normal file
36
.antidote/man/man1/antidote-update.1
Normal file
|
|
@ -0,0 +1,36 @@
|
||||||
|
.\" Automatically generated by Pandoc
|
||||||
|
.\"
|
||||||
|
.TH "antidote\-update" "1" "" "" "Antidote Manual"
|
||||||
|
.SH NAME
|
||||||
|
\f[B]antidote update\f[R] \- update bundles
|
||||||
|
.SH SYNOPSIS
|
||||||
|
.PP
|
||||||
|
antidote update [\-h|\-\-help] [\-s|\-\-self] [\-b|\-\-bundles]
|
||||||
|
.SH DESCRIPTION
|
||||||
|
\f[B]antidote\-update\f[R] updates antidote and its cloned bundles.
|
||||||
|
.SH OPTIONS
|
||||||
|
.TP
|
||||||
|
\-h, \-\-help
|
||||||
|
Show the help documentation.
|
||||||
|
.TP
|
||||||
|
\-s, \-\-self
|
||||||
|
Update antidote.
|
||||||
|
.TP
|
||||||
|
\-b, \-\-bundles
|
||||||
|
Update bundles.
|
||||||
|
.SH EXAMPLES
|
||||||
|
.PP
|
||||||
|
antidote update
|
||||||
|
.SH BUGS
|
||||||
|
See GitHub Issues: \c
|
||||||
|
.UR https://github.com/mattmc3/antidote/issues
|
||||||
|
.UE \c
|
||||||
|
.SH AUTHORS
|
||||||
|
.IP \[bu] 2
|
||||||
|
Copyright (c) 2021\-2024 Matt McElheny
|
||||||
|
.IP \[bu] 2
|
||||||
|
antidote contributors: \c
|
||||||
|
.UR https://github.com/mattmc3/antidote/graphs/contributors
|
||||||
|
.UE \c
|
||||||
|
.SH LICENSE
|
||||||
|
MIT
|
||||||
265
.antidote/man/man1/antidote.1
Normal file
265
.antidote/man/man1/antidote.1
Normal file
|
|
@ -0,0 +1,265 @@
|
||||||
|
.\" Automatically generated by Pandoc
|
||||||
|
.\"
|
||||||
|
.TH "antidote" "1" "" "" "Antidote Manual"
|
||||||
|
.SH NAME
|
||||||
|
\f[B]antidote\f[R] \- the cure to slow zsh plugin management
|
||||||
|
.SH SYNOPSIS
|
||||||
|
.PP
|
||||||
|
antidote [\-v | \[en]version] [\-h | \[en]help] <command> [<args> \&...]
|
||||||
|
.SH DESCRIPTION
|
||||||
|
\f[B]antidote\f[R] is a Zsh plugin manager made from the ground up
|
||||||
|
thinking about performance.
|
||||||
|
.PP
|
||||||
|
It is fast because it can do things concurrently, and generates an
|
||||||
|
ultra\-fast static plugin file that you can easily load from your Zsh
|
||||||
|
config.
|
||||||
|
.PP
|
||||||
|
It is written natively in Zsh, is well tested, and picks up where
|
||||||
|
Antigen and Antibody left off.
|
||||||
|
.SH OPTIONS
|
||||||
|
.TP
|
||||||
|
\-h, \-\-help
|
||||||
|
Show context\-sensitive help for antidote.
|
||||||
|
.TP
|
||||||
|
\-v, \-\-version
|
||||||
|
Show currently installed antidote version.
|
||||||
|
.SH COMMANDS
|
||||||
|
.TP
|
||||||
|
\f[CR]help\f[R]
|
||||||
|
Show documentation
|
||||||
|
.TP
|
||||||
|
\f[CR]load\f[R]
|
||||||
|
Statically source all bundles from the plugins file
|
||||||
|
.TP
|
||||||
|
\f[CR]bundle\f[R]
|
||||||
|
Clone bundle(s) and generate the static load script
|
||||||
|
.TP
|
||||||
|
\f[CR]install\f[R]
|
||||||
|
Clone a new bundle and add it to your plugins file
|
||||||
|
.TP
|
||||||
|
\f[CR]update\f[R]
|
||||||
|
Update antidote and its cloned bundles
|
||||||
|
.TP
|
||||||
|
\f[CR]purge\f[R]
|
||||||
|
Remove a cloned bundle
|
||||||
|
.TP
|
||||||
|
\f[CR]home\f[R]
|
||||||
|
Print where antidote is cloning bundles
|
||||||
|
.TP
|
||||||
|
\f[CR]list\f[R]
|
||||||
|
List cloned bundles
|
||||||
|
.TP
|
||||||
|
\f[CR]path\f[R]
|
||||||
|
Print the path of a cloned bundle
|
||||||
|
.TP
|
||||||
|
\f[CR]init\f[R]
|
||||||
|
Initialize the shell for dynamic bundles
|
||||||
|
.SH EXAMPLES
|
||||||
|
.SS A Simple Config
|
||||||
|
Create a \f[I].zsh_plugins.txt\f[R] file with a list of the plugins you
|
||||||
|
want:
|
||||||
|
.PP
|
||||||
|
\ \ \ # ${ZDOTDIR:\-$HOME}/.zsh_plugins.txt
|
||||||
|
.PD 0
|
||||||
|
.P
|
||||||
|
.PD
|
||||||
|
\ \ \ zsh\-users/zsh\-syntax\-highlighting
|
||||||
|
.PD 0
|
||||||
|
.P
|
||||||
|
.PD
|
||||||
|
\ \ \ zsh\-users/zsh\-history\-substring\-search
|
||||||
|
.PD 0
|
||||||
|
.P
|
||||||
|
.PD
|
||||||
|
\ \ \ zsh\-users/zsh\-autosuggestions
|
||||||
|
.PP
|
||||||
|
Now, simply load your newly created static plugins file in your
|
||||||
|
\f[I].zshrc\f[R].
|
||||||
|
.PP
|
||||||
|
\ \ \ # ${ZDOTDIR:\-$HOME}/.zshrc
|
||||||
|
.PD 0
|
||||||
|
.P
|
||||||
|
.PD
|
||||||
|
\ \ \ source /path/to/antidote/antidote.zsh
|
||||||
|
.PD 0
|
||||||
|
.P
|
||||||
|
.PD
|
||||||
|
\ \ \ antidote load
|
||||||
|
.SS A More Advanced Config
|
||||||
|
Your \f[I].zsh_plugins.txt\f[R] file supports annotations.
|
||||||
|
Annotations tell antidote how to do things like load plugins from
|
||||||
|
alternate paths.
|
||||||
|
This lets you use plugins from popular frameworks like Oh\-My\-Zsh:
|
||||||
|
.PP
|
||||||
|
\ \ \ # ${ZDOTDIR:\-$HOME}/.zsh_plugins.txt
|
||||||
|
.PD 0
|
||||||
|
.P
|
||||||
|
.PD
|
||||||
|
\ \ \ ohmyzsh/ohmyzsh path:lib
|
||||||
|
.PD 0
|
||||||
|
.P
|
||||||
|
.PD
|
||||||
|
\ \ \ ohmyzsh/ohmyzsh path:plugins/git
|
||||||
|
.PD 0
|
||||||
|
.P
|
||||||
|
.PD
|
||||||
|
\ \ \ ohmyzsh/ohmyzsh path:plugins/magic\-enter
|
||||||
|
.PD 0
|
||||||
|
.P
|
||||||
|
.PD
|
||||||
|
\ \ \ etc\&...
|
||||||
|
.SS Dynamic Bundling
|
||||||
|
Users familiar with legacy plugin managers like Antigen might prefer to
|
||||||
|
use dynamic bundling.
|
||||||
|
With dynamic bundling you sacrifice some performance to avoid having
|
||||||
|
separate plugin files.
|
||||||
|
To use dynamic bundling, we need to change how \f[B]antidote bundle\f[R]
|
||||||
|
handles your plugins.
|
||||||
|
We do this by sourcing the output from \f[B]antidote init\f[R].
|
||||||
|
.PP
|
||||||
|
An example config might look like this:
|
||||||
|
.PP
|
||||||
|
\ \ \ source /path/to/antidote/antidote.zsh
|
||||||
|
.PD 0
|
||||||
|
.P
|
||||||
|
.PD
|
||||||
|
\ \ \ source <(antidote init)
|
||||||
|
.PD 0
|
||||||
|
.P
|
||||||
|
.PD
|
||||||
|
\ \ \ antidote bundle zsh\-users/zsh\-autosuggestions
|
||||||
|
.PD 0
|
||||||
|
.P
|
||||||
|
.PD
|
||||||
|
\ \ \ antidote bundle ohmyzsh/ohmyzsh path:lib
|
||||||
|
.PD 0
|
||||||
|
.P
|
||||||
|
.PD
|
||||||
|
\ \ \ antidote bundle ohmyzsh/ohmyzsh path:plugins/git
|
||||||
|
.PP
|
||||||
|
Instead of calling \f[B]antidote bundle\f[R] over and over, you might
|
||||||
|
prefer to load bundles with a HEREDOC.
|
||||||
|
.PP
|
||||||
|
\ \ \ source /path/to/antidote/antidote.zsh
|
||||||
|
.PD 0
|
||||||
|
.P
|
||||||
|
.PD
|
||||||
|
\ \ \ source <(antidote init)
|
||||||
|
.PD 0
|
||||||
|
.P
|
||||||
|
.PD
|
||||||
|
\ \ \ antidote bundle <<EOBUNDLES
|
||||||
|
.PD 0
|
||||||
|
.P
|
||||||
|
.PD
|
||||||
|
\ \ \ \ \ \ \ zsh\-users/zsh\-syntax\-highlighting # regular plugins
|
||||||
|
.PD 0
|
||||||
|
.P
|
||||||
|
.PD
|
||||||
|
\ \ \ \ \ \ \ ohmyzsh/ohmyzsh path:lib # directories
|
||||||
|
.PD 0
|
||||||
|
.P
|
||||||
|
.PD
|
||||||
|
\ \ \ \ \ \ \ ohmyzsh/ohmyzsh path:plugins/magic\-enter # frameworks
|
||||||
|
.PD 0
|
||||||
|
.P
|
||||||
|
.PD
|
||||||
|
\ \ \ \ \ \ \ https://github.com/zsh\-users/zsh\-history\-substring\-search
|
||||||
|
# URLs
|
||||||
|
.PD 0
|
||||||
|
.P
|
||||||
|
.PD
|
||||||
|
\ \ \ EOBUNDLES
|
||||||
|
.SS Installation
|
||||||
|
To install antidote you can clone it with git:
|
||||||
|
.PP
|
||||||
|
\ \ git clone \[en]depth=1 https://github.com/mattmc3/antidote.git
|
||||||
|
${ZDOTDIR:\-$HOME}/.antidote
|
||||||
|
.PP
|
||||||
|
Then, simply add the following snippet to your .zshrc:
|
||||||
|
.PP
|
||||||
|
\ \ source ${ZDOTDIR:\-$HOME}/.antidote/antidote.zsh
|
||||||
|
.PD 0
|
||||||
|
.P
|
||||||
|
.PD
|
||||||
|
\ \ antidote load
|
||||||
|
.SH CUSTOMIZATION
|
||||||
|
The location where antidote clones repositories can bu customized by
|
||||||
|
setting \f[B]$ANTIDOTE_HOME\f[R]:
|
||||||
|
.PP
|
||||||
|
\ \ ANTIDOTE_HOME=/path/to/my/repos
|
||||||
|
.PP
|
||||||
|
The bundle directory in ANTIDOTE_HOME can be changed to use friendly
|
||||||
|
names with the following \f[B]zstyle\f[R]:
|
||||||
|
.PP
|
||||||
|
\ \ zstyle \[aq]:antidote:bundle\[aq] use\-friendly\-names on
|
||||||
|
.PP
|
||||||
|
The default bundle file is
|
||||||
|
\f[B]${ZDOTDIR:\-$HOME}/.zsh_plugins.txt\f[R].
|
||||||
|
This can be overridden with the following \f[B]zstyle\f[R]:
|
||||||
|
.PP
|
||||||
|
\ \ zstyle \[aq]:antidote:bundle\[aq] file /path/to/my/bundle_file.txt
|
||||||
|
.PP
|
||||||
|
The default static file is
|
||||||
|
\f[B]${ZDOTDIR:\-$HOME}/.zsh_plugins.zsh\f[R].
|
||||||
|
This can be overridden with the following \f[B]zstyle\f[R]:
|
||||||
|
.PP
|
||||||
|
\ \ zstyle \[aq]:antidote:static\[aq] file /path/to/my/static_file.zsh
|
||||||
|
.PP
|
||||||
|
The default options used by romkatv/zsh\-defer can be changed with the
|
||||||
|
following \f[B]zstyle\f[R]:
|
||||||
|
.PP
|
||||||
|
\ \ zstyle \[cq]:antidote:bundle:*\[cq] defer\-options `\-a'
|
||||||
|
.PD 0
|
||||||
|
.P
|
||||||
|
.PD
|
||||||
|
\ \ zstyle `:antidote:bundle:foo/bar' defer\-options `\-p'
|
||||||
|
.PP
|
||||||
|
Bundles can be Zsh compiled with the following \f[B]zstyle\f[R]:
|
||||||
|
.PP
|
||||||
|
\ \ zstyle \[cq]:antidote:bundle:*\[cq] zcompile `yes'
|
||||||
|
.PP
|
||||||
|
Or, if you only want to zcompile specific bundles, you can set those
|
||||||
|
individually:
|
||||||
|
.PP
|
||||||
|
\ \ zstyle \[cq]:antidote:bundle:*\[cq] zcompile `yes'
|
||||||
|
.PD 0
|
||||||
|
.P
|
||||||
|
.PD
|
||||||
|
\ \ zstyle `:antidote:bundle:zsh\-users/zsh\-syntax\-highlighting'
|
||||||
|
zcompile `no'
|
||||||
|
.PP
|
||||||
|
The static file can be Zsh compiled with the following \f[B]zstyle\f[R]:
|
||||||
|
.PP
|
||||||
|
\ \ zstyle `:antidote:static' zcompile `yes'
|
||||||
|
.PP
|
||||||
|
Or, to Zsh compile everything, static file and all bundles:
|
||||||
|
.PP
|
||||||
|
\ \ zstyle \[cq]:antidote:*\[cq] zcompile `yes'
|
||||||
|
.PP
|
||||||
|
By default, antidote appends to the end of your $fpath.
|
||||||
|
This is highly recommended, however if you really want to change that
|
||||||
|
behavior, there\[cq]s a zstyle for that:
|
||||||
|
.PP
|
||||||
|
\ \ zstyle `:antidote:fpath' rule `prepend'
|
||||||
|
.PP
|
||||||
|
By default, antidote uses romkatv/zsh\-defer for deferred plugins.
|
||||||
|
If there\[cq]s a fork you\[cq]d prefer to use, you can specify that with
|
||||||
|
this zstyle:
|
||||||
|
.PP
|
||||||
|
\ \ zstyle `:antidote:defer' bundle `getantidote/zsh\-defer'
|
||||||
|
.SH SEE ALSO
|
||||||
|
For more information, visit https://antidote.sh
|
||||||
|
.SH BUGS
|
||||||
|
See GitHub Issues: \c
|
||||||
|
.UR https://github.com/mattmc3/antidote/issues
|
||||||
|
.UE \c
|
||||||
|
.SH AUTHORS
|
||||||
|
.IP \[bu] 2
|
||||||
|
Copyright (c) 2021\-2024 Matt McElheny
|
||||||
|
.IP \[bu] 2
|
||||||
|
antidote contributors: \c
|
||||||
|
.UR https://github.com/mattmc3/antidote/graphs/contributors
|
||||||
|
.UE \c
|
||||||
|
.SH LICENSE
|
||||||
|
MIT
|
||||||
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
|
||||||
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