Skip to content

Commit 414ff3b

Browse files
authored
Merge pull request #167 from mattmc3/v1.9.4
v1.9.4
2 parents 3f18f35 + 2c32631 commit 414ff3b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+574
-225
lines changed

.bumpversion.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 1.9.3
2+
current_version = 1.9.4
33
parse = v?(?P<major>\d+)\.(?P<minor>\d+)\.(?P<revision>\d+)
44
serialize = {major}.{minor}.{revision}
55

README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# antidote
22

33
[![MIT License](https://img.shields.io/badge/license-MIT-007EC7.svg)](/LICENSE)
4-
![version](https://img.shields.io/badge/version-v1.9.3-df5e88)
4+
![version](https://img.shields.io/badge/version-v1.9.4-df5e88)
55

66
<a title="GetAntidote"
77
href="https://getantidote.github.io"
@@ -16,6 +16,22 @@
1616
1717
[Antidote][getantidote] 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.
1818

19+
## NOTICE
20+
21+
**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:
22+
23+
```zsh
24+
zstyle ':antidote:compatibility-mode' 'antibody'
25+
```
26+
27+
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:
28+
29+
- 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)).
30+
- 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.
31+
- probably some other minor deviations as well
32+
33+
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.
34+
1935
## Usage
2036

2137
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`.

antidote.zsh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ if test -z "$ZSH_VERSION"; then
44
echo >&2 "antidote: Expecting zsh. Found '$shellname'."
55
return 1
66
else
7-
autoload -Uz is-at-least
7+
builtin autoload -Uz is-at-least
88
if ! is-at-least 5.4.2; then
99
echo >&2 "antidote: Unsupported Zsh version '$ZSH_VERSION'. Expecting Zsh >5.4.2."
1010
return 1
1111
fi
1212

1313
typeset -f __antidote_setup &>/dev/null && unfunction __antidote_setup
1414
0=${(%):-%N}
15-
autoload -Uz ${0:A:h}/functions/__antidote_setup
15+
builtin autoload -Uz ${0:A:h}/functions/__antidote_setup
1616
__antidote_setup
1717
fi
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/zsh
2+
3+
### Compile bundles
4+
#function __antidote_bundle_zcompile {
5+
emulate -L zsh; setopt local_options $_adote_funcopts
6+
builtin autoload -Uz zrecompile
7+
8+
local -a bundles
9+
if [[ -z "$1" ]]; then
10+
bundles=($(antidote-list --dirs))
11+
elif [[ -f "$1" ]]; then
12+
zrecompile -pq "$1"
13+
return
14+
elif [[ -d "$1" ]]; then
15+
bundles=($1)
16+
else
17+
bundles=($(antidote-path "$1"))
18+
fi
19+
20+
local bundle zfile
21+
for bundle in $bundles; do
22+
for zfile in ${bundle}/**/*.zsh{,-theme}(N); do
23+
[[ $zfile != */test-data/* ]] || continue
24+
zrecompile -pq "$zfile"
25+
done
26+
done
27+
# }

functions/__antidote_collect_input

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/zsh
2+
3+
### Collect <redirected or piped| input
4+
#function __antidote_collect_input {
5+
local -a input=()
6+
if (( $# > 0 )); then
7+
input=("${(s.\n.)${@}}")
8+
elif [[ ! -t 0 ]]; then
9+
local data
10+
while IFS= read -r data || [[ -n "$data" ]]; do
11+
input+=("$data")
12+
done
13+
fi
14+
printf '%s\n' "${input[@]}"
15+
#}

functions/__antidote_setup

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
for fn in ${0:A:h}/*; do
99
[[ ${fn:t} != '__antidote_setup' ]] || continue
1010
if typeset -f ${fn:t} > /dev/null; then
11-
unfunction ${fn:t}
11+
unfunction -- ${fn:t}
1212
fi
1313

1414
# autoload extensionless function files
@@ -20,7 +20,7 @@
2020
export MANPATH="${0:A:h:h}/man:$MANPATH"
2121
fi
2222

23-
autoload -Uz is-at-least
23+
builtin autoload -Uz is-at-least
2424
if is-at-least 5.8; then
2525
# the -F option was added in 5.8
2626
typeset -gHa _adote_zparopt_flags=( -D -M -F )

functions/__antidote_version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#function __antidote_version {
55
emulate -L zsh; setopt local_options $_adote_funcopts
66
0=${(%):-%x}
7-
local ver='1.9.3'
7+
local ver='1.9.4'
88
local gitsha=$(git -C "${0:A:h:h}" rev-parse --short HEAD 2>/dev/null)
99
[[ -z "$gitsha" ]] || ver="$ver ($gitsha)"
1010
print "antidote version $ver"

functions/antidote-bundle

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,25 @@
2020

2121
# handle bundles as newline delimited arg strings,
2222
# or as <redirected or piped| input
23-
local -a bundles=()
24-
if (( $# > 0 )); then
25-
bundles=("${(s.\n.)${@}}")
26-
elif [[ ! -t 0 ]]; then
27-
local data
28-
while IFS= read -r data || [[ -n "$data" ]]; do
29-
bundles+=($data)
30-
done
31-
fi
23+
local -a bundles=("${(@f)$(__antidote_collect_input "$@")}")
3224
(( $#bundles )) || return 1
3325

26+
# output static file compilation
27+
local -a zcompile_script=(
28+
"function {"
29+
' 0=${(%):-%x}'
30+
' local staticfile=${0:A}'
31+
' [[ -e ${staticfile} ]] || return 1'
32+
' if [[ ! -s ${staticfile}.zwc || ${staticfile} -nt ${staticfile}.zwc ]]; then'
33+
' builtin autoload -Uz zrecompile'
34+
' zrecompile -pq ${staticfile}'
35+
' fi'
36+
'}'
37+
)
38+
if zstyle -t ':antidote:static' zcompile; then
39+
printf '%s\n' $zcompile_script
40+
fi
41+
3442
# antidote-script also clones, but this way we can do it all at once in parallel!
3543
if (( $#bundles > 1 )); then
3644
source <(printf '%s\n' $bundles | __antidote_bulk_clone)

functions/antidote-load

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@
5959

6060
if [[ ! $staticfile -nt $bundlefile ]] || [[ $force_bundle -eq 1 ]]; then
6161
antidote bundle <"$bundlefile" >|"$staticfile"
62+
if [[ -r "${staticfile}.zwc" ]] && zstyle -T ':antidote:static' zcompile; then
63+
command rm -f -- "${staticfile}.zwc"
64+
fi
6265
fi
6366
source "$staticfile"
6467
#}

functions/antidote-path

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,25 @@
1515
return
1616
fi
1717

18-
if [[ $# -eq 0 ]]; then
18+
local -a bundles=("${(@f)$(__antidote_collect_input "$@")}")
19+
if (( $#bundles == 0 )); then
1920
print -ru2 "antidote: error: required argument 'bundle' not provided, try --help"
2021
return 1
2122
fi
2223

23-
local bundle="$1"
24-
local bundledir=$(__antidote_bundle_dir $bundle)
25-
if [[ ! -d $bundledir ]]; then
26-
print -ru2 "antidote: error: $bundle does not exist in cloned paths"
27-
return 1
28-
else
29-
print "$bundledir"
30-
fi
24+
local bundle bundledir
25+
local -a results=()
26+
for bundle in $bundles; do
27+
if [[ $bundle == '$'* ]] && [[ $bundle != *'('* ]] && [[ $bundle != *';'* ]]; then
28+
bundle=$(eval print $bundle)
29+
fi
30+
bundledir=$(__antidote_bundle_dir $bundle)
31+
if [[ ! -d $bundledir ]]; then
32+
print -ru2 "antidote: error: $bundle does not exist in cloned paths"
33+
return 1
34+
else
35+
results+=("$bundledir")
36+
fi
37+
done
38+
print -l -- $results
3139
#}

0 commit comments

Comments
 (0)