diff --git a/.bumpversion.cfg b/.bumpversion.cfg index b71bcbb..125e85b 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 1.9.2 +current_version = 1.9.3 parse = v?(?P\d+)\.(?P\d+)\.(?P\d+) serialize = {major}.{minor}.{revision} diff --git a/README.md b/README.md index 711ab62..8743745 100644 --- a/README.md +++ b/README.md @@ -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.2-df5e88) +![version](https://img.shields.io/badge/version-v1.9.3-df5e88) /dev/null; then + source ${0:A:h}/antidote.zsh + fi antidote-main "$@" } antidote "$@" diff --git a/functions/__antidote_bulk_clone b/functions/__antidote_bulk_clone index efb0716..ba6292e 100644 --- a/functions/__antidote_bulk_clone +++ b/functions/__antidote_bulk_clone @@ -5,7 +5,7 @@ emulate -L zsh; setopt local_options $_adote_funcopts # get a list of clonable repos from a bundle file - awk ' + $__adote_awkcmd ' BEGIN { RS="[\r\n]" } # initialize vars diff --git a/functions/__antidote_filter_defers b/functions/__antidote_filter_defers index fd700c1..2b425fa 100644 --- a/functions/__antidote_filter_defers +++ b/functions/__antidote_filter_defers @@ -3,7 +3,7 @@ ### Filter all but the first defer block. #function __antidote_filter_defers { emulate -L zsh; setopt local_options $_adote_funcopts - awk ' + $__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-- } diff --git a/functions/__antidote_parse_bundles b/functions/__antidote_parse_bundles index f64f4e7..684b2a8 100644 --- a/functions/__antidote_parse_bundles +++ b/functions/__antidote_parse_bundles @@ -3,7 +3,7 @@ ### Parse antidote's bundle DSL. #function __antidote_parse_bundles { emulate -L zsh; setopt local_options $_adote_funcopts - awk ' + $__adote_awkcmd ' BEGIN { RS="[\r\n]" } # skip comments and empty lines diff --git a/functions/__antidote_setup b/functions/__antidote_setup index d85dc17..da3cde7 100644 --- a/functions/__antidote_setup +++ b/functions/__antidote_setup @@ -6,8 +6,11 @@ fpath=( "${0:A:h}" $fpath ) local fn for fn in ${0:A:h}/*; do - [[ $fn:t != '__antidote_setup' ]] || continue - (( $+functions[${fn:t}] )) && unfunction ${fn:t} + [[ ${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 @@ -29,4 +32,8 @@ 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 #} diff --git a/functions/__antidote_version b/functions/__antidote_version index 64458ff..ed4abe4 100644 --- a/functions/__antidote_version +++ b/functions/__antidote_version @@ -4,7 +4,7 @@ #function __antidote_version { emulate -L zsh; setopt local_options $_adote_funcopts 0=${(%):-%x} - local ver='1.9.2' + local ver='1.9.3' local gitsha=$(git -C "${0:A:h:h}" rev-parse --short HEAD 2>/dev/null) [[ -z "$gitsha" ]] || ver="$ver ($gitsha)" print "antidote version $ver" diff --git a/functions/_antidote b/functions/_antidote index 772d034..9817b05 100644 --- a/functions/_antidote +++ b/functions/_antidote @@ -3,7 +3,7 @@ function _antidote_subcommands { local usage=$( antidote --help | - awk ' + $__adote_awkcmd ' BEGIN{OFS=":"; p=0} /^commands:$/ {p=1; next} !p{next} diff --git a/functions/antidote b/functions/antidote index b81464c..db46057 100644 --- a/functions/antidote +++ b/functions/antidote @@ -9,6 +9,8 @@ # #function antidote { 0=${(%):-%x} - (( $+functions[antidote-main] )) || source ${0:A:h:h}/antidote.zsh + if ! typeset -f antidote-main > /dev/null; then + source ${0:A:h:h}/antidote.zsh + fi antidote-main "$@" #} diff --git a/functions/antidote-install b/functions/antidote-install index e7dd44d..c493d15 100644 --- a/functions/antidote-install +++ b/functions/antidote-install @@ -35,7 +35,7 @@ done if [[ $# -eq 0 ]]; then - print >&2 "antidote: error: required argument 'bundle' not provided, try --help" + print -ru2 "antidote: error: required argument 'bundle' not provided, try --help" return 1 fi @@ -43,12 +43,12 @@ local bundlefile=$2 if [[ -z "$bundlefile" ]]; then zstyle -s ':antidote:bundle' file 'bundlefile' || - bundlefile=${ZDOTDIR:-~}/.zsh_plugins.txt + bundlefile=${ZDOTDIR:-$HOME}/.zsh_plugins.txt fi local bundledir=$(__antidote_bundle_dir $bundle) if [[ -d "$bundledir" ]]; then - print >&2 "antidote: error: $bundle already installed: $bundledir" + print -ru2 "antidote: error: $bundle already installed: $bundledir" return 1 fi @@ -57,7 +57,7 @@ (( $#annotations )) && bundlestr+=" $annotations" antidote-bundle "$bundlestr" >/dev/null if [[ $? -ne 0 ]]; then - print >&2 "antidote: unable to install bundle '$bundle'." + print -ru2 "antidote: unable to install bundle '$bundle'." else print "Adding bundle to '$bundlefile':" print $bundlestr | tee -a $bundlefile diff --git a/functions/antidote-list b/functions/antidote-list index 9fd8d9d..f54698e 100644 --- a/functions/antidote-list +++ b/functions/antidote-list @@ -21,7 +21,7 @@ fi if [[ $# -ne 0 ]]; then - print >&2 "antidote: error: unexpected $1, try --help" + print -ru2 "antidote: error: unexpected $1, try --help" return 1 fi diff --git a/functions/antidote-main b/functions/antidote-main index 14e4ccc..13ef90c 100644 --- a/functions/antidote-main +++ b/functions/antidote-main @@ -8,12 +8,17 @@ #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 @@ -22,7 +27,7 @@ elif [[ ${#} -eq 0 ]]; then antidote-help - return 2 + ret=2 elif [[ "${1}" = help ]]; then local manpage=${2:-antidote} @@ -31,9 +36,14 @@ elif (( $+functions[antidote-${1}] )); then local cmd=${1}; shift antidote-${cmd} "$@" - return $? + ret=$? else - print >&2 "antidote: command not found '${1}'" && return 1 + 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 #} diff --git a/functions/antidote-path b/functions/antidote-path index a304d20..838d2a1 100644 --- a/functions/antidote-path +++ b/functions/antidote-path @@ -16,14 +16,14 @@ fi if [[ $# -eq 0 ]]; then - print >&2 "antidote: error: required argument 'bundle' not provided, try --help" + print -ru2 "antidote: error: required argument 'bundle' not provided, try --help" return 1 fi local bundle="$1" local bundledir=$(__antidote_bundle_dir $bundle) if [[ ! -d $bundledir ]]; then - print >&2 "antidote: error: $bundle does not exist in cloned paths" + print -ru2 "antidote: error: $bundle does not exist in cloned paths" return 1 else print "$bundledir" diff --git a/functions/antidote-purge b/functions/antidote-purge index 7662897..c4d16c0 100644 --- a/functions/antidote-purge +++ b/functions/antidote-purge @@ -20,13 +20,13 @@ fi if [[ $# -eq 0 ]] && ! (( $#o_all )); then - print >&2 "antidote: error: required argument 'bundle' not provided, try --help" + print -ru2 "antidote: error: required argument 'bundle' not provided, try --help" return 1 fi local bundlefile zstyle -s ':antidote:bundle' file 'bundlefile' || - bundlefile=${ZDOTDIR:-~}/.zsh_plugins.txt + bundlefile=${ZDOTDIR:-$HOME}/.zsh_plugins.txt if (( $#o_all )); then # last chance to save the user from themselves @@ -57,13 +57,13 @@ local bundle=$1 # make sure the user isn't trying to do something out-of-bounds if [[ -e "$bundle" ]]; then - print >&2 "antidote: error: '$bundle' is not a repo and cannot be removed by antidote." + 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 >&2 "antidote: error: $bundle does not exist at the expected location: $bundledir" + print -ru2 "antidote: error: $bundle does not exist at the expected location: $bundledir" return 1 fi @@ -74,7 +74,7 @@ # attempt to comment out the bundle from .zsh_plugins.txt if [[ -e "$bundlefile" ]]; then local tmpfile="${bundlefile}.antidote.tmp" - awk -v pat="$bundle" '$0~"^[[:blank:]]*"pat{print "# " $0;next}1' <$bundlefile >|$tmpfile + $__adote_awkcmd -v pat="$bundle" '$0~"^[[:blank:]]*"pat{print "# " $0;next}1' <$bundlefile >|$tmpfile mv -f "$tmpfile" "$bundlefile" || rm -f "$tmpfile" print "Bundle '$bundle' was commented out in '$bundlefile'." fi diff --git a/functions/antidote-script b/functions/antidote-script index 0c637a3..fdfe5ae 100644 --- a/functions/antidote-script +++ b/functions/antidote-script @@ -45,12 +45,12 @@ local supported_kind_vals=(autoload clone defer fpath path zsh) if (( $#o_kind )) && ! (( $supported_kind_vals[(Ie)$o_kind[-1]] )); then - print >&2 "antidote: error: unexpected kind value: '$o_kind[-1]'" && return 1 + print -ru2 "antidote: error: unexpected kind value: '$o_kind[-1]'" && return 1 fi local bundle=$1 if [[ -z "$bundle" ]]; then - print >&2 "antidote: error: bundle argument expected" && return 1 + print -ru2 "antidote: error: bundle argument expected" && return 1 fi local bundle_name=$(__antidote_bundle_name $bundle) @@ -68,7 +68,7 @@ bundle_type="$(__antidote_bundle_type $bundle)" if [[ "$bundle_type" == (repo|url|sshurl) ]] && [[ ! -e "$bundle_path" ]]; then local giturl=$(__antidote_tourl $bundle) - print >&2 "# antidote cloning $bundle_name..." + 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 diff --git a/man/antidote-bundle.md b/man/antidote-bundle.md index 9ef5d9a..a5b579e 100644 --- a/man/antidote-bundle.md +++ b/man/antidote-bundle.md @@ -17,8 +17,8 @@ header: Antidote Manual **antidote-bundle** assembles your Zsh plugins. Bundles can be git repos, or local files or dirctories. 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 ${ZDOTDIR:-}/.zplugins/myplugin -| antidote bundle ${ZDOTDIR:-~}/.zlibs/myfile.zsh +| 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\'. @@ -94,7 +94,7 @@ Using the **conditional:** annotation... | # define a conditional function prior to loading antidote | function is_macos { -| [[ $OSTYPE == darwin* ]] && return 0 || return 1 +| [[ $OSTYPE == darwin* ]] || return 1 | } | | # conditionally load a plugin using the function you made diff --git a/man/antidote-install.md b/man/antidote-install.md index 57335fa..24903a4 100644 --- a/man/antidote-install.md +++ b/man/antidote-install.md @@ -49,7 +49,7 @@ header: Antidote Manual : Bundle to be installed. [\] -: Bundle file to write to if not using the default. Defaults to **${ZDOTDIR:-~}/.zsh_plugins.txt** or zstyle setting. +: Bundle file to write to if not using the default. Defaults to **${ZDOTDIR:-\$HOME}/.zsh_plugins.txt** or zstyle setting. # EXAMPLES diff --git a/man/antidote-load.md b/man/antidote-load.md index 8199703..4aabd54 100644 --- a/man/antidote-load.md +++ b/man/antidote-load.md @@ -16,15 +16,15 @@ header: Antidote Manual **antidote-load** will turn the bundle file into a static load file and then source it. -The default bundle file is **${ZDOTDIR:-~}/.zsh_plugins.txt**. This can be overridden with the following **zstyle**: +The default bundle file is **${ZDOTDIR:-\$HOME}/.zsh_plugins.txt**. This can be overridden with the following **zstyle**: | bundlefile=~/.zplugins -| zstyle ':antidote:bundle' file $bundlefile +| zstyle \':antidote:bundle\' file $bundlefile -The default static file is **${ZDOTDIR:-~}/.zsh_plugins.zsh**. This can be overridden with the following **zstyle**: +The default static file is **${ZDOTDIR:-\$HOME}/.zsh_plugins.zsh**. This can be overridden with the following **zstyle**: | staticfile=~/.zplugins.zsh -| zstyle ':antidote:static' file $staticfile +| zstyle \':antidote:static\' file $staticfile # OPTIONS @@ -32,7 +32,7 @@ The default static file is **${ZDOTDIR:-~}/.zsh_plugins.zsh**. This can be overr : Show the help documentation. [\] -: The plugins file to source if not using the default. Defaults to **${ZDOTDIR:-~}/.zsh_plugins.txt** or zstyle setting. +: The plugins file to source if not using the default. Defaults to **${ZDOTDIR:-\$HOME}/.zsh_plugins.txt** or zstyle setting. [\] -: The static plugins file to generate if not using the default. Defaults to **${ZDOTDIR:-~}/.zsh_plugins.zsh** or zstyle setting. +: The static plugins file to generate if not using the default. Defaults to **${ZDOTDIR:-\$HOME}/.zsh_plugins.zsh** or zstyle setting. diff --git a/man/antidote.md b/man/antidote.md index 1a333d2..4705bf1 100644 --- a/man/antidote.md +++ b/man/antidote.md @@ -66,14 +66,14 @@ It is written natively in Zsh, is well tested, and picks up where Antigen and An Create a _.zsh_plugins.txt_ file with a list of the plugins you want: -| # ${ZDOTDIR:-~}/.zsh_plugins.txt +| # ${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:-~}/.zshrc +| # ${ZDOTDIR:-\$HOME}/.zshrc | source /path/to/antidote/antidote.zsh | antidote load @@ -81,7 +81,7 @@ Now, simply load your newly created static plugins file in your _.zshrc_. 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:-~}/.zsh_plugins.txt +| # ${ZDOTDIR:-\$HOME}/.zsh_plugins.txt | ohmyzsh/ohmyzsh path:lib | ohmyzsh/ohmyzsh path:plugins/git | ohmyzsh/ohmyzsh path:plugins/magic-enter @@ -114,11 +114,11 @@ Instead of calling **antidote bundle** over and over, you might prefer to load b To install antidote you can clone it with git: -| git clone --depth=1 https://github.com/mattmc3/antidote.git ${ZDOTDIR:-~}/.antidote +| git clone --depth=1 https://github.com/mattmc3/antidote.git ${ZDOTDIR:-\$HOME}/.antidote Then, simply add the following snippet to your .zshrc: -| source ${ZDOTDIR:-~}/.antidote/antidote.zsh +| source ${ZDOTDIR:-\$HOME}/.antidote/antidote.zsh | antidote load # SEE ALSO diff --git a/man/man1/antidote-bundle.1 b/man/man1/antidote-bundle.1 index cab15a8..8d5bd61 100644 --- a/man/man1/antidote-bundle.1 +++ b/man/man1/antidote-bundle.1 @@ -1,29 +1,12 @@ -.\" Automatically generated by Pandoc 3.1.4 +.\" Automatically generated by Pandoc 3.1.8 .\" -.\" Define V font for inline verbatim, using C font in formats -.\" that render this, and otherwise B font. -.ie "\f[CB]x\f[]"x" \{\ -. ftr V B -. ftr VI BI -. ftr VB B -. ftr VBI BI -.\} -.el \{\ -. ftr V CR -. ftr VI CI -. ftr VB CB -. ftr VBI CBI -.\} .TH "antidote-bundle" "1" "" "" "Antidote Manual" -.hy .SH NAME -.PP \f[B]antidote bundle\f[R] - download a bundle and print its source line .SH SYNOPSIS .PP antidote bundle [\&...] .SH DESCRIPTION -.PP \f[B]antidote-bundle\f[R] assembles your Zsh plugins. Bundles can be git repos, or local files or dirctories. If a plugin is a repo, it will be cloned if necessary. @@ -33,17 +16,17 @@ The zsh code necessary to load (source) the plugin is then printed. .PD 0 .P .PD -\ \ antidote bundle ${ZDOTDIR:-}/.zplugins/myplugin +\ \ antidote bundle $ZSH_CUSTOM/plugins/myplugin .PD 0 .P .PD -\ \ antidote bundle ${ZDOTDIR:-\[ti]}/.zlibs/myfile.zsh +\ \ 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[V]kind\f[R] +\f[CR]kind\f[R] .IP \[bu] 2 \f[B]zsh\f[R]: A zsh plugin. This is the default kind of bundle. @@ -61,29 +44,29 @@ with it. \f[B]autoload\f[R]: Autoload all the files in the plugin directory as zsh functions. .TP -\f[V]branch\f[R] +\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[V]path\f[R] +\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[V]conditional\f[R] +\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[V]pre\f[R] / \f[V]post\f[R] +\f[CR]pre\f[R] / \f[CR]post\f[R] The pre and post annotations allow you to call a function befor 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[V]autoload\f[R] +\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]. @@ -101,7 +84,6 @@ Show the help documentation. [\f[I]\&...\f[R]] Zsh plugin bundles .SH EXAMPLES -.PP Using the \f[B]kind:\f[R] annotation\&... .PP \ \ # a regular plugin (kind:zsh is implied, so it\[cq]s unnecessary) @@ -171,7 +153,7 @@ Using the \f[B]conditional:\f[R] annotation\&... .PD 0 .P .PD -\ \ \ \ [[ $OSTYPE == darwin* ]] && return 0 || return 1 +\ \ \ \ [[ $OSTYPE == darwin* ]] || return 1 .PD 0 .P .PD @@ -189,7 +171,6 @@ Using the \f[B]conditional:\f[R] annotation\&... \ \ antidote bundle ohmyzsh/ohmyzsh path:plugins/macos conditional:is_macos .SH BUGS -.PP See GitHub Issues: .SH AUTHORS .IP \[bu] 2 @@ -198,5 +179,4 @@ Copyright (c) 2021-2023 Matt McElheny antidote contributers: .SH LICENSE -.PP MIT diff --git a/man/man1/antidote-help.1 b/man/man1/antidote-help.1 index dd13184..ef30af2 100644 --- a/man/man1/antidote-help.1 +++ b/man/man1/antidote-help.1 @@ -1,29 +1,12 @@ -.\" Automatically generated by Pandoc 3.1.4 +.\" Automatically generated by Pandoc 3.1.8 .\" -.\" Define V font for inline verbatim, using C font in formats -.\" that render this, and otherwise B font. -.ie "\f[CB]x\f[]"x" \{\ -. ftr V B -. ftr VI BI -. ftr VB B -. ftr VBI BI -.\} -.el \{\ -. ftr V CR -. ftr VI CI -. ftr VB CB -. ftr VBI CBI -.\} .TH "antidote-help" "1" "" "" "Antidote Manual" -.hy .SH NAME -.PP \f[B]antidote help\f[R] - show antidote documentation .SH SYNOPSIS .PP antidote help [] .SH DESCRIPTION -.PP \f[B]antidote-help\f[R] is used to show context-sensitive help for antidote and its commands. .SH OPTIONS @@ -34,7 +17,6 @@ Inception-style meta-help recursively. [\f[I]\f[R]] Show help for a specific command. .SH BUGS -.PP See GitHub Issues: .SH AUTHORS .IP \[bu] 2 @@ -43,5 +25,4 @@ Copyright (c) 2021-2023 Matt McElheny antidote contributers: .SH LICENSE -.PP MIT diff --git a/man/man1/antidote-home.1 b/man/man1/antidote-home.1 index a262bb9..39c67fc 100644 --- a/man/man1/antidote-home.1 +++ b/man/man1/antidote-home.1 @@ -1,29 +1,12 @@ -.\" Automatically generated by Pandoc 3.1.4 +.\" Automatically generated by Pandoc 3.1.8 .\" -.\" Define V font for inline verbatim, using C font in formats -.\" that render this, and otherwise B font. -.ie "\f[CB]x\f[]"x" \{\ -. ftr V B -. ftr VI BI -. ftr VB B -. ftr VBI BI -.\} -.el \{\ -. ftr V CR -. ftr VI CI -. ftr VB CB -. ftr VBI CBI -.\} .TH "antidote-home" "1" "" "" "Antidote Manual" -.hy .SH NAME -.PP \f[B]antidote home\f[R] - print where antidote is cloning bundles .SH SYNOPSIS .PP antidote home .SH DESCRIPTION -.PP \f[B]antidote-home\f[R] shows you where antidote stores its cloned repos. It is not the home of the antidote utility itself. @@ -37,12 +20,10 @@ You can override antidote\[cq]s default home directory by setting the -h, --help Show the help documentation. .SH EXAMPLES -.PP You can clear out all your cloned repos like so: .PP \ \ rm -rfi $(antidote home) .SH BUGS -.PP See GitHub Issues: .SH AUTHORS .IP \[bu] 2 @@ -51,5 +32,4 @@ Copyright (c) 2021-2023 Matt McElheny antidote contributers: .SH LICENSE -.PP MIT diff --git a/man/man1/antidote-init.1 b/man/man1/antidote-init.1 index 6d6b8a9..8567120 100644 --- a/man/man1/antidote-init.1 +++ b/man/man1/antidote-init.1 @@ -1,29 +1,12 @@ -.\" Automatically generated by Pandoc 3.1.4 +.\" Automatically generated by Pandoc 3.1.8 .\" -.\" Define V font for inline verbatim, using C font in formats -.\" that render this, and otherwise B font. -.ie "\f[CB]x\f[]"x" \{\ -. ftr V B -. ftr VI BI -. ftr VB B -. ftr VBI BI -.\} -.el \{\ -. ftr V CR -. ftr VI CI -. ftr VB CB -. ftr VBI CBI -.\} .TH "antidote-init" "1" "" "" "Antidote Manual" -.hy .SH NAME -.PP \f[B]antidote init\f[R] - initialize the shell for dynamic bundles .SH SYNOPSIS .PP source <(antidote init) .SH DESCRIPTION -.PP \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. @@ -43,7 +26,6 @@ before using \f[B]antidote bundle\f[R] commands: -h, --help Show the help documentation. .SH BUGS -.PP See GitHub Issues: .SH AUTHORS .IP \[bu] 2 @@ -52,5 +34,4 @@ Copyright (c) 2021-2023 Matt McElheny antidote contributers: .SH LICENSE -.PP MIT diff --git a/man/man1/antidote-install.1 b/man/man1/antidote-install.1 index c30540d..9458014 100644 --- a/man/man1/antidote-install.1 +++ b/man/man1/antidote-install.1 @@ -1,23 +1,7 @@ -.\" Automatically generated by Pandoc 3.1.4 +.\" Automatically generated by Pandoc 3.1.8 .\" -.\" Define V font for inline verbatim, using C font in formats -.\" that render this, and otherwise B font. -.ie "\f[CB]x\f[]"x" \{\ -. ftr V B -. ftr VI BI -. ftr VB B -. ftr VBI BI -.\} -.el \{\ -. ftr V CR -. ftr VI CI -. ftr VB CB -. ftr VBI CBI -.\} .TH "antidote-install" "1" "" "" "Antidote Manual" -.hy .SH NAME -.PP \f[B]antidote install\f[R] - install a bundle .SH SYNOPSIS .PP @@ -37,7 +21,6 @@ antidote install [-h|--help] [-k|--kind ] [-p|--path ] \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ [-b|--branch ] [] .SH DESCRIPTION -.PP \f[B]antidote-install\f[R] clones a new bundle and adds it to your plugins file. .SH OPTIONS @@ -73,13 +56,12 @@ Bundle to be installed. .TP [] Bundle file to write to if not using the default. -Defaults to \f[B]${ZDOTDIR:-\[ti]}/.zsh_plugins.txt\f[R] or zstyle +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 -.PP See GitHub Issues: .SH AUTHORS .IP \[bu] 2 @@ -88,5 +70,4 @@ Copyright (c) 2021-2023 Matt McElheny antidote contributers: .SH LICENSE -.PP MIT diff --git a/man/man1/antidote-list.1 b/man/man1/antidote-list.1 index a2bc12b..1101bfb 100644 --- a/man/man1/antidote-list.1 +++ b/man/man1/antidote-list.1 @@ -1,29 +1,12 @@ -.\" Automatically generated by Pandoc 3.1.4 +.\" Automatically generated by Pandoc 3.1.8 .\" -.\" Define V font for inline verbatim, using C font in formats -.\" that render this, and otherwise B font. -.ie "\f[CB]x\f[]"x" \{\ -. ftr V B -. ftr VI BI -. ftr VB B -. ftr VBI BI -.\} -.el \{\ -. ftr V CR -. ftr VI CI -. ftr VB CB -. ftr VBI CBI -.\} .TH "antidote-list" "1" "" "" "Antidote Manual" -.hy .SH NAME -.PP \f[B]antidote list\f[R] - list cloned bundles .SH SYNOPSIS .PP antidote list [-h|--help] [-s|--short] [-d|--dirs] [-u|--url] .SH DESCRIPTION -.PP \f[B]antidote-list\f[R] lists the cloned bundles in \f[B]antidote home\f[R]. .SH OPTIONS @@ -40,7 +23,6 @@ Show only bundle directories. -u, --url Show bundle URLs. .SH BUGS -.PP See GitHub Issues: .SH AUTHORS .IP \[bu] 2 @@ -49,5 +31,4 @@ Copyright (c) 2021-2023 Matt McElheny antidote contributers: .SH LICENSE -.PP MIT diff --git a/man/man1/antidote-load.1 b/man/man1/antidote-load.1 index 54e0f9f..aa5a96d 100644 --- a/man/man1/antidote-load.1 +++ b/man/man1/antidote-load.1 @@ -1,49 +1,32 @@ -.\" Automatically generated by Pandoc 3.1.4 +.\" Automatically generated by Pandoc 3.1.8 .\" -.\" Define V font for inline verbatim, using C font in formats -.\" that render this, and otherwise B font. -.ie "\f[CB]x\f[]"x" \{\ -. ftr V B -. ftr VI BI -. ftr VB B -. ftr VBI BI -.\} -.el \{\ -. ftr V CR -. ftr VI CI -. ftr VB CB -. ftr VBI CBI -.\} .TH "antidote-load" "1" "" "" "Antidote Manual" -.hy .SH NAME -.PP \f[B]antidote load\f[R] - statically source bundles .SH SYNOPSIS .PP antidote load [ []] .SH DESCRIPTION -.PP \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:-\[ti]}/.zsh_plugins.txt\f[R]. +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 \ \ bundlefile=\[ti]/.zplugins .PD 0 .P .PD -\ \ zstyle `:antidote:bundle' file $bundlefile +\ \ zstyle \[aq]:antidote:bundle\[aq] file $bundlefile .PP -The default static file is \f[B]${ZDOTDIR:-\[ti]}/.zsh_plugins.zsh\f[R]. +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 \ \ staticfile=\[ti]/.zplugins.zsh .PD 0 .P .PD -\ \ zstyle `:antidote:static' file $staticfile +\ \ zstyle \[aq]:antidote:static\[aq] file $staticfile .SH OPTIONS .TP -h, --help @@ -51,15 +34,14 @@ Show the help documentation. .TP [] The plugins file to source if not using the default. -Defaults to \f[B]${ZDOTDIR:-\[ti]}/.zsh_plugins.txt\f[R] or zstyle +Defaults to \f[B]${ZDOTDIR:-$HOME}/.zsh_plugins.txt\f[R] or zstyle setting. .TP [] The static plugins file to generate if not using the default. -Defaults to \f[B]${ZDOTDIR:-\[ti]}/.zsh_plugins.zsh\f[R] or zstyle +Defaults to \f[B]${ZDOTDIR:-$HOME}/.zsh_plugins.zsh\f[R] or zstyle setting. .SH BUGS -.PP See GitHub Issues: .SH AUTHORS .IP \[bu] 2 @@ -68,5 +50,4 @@ Copyright (c) 2021-2023 Matt McElheny antidote contributers: .SH LICENSE -.PP MIT diff --git a/man/man1/antidote-path.1 b/man/man1/antidote-path.1 index e99a6db..33e522f 100644 --- a/man/man1/antidote-path.1 +++ b/man/man1/antidote-path.1 @@ -1,29 +1,12 @@ -.\" Automatically generated by Pandoc 3.1.4 +.\" Automatically generated by Pandoc 3.1.8 .\" -.\" Define V font for inline verbatim, using C font in formats -.\" that render this, and otherwise B font. -.ie "\f[CB]x\f[]"x" \{\ -. ftr V B -. ftr VI BI -. ftr VB B -. ftr VBI BI -.\} -.el \{\ -. ftr V CR -. ftr VI CI -. ftr VB CB -. ftr VBI CBI -.\} .TH "antidote-path" "1" "" "" "Antidote Manual" -.hy .SH NAME -.PP \f[B]antidote path\f[R] - print the path of a cloned bundle .SH SYNOPSIS .PP antidote path .SH DESCRIPTION -.PP \f[B]antidote-path\f[R] prints the path of a cloned bundle. .SH OPTIONS .TP @@ -33,7 +16,6 @@ Show the help documentation. [] The bundle whose cloned path will be printed. .SH BUGS -.PP See GitHub Issues: .SH AUTHORS .IP \[bu] 2 @@ -42,5 +24,4 @@ Copyright (c) 2021-2023 Matt McElheny antidote contributers: .SH LICENSE -.PP MIT diff --git a/man/man1/antidote-purge.1 b/man/man1/antidote-purge.1 index 2412423..fb72d40 100644 --- a/man/man1/antidote-purge.1 +++ b/man/man1/antidote-purge.1 @@ -1,29 +1,12 @@ -.\" Automatically generated by Pandoc 3.1.4 +.\" Automatically generated by Pandoc 3.1.8 .\" -.\" Define V font for inline verbatim, using C font in formats -.\" that render this, and otherwise B font. -.ie "\f[CB]x\f[]"x" \{\ -. ftr V B -. ftr VI BI -. ftr VB B -. ftr VBI BI -.\} -.el \{\ -. ftr V CR -. ftr VI CI -. ftr VB CB -. ftr VBI CBI -.\} .TH "antidote-purge" "1" "" "" "Antidote Manual" -.hy .SH NAME -.PP \f[B]antidote purge\f[R] - remove a bundle .SH SYNOPSIS .PP antidote purge .SH DESCRIPTION -.PP \f[B]antidote-purge\f[R] removes a cloned bundle. .SH OPTIONS .TP @@ -39,7 +22,6 @@ Bundle to be purged. .PP \ \ antidote purge zsh-users/zsh-history-substring-search .SH BUGS -.PP See GitHub Issues: .SH AUTHORS .IP \[bu] 2 @@ -48,5 +30,4 @@ Copyright (c) 2021-2023 Matt McElheny antidote contributers: .SH LICENSE -.PP MIT diff --git a/man/man1/antidote-update.1 b/man/man1/antidote-update.1 index 4e051e7..6773545 100644 --- a/man/man1/antidote-update.1 +++ b/man/man1/antidote-update.1 @@ -1,29 +1,12 @@ -.\" Automatically generated by Pandoc 3.1.4 +.\" Automatically generated by Pandoc 3.1.8 .\" -.\" Define V font for inline verbatim, using C font in formats -.\" that render this, and otherwise B font. -.ie "\f[CB]x\f[]"x" \{\ -. ftr V B -. ftr VI BI -. ftr VB B -. ftr VBI BI -.\} -.el \{\ -. ftr V CR -. ftr VI CI -. ftr VB CB -. ftr VBI CBI -.\} .TH "antidote-update" "1" "" "" "Antidote Manual" -.hy .SH NAME -.PP \f[B]antidote update\f[R] - update bundles .SH SYNOPSIS .PP antidote update [-h|--help] [-s|--self] [-b|--bundles] .SH DESCRIPTION -.PP \f[B]antidote-update\f[R] updates antidote and its cloned bundles. .SH OPTIONS .TP @@ -39,7 +22,6 @@ Update bundles. .PP antidote update .SH BUGS -.PP See GitHub Issues: .SH AUTHORS .IP \[bu] 2 @@ -48,5 +30,4 @@ Copyright (c) 2021-2023 Matt McElheny antidote contributers: .SH LICENSE -.PP MIT diff --git a/man/man1/antidote.1 b/man/man1/antidote.1 index 9c58cb8..6fbd948 100644 --- a/man/man1/antidote.1 +++ b/man/man1/antidote.1 @@ -1,29 +1,12 @@ -.\" Automatically generated by Pandoc 3.1.4 +.\" Automatically generated by Pandoc 3.1.8 .\" -.\" Define V font for inline verbatim, using C font in formats -.\" that render this, and otherwise B font. -.ie "\f[CB]x\f[]"x" \{\ -. ftr V B -. ftr VI BI -. ftr VB B -. ftr VBI BI -.\} -.el \{\ -. ftr V CR -. ftr VI CI -. ftr VB CB -. ftr VBI CBI -.\} .TH "antidote" "1" "" "" "Antidote Manual" -.hy .SH NAME -.PP \f[B]antidote\f[R] - the cure to slow zsh plugin management .SH SYNOPSIS .PP antidote [-v | \[en]version] [-h | \[en]help] [ \&...] .SH DESCRIPTION -.PP \f[B]antidote\f[R] is a Zsh plugin manager made from the ground up thinking about performance. .PP @@ -42,42 +25,41 @@ Show context-sensitive help for antidote. Show currently installed antidote version. .SH COMMANDS .TP -\f[V]help\f[R] +\f[CR]help\f[R] Show documentation .TP -\f[V]load\f[R] +\f[CR]load\f[R] Statically source all bundles from the plugins file .TP -\f[V]bundle\f[R] +\f[CR]bundle\f[R] Clone bundle(s) and generate the static load script .TP -\f[V]install\f[R] +\f[CR]install\f[R] Clone a new bundle and add it to your plugins file .TP -\f[V]update\f[R] +\f[CR]update\f[R] Update antidote and its cloned bundles .TP -\f[V]purge\f[R] +\f[CR]purge\f[R] Remove a cloned bundle .TP -\f[V]home\f[R] +\f[CR]home\f[R] Print where antidote is cloning bundles .TP -\f[V]list\f[R] +\f[CR]list\f[R] List cloned bundles .TP -\f[V]path\f[R] +\f[CR]path\f[R] Print the path of a cloned bundle .TP -\f[V]init\f[R] +\f[CR]init\f[R] Initialize the shell for dynamic bundles .SH EXAMPLES .SS A Simple Config -.PP Create a \f[I].zsh_plugins.txt\f[R] file with a list of the plugins you want: .PP -\ \ \ # ${ZDOTDIR:-\[ti]}/.zsh_plugins.txt +\ \ \ # ${ZDOTDIR:-$HOME}/.zsh_plugins.txt .PD 0 .P .PD @@ -94,7 +76,7 @@ want: Now, simply load your newly created static plugins file in your \f[I].zshrc\f[R]. .PP -\ \ \ # ${ZDOTDIR:-\[ti]}/.zshrc +\ \ \ # ${ZDOTDIR:-$HOME}/.zshrc .PD 0 .P .PD @@ -104,13 +86,12 @@ Now, simply load your newly created static plugins file in your .PD \ \ \ antidote load .SS A More Advanced Config -.PP 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:-\[ti]}/.zsh_plugins.txt +\ \ \ # ${ZDOTDIR:-$HOME}/.zsh_plugins.txt .PD 0 .P .PD @@ -128,7 +109,6 @@ This lets you use plugins from popular frameworks like Oh-My-Zsh: .PD \ \ \ etc\&... .SS Dynamic Bundling -.PP Users familiar with legacy plugin managers like Antigen might prefer to use dynamic bundling. With dynamic bundling you sacrifice some performance to avoid having @@ -191,24 +171,21 @@ prefer to load bundles with a HEREDOC. .PD \ \ \ EOBUNDLES .SS Installation -.PP To install antidote you can clone it with git: .PP \ \ git clone \[en]depth=1 https://github.com/mattmc3/antidote.git -${ZDOTDIR:-\[ti]}/.antidote +${ZDOTDIR:-$HOME}/.antidote .PP Then, simply add the following snippet to your .zshrc: .PP -\ \ source ${ZDOTDIR:-\[ti]}/.antidote/antidote.zsh +\ \ source ${ZDOTDIR:-$HOME}/.antidote/antidote.zsh .PD 0 .P .PD \ \ antidote load .SH SEE ALSO -.PP For more information, visit https://getantidote.github.io/ .SH BUGS -.PP See GitHub Issues: .SH AUTHORS .IP \[bu] 2 @@ -217,5 +194,4 @@ Copyright (c) 2021-2023 Matt McElheny antidote contributers: .SH LICENSE -.PP MIT diff --git a/tests/README.md b/tests/README.md index cf1ad6a..e1cfbc6 100644 --- a/tests/README.md +++ b/tests/README.md @@ -21,6 +21,7 @@ But you probably just want to source setup... ```zsh % source ./tests/_setup.zsh +% source ./antidote.zsh % ``` @@ -58,7 +59,7 @@ The `-v/--version` flag displays the current version: ```zsh % antidote --version -antidote version 1.9.2 +antidote version 1.9.3 % ``` diff --git a/tests/functions/t_reset b/tests/functions/t_reset index 6368304..da84516 100644 --- a/tests/functions/t_reset +++ b/tests/functions/t_reset @@ -1,6 +1,8 @@ #!/bin/zsh function t_reset { + 0=${(%):-%x} t_teardown t_setup + source ${0:A:h:h:h}/antidote.zsh } t_reset "$@" diff --git a/tests/functions/t_setup b/tests/functions/t_setup index 62d60e3..43abb16 100644 --- a/tests/functions/t_setup +++ b/tests/functions/t_setup @@ -13,7 +13,7 @@ function t_setup { # setup test functions fpath+=( $testdir/functions ) - autoload -Uz $fpath[-1]/*(N.:t) + autoload -Uz $testdir/functions/* # mock git function git { mockgit "$@" } @@ -30,12 +30,15 @@ function t_setup { typeset -g OLD_ZDOTDIR=$ZDOTDIR export ZDOTDIR=$T_TEMPDIR/zdotdir + # 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' # load antidote typeset -g ANTIDOTE_HOME=$ZDOTDIR/antidote_home - source $prjdir/antidote.zsh } t_setup "$@" diff --git a/tests/functions/t_setup_real b/tests/functions/t_setup_real index 4ac3075..d09ff5c 100644 --- a/tests/functions/t_setup_real +++ b/tests/functions/t_setup_real @@ -2,6 +2,7 @@ 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' @@ -20,5 +21,8 @@ function t_setup_real { # clean out antidote home [[ -d $ANTIDOTE_HOME ]] && rm -rf -- "$ANTIDOTE_HOME" mkdir -p "$ANTIDOTE_HOME" + + # source antidote + source $prjdir/antidote.zsh } t_setup_real "$@" diff --git a/tests/functions/t_teardown b/tests/functions/t_teardown index 088435a..0cf3cf3 100644 --- a/tests/functions/t_teardown +++ b/tests/functions/t_teardown @@ -23,6 +23,10 @@ function t_teardown { source <(zstyle -L ':antidote:*' | awk '{print "zstyle -d",$2}') source <(printf '%s\n' $T_PREV_ZSTYLES) + # remove vars + [[ -v plugins ]] && unset plugins + [[ -v libs ]] && unset libs + # remove tempdir [[ -d "$T_TEMPDIR" ]] && rm -rf -- "$T_TEMPDIR" } diff --git a/tests/test_antidote.md b/tests/test_antidote.md index 4efdd82..6fdcf29 100644 --- a/tests/test_antidote.md +++ b/tests/test_antidote.md @@ -14,6 +14,7 @@ antidote: Expecting zsh. Found 'bash'. % echo $+functions[antidote] 0 % source ./tests/_setup.zsh +% source ./antidote.zsh % echo $+functions[antidote] 1 % git --version @@ -78,7 +79,7 @@ No arg exit status is 2: ```zsh % antidote --version -antidote version 1.9.2 +antidote version 1.9.3 % antidote -v >/dev/null; echo $? 0 % antidote --version >/dev/null; echo $? diff --git a/tests/test_bundle_helpers.md b/tests/test_bundle_helpers.md index d7dd963..37585dc 100644 --- a/tests/test_bundle_helpers.md +++ b/tests/test_bundle_helpers.md @@ -5,6 +5,7 @@ ```zsh % TESTDATA=$PWD/tests/testdata % source ./tests/_setup.zsh +% source ./antidote.zsh % antidote-bundle -h &>/dev/null % ``` diff --git a/tests/test_cmd_bundle.md b/tests/test_cmd_bundle.md index 4f494b7..34d9acc 100644 --- a/tests/test_cmd_bundle.md +++ b/tests/test_cmd_bundle.md @@ -4,6 +4,7 @@ ```zsh % source ./tests/_setup.zsh +% source ./antidote.zsh % ``` diff --git a/tests/test_cmd_help.md b/tests/test_cmd_help.md index dd8f312..3b5baf9 100644 --- a/tests/test_cmd_help.md +++ b/tests/test_cmd_help.md @@ -4,6 +4,7 @@ ```zsh % source ./tests/_setup.zsh +% source ./antidote.zsh % ``` diff --git a/tests/test_cmd_home.md b/tests/test_cmd_home.md index 538961b..ce1298e 100644 --- a/tests/test_cmd_home.md +++ b/tests/test_cmd_home.md @@ -4,6 +4,7 @@ ```zsh % source ./tests/_setup.zsh +% source ./antidote.zsh % ``` diff --git a/tests/test_cmd_init.md b/tests/test_cmd_init.md index 1921d27..22ff6b8 100644 --- a/tests/test_cmd_init.md +++ b/tests/test_cmd_init.md @@ -4,6 +4,7 @@ ```zsh % source ./tests/_setup.zsh +% source ./antidote.zsh % ``` diff --git a/tests/test_cmd_install.md b/tests/test_cmd_install.md index 4f47974..8b2ff82 100644 --- a/tests/test_cmd_install.md +++ b/tests/test_cmd_install.md @@ -4,6 +4,7 @@ ```zsh % source ./tests/_setup.zsh +% source ./antidote.zsh % ``` diff --git a/tests/test_cmd_list.md b/tests/test_cmd_list.md index ffe9fe4..78c013d 100644 --- a/tests/test_cmd_list.md +++ b/tests/test_cmd_list.md @@ -4,6 +4,7 @@ ```zsh % source ./tests/_setup.zsh +% source ./antidote.zsh % ``` diff --git a/tests/test_cmd_load.md b/tests/test_cmd_load.md index 4810f67..70b2dfa 100644 --- a/tests/test_cmd_load.md +++ b/tests/test_cmd_load.md @@ -4,6 +4,7 @@ ```zsh % source ./tests/_setup.zsh +% source ./antidote.zsh % ``` diff --git a/tests/test_cmd_main.md b/tests/test_cmd_main.md index c9e51fe..e7fac46 100644 --- a/tests/test_cmd_main.md +++ b/tests/test_cmd_main.md @@ -4,6 +4,7 @@ ```zsh % source ./tests/_setup.zsh +% source ./antidote.zsh % ``` diff --git a/tests/test_cmd_path.md b/tests/test_cmd_path.md index d06b3c7..692316d 100644 --- a/tests/test_cmd_path.md +++ b/tests/test_cmd_path.md @@ -4,6 +4,7 @@ ```zsh % source ./tests/_setup.zsh +% source ./antidote.zsh % ``` diff --git a/tests/test_cmd_purge.md b/tests/test_cmd_purge.md index 0556e3c..09dfa3f 100644 --- a/tests/test_cmd_purge.md +++ b/tests/test_cmd_purge.md @@ -4,6 +4,7 @@ ```zsh % source ./tests/_setup.zsh +% source ./antidote.zsh % ``` diff --git a/tests/test_cmd_script.md b/tests/test_cmd_script.md index 711485a..ba0c0d9 100644 --- a/tests/test_cmd_script.md +++ b/tests/test_cmd_script.md @@ -4,6 +4,7 @@ ```zsh % source ./tests/_setup.zsh +% source ./antidote.zsh % ``` diff --git a/tests/test_cmd_script_use.md b/tests/test_cmd_script_use.md index e5b5442..88bfad4 100644 --- a/tests/test_cmd_script_use.md +++ b/tests/test_cmd_script_use.md @@ -4,6 +4,7 @@ ```zsh % source ./tests/_setup.zsh +% source ./antidote.zsh % ``` diff --git a/tests/test_cmd_update.md b/tests/test_cmd_update.md index 88b6fa0..9feb9d7 100644 --- a/tests/test_cmd_update.md +++ b/tests/test_cmd_update.md @@ -4,6 +4,7 @@ ```zsh % source ./tests/_setup.zsh +% source ./antidote.zsh % ``` @@ -22,7 +23,7 @@ Bundle updates complete. Updating antidote... Antidote self-update complete. -antidote version 1.9.2 +antidote version 1.9.3 % ``` diff --git a/tests/test_helpers.md b/tests/test_helpers.md index 8c17b3a..f824042 100644 --- a/tests/test_helpers.md +++ b/tests/test_helpers.md @@ -4,6 +4,7 @@ ```zsh % source ./tests/_setup.zsh +% source ./antidote.zsh % ``` diff --git a/tests/test_setopts_special.md b/tests/test_setopts_special.md new file mode 100644 index 0000000..a6f1899 --- /dev/null +++ b/tests/test_setopts_special.md @@ -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 +% +``` diff --git a/tests/test_setopts_respected.md b/tests/test_zsetopts.md similarity index 97% rename from tests/test_setopts_respected.md rename to tests/test_zsetopts.md index d4eb43c..b8d3b38 100644 --- a/tests/test_setopts_respected.md +++ b/tests/test_zsetopts.md @@ -4,6 +4,7 @@ ```zsh % source ./tests/_setup.zsh +% source ./antidote.zsh % ``` @@ -71,13 +72,13 @@ less than 10 enabled zsh opts % optcnt=$(setopt | wc -l | tr -d ' ') % test $optcnt -gt 150 && echo "zillions of enabled zsh options (>150)" zillions of enabled zsh options (>150) -% setopt localoptions % ``` ## Teardown ```zsh +% unsetopt $grizwold_zopts % t_teardown % ``` diff --git a/tests/zdotdir/custom/plugins/grizwold/grizwold.plugin.zsh b/tests/zdotdir/custom/plugins/grizwold/grizwold.plugin.zsh index 0ad907a..6f076cb 100644 --- a/tests/zdotdir/custom/plugins/grizwold/grizwold.plugin.zsh +++ b/tests/zdotdir/custom/plugins/grizwold/grizwold.plugin.zsh @@ -1,6 +1,6 @@ () { setopt interactivecomments - local zopts=( + typeset -ga grizwold_zopts=( noaliases aliasfuncdef allexport @@ -98,7 +98,7 @@ incappendhistorytime # interactive interactivecomments - ksharrays + # ksharrays kshautoload kshglob # kshoptionprint @@ -183,6 +183,5 @@ # xtrace # zle ) - - setopt $zopts + setopt $grizwold_zopts } diff --git a/tools/run-clitests b/tools/run-clitests index 558d0a0..7684d9e 100755 --- a/tools/run-clitests +++ b/tools/run-clitests @@ -4,8 +4,8 @@ setopt extended_glob cd ${0:A:h:h} -local o_unit -zparseopts -D -M -- -unit=o_unit || return 1 +local o_unit o_rev +zparseopts -D -M -- -unit=o_unit -rev=o_rev || return 1 testfiles=() if (( $# > 0 )); then @@ -16,6 +16,11 @@ else testfiles=($PWD/tests/*.md) fi +# if tests are run in reverse order, I can catch places where I didn't teardown properly +if (( $#o_rev )); then + testfiles=(${(O)testfiles}) +fi + # foo example test command # env -i PATH=$PATH FPATH=$FPATH \ # zsh -f -- =clitest --list-run --progress dot --prompt '%' --color always $PWD/tests/foo.md