Skip to content

Commit 3a30f36

Browse files
authored
Merge pull request #178 from mattmc3/1.9.6
1.9.6
2 parents 90deef1 + 8535893 commit 3a30f36

19 files changed

+90
-72
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.5
2+
current_version = 1.9.6
33
parse = v?(?P<major>\d+)\.(?P<minor>\d+)\.(?P<revision>\d+)
44
serialize = {major}.{minor}.{revision}
55

README.md

Lines changed: 1 addition & 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.5-df5e88)
4+
![version](https://img.shields.io/badge/version-v1.9.6-df5e88)
55

66
<a title="GetAntidote"
77
href="https://getantidote.github.io"

functions/__antidote_load_prep

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#!/bin/zsh
2+
3+
### Prep to load
4+
#function __antidote_load_prep {
5+
emulate -L zsh; setopt local_options $_adote_funcopts
6+
7+
# pass in bundle file, read from zstyle, or use default .zsh_plugins.txt
8+
local bundlefile="$1"
9+
if [[ -z "$bundlefile" ]]; then
10+
zstyle -s ':antidote:bundle' file 'bundlefile' ||
11+
bundlefile=${ZDOTDIR:-$HOME}/.zsh_plugins.txt
12+
fi
13+
14+
# pass in static file, read from zstyle, change extension, or use default .zsh_plugins.zsh
15+
local staticfile="$2"
16+
if [[ -z "$staticfile" ]]; then
17+
zstyle -s ':antidote:static' file 'staticfile'
18+
if [[ -z "$staticfile" ]]; then
19+
if [[ -z "$bundlefile:t:r" ]]; then
20+
staticfile=${bundlefile}.zsh
21+
else
22+
staticfile=${bundlefile:r}.zsh
23+
fi
24+
fi
25+
fi
26+
27+
if [[ ! -e "$bundlefile" ]]; then
28+
# the files can't have the same name
29+
print -ru2 -- "antidote: bundle file not found '$bundlefile'."
30+
return 1
31+
elif [[ "$bundlefile" == "$staticfile" ]]; then
32+
# the files can't have the same name
33+
print -ru2 -- "antidote: bundle file and static file are the same '$bundlefile'."
34+
return 1
35+
fi
36+
37+
# regenerate the static file based on whether the bundle file is newer and whether
38+
# antidote home exists and is ready to be loaded
39+
local force_bundle=0
40+
if ! zstyle -t ':antidote:load:checkfile' disabled; then
41+
local loadable_check_path="$(antidote-home)/.antidote.load"
42+
if [[ ! -e $loadable_check_path ]]; then
43+
force_bundle=1
44+
[[ -d $loadable_check_path:h ]] || mkdir -p $loadable_check_path:h
45+
touch $loadable_check_path
46+
fi
47+
fi
48+
49+
if [[ ! $staticfile -nt $bundlefile ]] || [[ $force_bundle -eq 1 ]]; then
50+
antidote bundle <"$bundlefile" >|"$staticfile"
51+
if [[ -r "${staticfile}.zwc" ]] && ! zstyle -t ':antidote:static' zcompile; then
52+
command rm -f -- "${staticfile}.zwc"
53+
fi
54+
fi
55+
56+
# tell antidote-load what to source
57+
typeset -g REPLY=$staticfile
58+
#print $REPLY
59+
#}

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.5'
7+
local ver='1.9.6'
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-load

Lines changed: 14 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -5,63 +5,22 @@
55
# usage: antidote load [-h|--help] [<bundlefile> [<staticfile>]]
66
#
77
#function antidote-load {
8-
setopt extended_glob
9-
10-
local o_help
11-
zparseopts $_adote_zparopt_flags -- h=o_help -help=h || return 1
12-
13-
if (( $#o_help )); then
8+
if [[ "$1" == (-h|--help) ]]; then
149
antidote-help load
1510
return
1611
fi
1712

18-
# pass in bundle file, read from zstyle, or use default .zsh_plugins.txt
19-
local bundlefile="$1"
20-
if [[ -z "$bundlefile" ]]; then
21-
zstyle -s ':antidote:bundle' file 'bundlefile' ||
22-
bundlefile=${ZDOTDIR:-$HOME}/.zsh_plugins.txt
23-
fi
24-
25-
# pass in static file, read from zstyle, change extension, or use default .zsh_plugins.zsh
26-
local staticfile="$2"
27-
if [[ -z "$staticfile" ]]; then
28-
zstyle -s ':antidote:static' file 'staticfile'
29-
if [[ -z "$staticfile" ]]; then
30-
if [[ -z "$bundlefile:t:r" ]]; then
31-
staticfile=${bundlefile}.zsh
32-
else
33-
staticfile=${bundlefile:r}.zsh
34-
fi
35-
fi
36-
fi
37-
38-
if [[ ! -e "$bundlefile" ]]; then
39-
# the files can't have the same name
40-
print -ru2 -- "antidote: bundle file not found '$bundlefile'."
41-
return 1
42-
elif [[ "$bundlefile" == "$staticfile" ]]; then
43-
# the files can't have the same name
44-
print -ru2 -- "antidote: bundle file and static file are the same '$bundlefile'."
45-
return 1
46-
fi
47-
48-
# regenerate the static file based on whether the bundle file is newer and whether
49-
# antidote home exists and is ready to be loaded
50-
local force_bundle=0
51-
if ! zstyle -t ':antidote:load:checkfile' disabled; then
52-
local loadable_check_path="$(antidote-home)/.antidote.load"
53-
if [[ ! -e $loadable_check_path ]]; then
54-
force_bundle=1
55-
[[ -d $loadable_check_path:h ]] || mkdir -p $loadable_check_path:h
56-
touch $loadable_check_path
57-
fi
58-
fi
59-
60-
if [[ ! $staticfile -nt $bundlefile ]] || [[ $force_bundle -eq 1 ]]; then
61-
antidote bundle <"$bundlefile" >|"$staticfile"
62-
if [[ -r "${staticfile}.zwc" ]] && zstyle -T ':antidote:static' zcompile; then
63-
command rm -f -- "${staticfile}.zwc"
64-
fi
65-
fi
66-
source "$staticfile"
13+
# We can't use LOCAL_OPTIONS because sourcing plugins means we'd lose any Zsh options
14+
# set in those plugins, so we delegate all the work to __antidote_load_prep where
15+
# we can safely use LOCAL_OPTIONS. For this function, we should do the bare minimum
16+
# so the user can set whatever crazy Zsh options they want, and antidote doesn't need
17+
# to concern itself with that.
18+
#
19+
# "Is your house on fire, Clark? No, Aunt Bethany, those are the user's Zsh options."
20+
#
21+
typeset -g REPLY=
22+
__antidote_load_prep "$@" || return 1
23+
[[ -f "$REPLY" ]] || return 2
24+
source "$REPLY"
25+
unset REPLY
6726
#}

man/man1/antidote-bundle.1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.\" Automatically generated by Pandoc 3.1.12.1
1+
.\" Automatically generated by Pandoc 3.1.12.2
22
.\"
33
.TH "antidote\-bundle" "1" "" "" "Antidote Manual"
44
.SH NAME

man/man1/antidote-help.1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.\" Automatically generated by Pandoc 3.1.12.1
1+
.\" Automatically generated by Pandoc 3.1.12.2
22
.\"
33
.TH "antidote\-help" "1" "" "" "Antidote Manual"
44
.SH NAME

man/man1/antidote-home.1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.\" Automatically generated by Pandoc 3.1.12.1
1+
.\" Automatically generated by Pandoc 3.1.12.2
22
.\"
33
.TH "antidote\-home" "1" "" "" "Antidote Manual"
44
.SH NAME

man/man1/antidote-init.1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.\" Automatically generated by Pandoc 3.1.12.1
1+
.\" Automatically generated by Pandoc 3.1.12.2
22
.\"
33
.TH "antidote\-init" "1" "" "" "Antidote Manual"
44
.SH NAME

man/man1/antidote-install.1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.\" Automatically generated by Pandoc 3.1.12.1
1+
.\" Automatically generated by Pandoc 3.1.12.2
22
.\"
33
.TH "antidote\-install" "1" "" "" "Antidote Manual"
44
.SH NAME

0 commit comments

Comments
 (0)