Skip to content

Commit

Permalink
Merge pull request #178 from mattmc3/1.9.6
Browse files Browse the repository at this point in the history
1.9.6
  • Loading branch information
mattmc3 committed Mar 6, 2024
2 parents 90deef1 + 8535893 commit 3a30f36
Show file tree
Hide file tree
Showing 19 changed files with 90 additions and 72 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 1.9.5
current_version = 1.9.6
parse = v?(?P<major>\d+)\.(?P<minor>\d+)\.(?P<revision>\d+)
serialize = {major}.{minor}.{revision}

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# antidote

[![MIT License](https://img.shields.io/badge/license-MIT-007EC7.svg)](/LICENSE)
![version](https://img.shields.io/badge/version-v1.9.5-df5e88)
![version](https://img.shields.io/badge/version-v1.9.6-df5e88)

<a title="GetAntidote"
href="https://getantidote.github.io"
Expand Down
59 changes: 59 additions & 0 deletions functions/__antidote_load_prep
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/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
antidote bundle <"$bundlefile" >|"$staticfile"
if [[ -r "${staticfile}.zwc" ]] && ! zstyle -t ':antidote:static' zcompile; then
command rm -f -- "${staticfile}.zwc"
fi
fi

# tell antidote-load what to source
typeset -g REPLY=$staticfile
#print $REPLY
#}
2 changes: 1 addition & 1 deletion functions/__antidote_version
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#function __antidote_version {
emulate -L zsh; setopt local_options $_adote_funcopts
0=${(%):-%x}
local ver='1.9.5'
local ver='1.9.6'
local gitsha=$(git -C "${0:A:h:h}" rev-parse --short HEAD 2>/dev/null)
[[ -z "$gitsha" ]] || ver="$ver ($gitsha)"
print "antidote version $ver"
Expand Down
69 changes: 14 additions & 55 deletions functions/antidote-load
Original file line number Diff line number Diff line change
Expand Up @@ -5,63 +5,22 @@
# usage: antidote load [-h|--help] [<bundlefile> [<staticfile>]]
#
#function antidote-load {
setopt extended_glob

local o_help
zparseopts $_adote_zparopt_flags -- h=o_help -help=h || return 1

if (( $#o_help )); then
if [[ "$1" == (-h|--help) ]]; then
antidote-help load
return
fi

# 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
antidote bundle <"$bundlefile" >|"$staticfile"
if [[ -r "${staticfile}.zwc" ]] && zstyle -T ':antidote:static' zcompile; then
command rm -f -- "${staticfile}.zwc"
fi
fi
source "$staticfile"
# 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
#}
2 changes: 1 addition & 1 deletion man/man1/antidote-bundle.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.\" Automatically generated by Pandoc 3.1.12.1
.\" Automatically generated by Pandoc 3.1.12.2
.\"
.TH "antidote\-bundle" "1" "" "" "Antidote Manual"
.SH NAME
Expand Down
2 changes: 1 addition & 1 deletion man/man1/antidote-help.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.\" Automatically generated by Pandoc 3.1.12.1
.\" Automatically generated by Pandoc 3.1.12.2
.\"
.TH "antidote\-help" "1" "" "" "Antidote Manual"
.SH NAME
Expand Down
2 changes: 1 addition & 1 deletion man/man1/antidote-home.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.\" Automatically generated by Pandoc 3.1.12.1
.\" Automatically generated by Pandoc 3.1.12.2
.\"
.TH "antidote\-home" "1" "" "" "Antidote Manual"
.SH NAME
Expand Down
2 changes: 1 addition & 1 deletion man/man1/antidote-init.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.\" Automatically generated by Pandoc 3.1.12.1
.\" Automatically generated by Pandoc 3.1.12.2
.\"
.TH "antidote\-init" "1" "" "" "Antidote Manual"
.SH NAME
Expand Down
2 changes: 1 addition & 1 deletion man/man1/antidote-install.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.\" Automatically generated by Pandoc 3.1.12.1
.\" Automatically generated by Pandoc 3.1.12.2
.\"
.TH "antidote\-install" "1" "" "" "Antidote Manual"
.SH NAME
Expand Down
2 changes: 1 addition & 1 deletion man/man1/antidote-list.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.\" Automatically generated by Pandoc 3.1.12.1
.\" Automatically generated by Pandoc 3.1.12.2
.\"
.TH "antidote\-list" "1" "" "" "Antidote Manual"
.SH NAME
Expand Down
2 changes: 1 addition & 1 deletion man/man1/antidote-load.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.\" Automatically generated by Pandoc 3.1.12.1
.\" Automatically generated by Pandoc 3.1.12.2
.\"
.TH "antidote\-load" "1" "" "" "Antidote Manual"
.SH NAME
Expand Down
2 changes: 1 addition & 1 deletion man/man1/antidote-path.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.\" Automatically generated by Pandoc 3.1.12.1
.\" Automatically generated by Pandoc 3.1.12.2
.\"
.TH "antidote\-path" "1" "" "" "Antidote Manual"
.SH NAME
Expand Down
2 changes: 1 addition & 1 deletion man/man1/antidote-purge.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.\" Automatically generated by Pandoc 3.1.12.1
.\" Automatically generated by Pandoc 3.1.12.2
.\"
.TH "antidote\-purge" "1" "" "" "Antidote Manual"
.SH NAME
Expand Down
2 changes: 1 addition & 1 deletion man/man1/antidote-update.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.\" Automatically generated by Pandoc 3.1.12.1
.\" Automatically generated by Pandoc 3.1.12.2
.\"
.TH "antidote\-update" "1" "" "" "Antidote Manual"
.SH NAME
Expand Down
2 changes: 1 addition & 1 deletion man/man1/antidote.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.\" Automatically generated by Pandoc 3.1.12.1
.\" Automatically generated by Pandoc 3.1.12.2
.\"
.TH "antidote" "1" "" "" "Antidote Manual"
.SH NAME
Expand Down
2 changes: 1 addition & 1 deletion tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ The `-v/--version` flag displays the current version:
```zsh
% antidote --version
antidote version 1.9.5
antidote version 1.9.6
%
```
Expand Down
2 changes: 1 addition & 1 deletion tests/test_antidote.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ No arg exit status is 2:

```zsh
% antidote --version
antidote version 1.9.5
antidote version 1.9.6
% antidote -v >/dev/null; echo $?
0
% antidote --version >/dev/null; echo $?
Expand Down
2 changes: 1 addition & 1 deletion tests/test_cmd_update.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Bundle updates complete.
Updating antidote...
antidote self-update complete.

antidote version 1.9.5
antidote version 1.9.6
%
```

Expand Down

0 comments on commit 3a30f36

Please sign in to comment.