From f46931aad67cca71fc327c2d4c7357ab0b07a986 Mon Sep 17 00:00:00 2001 From: mattmc3 Date: Thu, 5 Oct 2023 16:47:02 -0400 Subject: [PATCH] WIP --- .bumpversion.cfg | 2 + bin/antibody | 175 ++++++++++++++---------- tests/test_antibody.md | 68 ++++++++- tests/testdata/antibody/all_bundles.txt | 119 ++++++++++++++++ tests/testdata/antibody/bundles.txt | 45 ++++++ 5 files changed, 330 insertions(+), 79 deletions(-) create mode 100644 tests/testdata/antibody/all_bundles.txt create mode 100644 tests/testdata/antibody/bundles.txt diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 125e85b..27c9851 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -3,6 +3,8 @@ current_version = 1.9.3 parse = v?(?P\d+)\.(?P\d+)\.(?P\d+) serialize = {major}.{minor}.{revision} +[bumpversion:file:bin/antibody] + [bumpversion:file:functions/__antidote_version] [bumpversion:file:tests/README.md] diff --git a/bin/antibody b/bin/antibody index 3ff1ad6..14ea7aa 100755 --- a/bin/antibody +++ b/bin/antibody @@ -1,23 +1,101 @@ #!/usr/bin/env zsh -typeset -ga antibody_opts=( warn_create_global warn_nested_var extended_glob ) +typeset -ga antibody_opts=( extended_glob no_monitor pipefail ) +typeset -g antibody_version='1.9.2' +if [[ $ANTIBODY_TEST_MODE -eq 1 ]]; then + antibody_opts+=( warn_create_global warn_nested_var ) + antibody_version=dev +fi function __antibody_cmd_bundle { emulate -L zsh; setopt local_options $antibody_opts - # parse the DSL for bundles - local bundles_tsv=$(__antibody_parsebundles $@) - bundles_tsv=(${(@f)${bundles}}) + # handle bundles as newline delimited arg strings, + # or as ...] @@ -140,7 +227,7 @@ function __antibody_help { function __antibody_version { emulate -L zsh; setopt local_options $antibody_opts - print -r "antibody version 1.9.2" + print -r "antibody version ${antibody_version}" } function __antibody_bundledir { @@ -161,64 +248,6 @@ function __antibody_bundledir { print -r -- $bundle } -function __antibody_parsebundles { - emulate -L zsh; setopt local_options $antibody_opts - - # handle bundles as newline delimited arg strings, - # or as ] [ ...] The fastest shell plugin manager Flags: - -h, --help Show context-sensitive help (also try --help-long and --help-man). - -v, --version Show application version. + -h, --help Show context-sensitive help. + -v, --version Show application version. Commands: help [...] @@ -55,16 +58,15 @@ Commands: ```zsh % ./bin/antibody -v -antibody version 1.9.2 +antibody version dev % ./bin/antibody --version -antibody version 1.9.2 +antibody version dev % ``` ## Home ```zsh -% [[ $OSTYPE == darwin* ]] && CACHEDIR=$HOME/Library/Caches || CACHEDIR=$HOME/.cache % ./bin/antibody home | subenv CACHEDIR $CACHEDIR/antibody % @@ -79,6 +81,59 @@ fpath+=( $CACHEDIR/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users % ``` +```zsh +% bundles=('zsh-users/zsh-completions kind:fpath' 'zsh-users/zsh-history-substring-search kind:clone') +% print -rl -- $bundles | ./bin/antibody bundle | subenv CACHEDIR +fpath+=( $CACHEDIR/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-completions ) + +% +``` + +```zsh +% zsh_plugins=$PWD/tests/testdata/antibody/bundles.txt +% ./bin/antibody bundle <$zsh_plugins | subenv CACHEDIR +TODO +% +``` + +## List + +```zsh +% ./bin/antibody list | cut -c 66- | subenv CACHEDIR +$CACHEDIR/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-dracula-SLASH-zsh +$CACHEDIR/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-mattmc3-SLASH-antidote +$CACHEDIR/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-mattmc3-SLASH-zman +$CACHEDIR/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-ohmyzsh-SLASH-ohmyzsh +$CACHEDIR/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-peterhurford-SLASH-up.zsh +$CACHEDIR/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-romkatv-SLASH-zsh-bench +$CACHEDIR/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-rummik-SLASH-zsh-tailf +$CACHEDIR/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-rupa-SLASH-z +$CACHEDIR/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-sindresorhus-SLASH-pure +$CACHEDIR/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-zdharma-continuum-SLASH-fast-syntax-highlighting +$CACHEDIR/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-antigen +$CACHEDIR/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-autosuggestions +$CACHEDIR/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-completions +$CACHEDIR/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-history-substring-search +$CACHEDIR/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-syntax-highlighting +% ./bin/antibody list | cut -c -65 | tr -d ' ' +https://github.com/dracula/zsh +https://github.com/mattmc3/antidote +https://github.com/mattmc3/zman +https://github.com/ohmyzsh/ohmyzsh +https://github.com/peterhurford/up.zsh +https://github.com/romkatv/zsh-bench +https://github.com/rummik/zsh-tailf +https://github.com/rupa/z +https://github.com/sindresorhus/pure +https://github.com/zdharma-continuum/fast-syntax-highlighting +https://github.com/zsh-users/antigen +https://github.com/zsh-users/zsh-autosuggestions +https://github.com/zsh-users/zsh-completions +https://github.com/zsh-users/zsh-history-substring-search +https://github.com/zsh-users/zsh-syntax-highlighting +% +``` + ## Path ```zsh @@ -90,7 +145,7 @@ $CACHEDIR/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zs ## Init ```zsh -% ./bin/antibody init | subenv PWD +% ./bin/antibody init | subenv PWD | sed -e 's|\t| |g' #!/usr/bin/env zsh antibody() { case "$1" in @@ -114,5 +169,6 @@ compctl -K _antibody antibody ```zsh % unfunction subenv +% zstyle -d ':antibody:tests' set-warn-options % ``` diff --git a/tests/testdata/antibody/all_bundles.txt b/tests/testdata/antibody/all_bundles.txt new file mode 100644 index 0000000..1e346ed --- /dev/null +++ b/tests/testdata/antibody/all_bundles.txt @@ -0,0 +1,119 @@ +dalefukami/accurev-zsh +djui/alias-tips +stanislas/allergen +Valiev/almostontop +fcambus/ansiweather +# smallhadroncollider/antigen-git-rebase +# smallhadroncollider/antigen-git-store +mollifier/anyframe +hchbaw/auto-fu.zsh +horosgrisa/autoenv +unixorn/autoupdate-antigen.zshplugin +StackExchange/blackbox +adolfoabegg/browse-commit +arzzen/calc.plugin.zsh +walesmd/caniuse.plugin.zsh +mollifier/cd-gitroot +MikeDacre/cdbk +willghatch/zsh-cdr +rutchkiwi/copyzshell +Stibbons/crayon-syntax-zsh +jsks/czhttpd +Vifon/deer +jgrowl/depot_tools +gusaiani/elixir-oh-my-zsh +b4b4r07/enhancd +junegunn/fzf +voronkovich/get-jquery.plugin.zsh +fontno/ghost_zeus +peterhurford/git-aliases.zsh +unixorn/git-extra-commands +peterhurford/git-it-on.zsh +tevren/gitfast-zsh-plugin +voronkovich/gitignore.plugin.zsh +bbenne10/goenv +or17191/going_places +joepvd/grep2awk +robertzk/hipchat.zsh +willghatch/zsh-hooks +mgryszko/jvm +supercrabtree/k +d12frosted/kitsunebook.plugin.zsh +lesaint/lesaint-mvn +Temikus/mac-packaging +hlohm/mfunc +horosgrisa/mysql-colorize +voronkovich/mysql.plugin.zsh +bric3/nice-exit-code +srijanshetty/node.plugin.zsh +keithhamilton/oh-my-dogesh +gepoch/oh-my-zsh-dirstack +sandstorm/oh-my-zsh-flow3-plugin +gerges/oh-my-zsh-jira-plus +AlexisBRENON/oh-my-zsh-reminder +tonyseek/oh-my-zsh-virtualenv-prompt +hchbaw/opp.zsh +marshallmick007/osx-dev-zsh-plugin +deyvisonrocha/pantheon-terminal-notify-zsh-plugin +benclark/parallels-zsh-plugin +sharat87/pip-app +sindresorhus/pretty-time-zsh +shengyou/robo-zsh-plugin +johnhamelink/rvm-zsh +oz/safe-paste +willghatch/zsh-saneopt +robertzk/send.zsh +voronkovich/sf2.plugin.zsh +secrettriangle/smart-cd +willghatch/zsh-snippets +skx/sysadmin-util +yonchu/vimman +wbinglee/zsh-wakatime +mfaerevaag/wd +edouard-lopez/yeoman-zsh-plugin +zsh-users/zaw +hchbaw/zce.zsh +arlimus/zero.zsh +kmhjs/zinfo_line +chrissicool/zsh-256color +caarlos0/zsh-add-upstream +mafredri/zsh-async +Tarrasch/zsh-autoenv +tarruda/zsh-autosuggestions +# dirkk/zsh-basex +chrissicool/zsh-bash +Tarrasch/zsh-bd +Tarrasch/zsh-colors +joel-porquet/zsh-dircolors-solarized +tymm/zsh-directory-history +oknowton/zsh-dwim +Tarrasch/zsh-functional +s7anley/zsh-geeknote +caarlos0/jvm kind:path +caarlos0/zsh-git-sync +clauswitt/zsh-grunt-plugin +yerinle/zsh-gvm +joepvd/zsh-hints +# empty line: + +zsh-users/zsh-history-substring-search +knu/zsh-manydots-magic +psprint/zsh-navigation-tools +marzocchi/zsh-notify +mkwmms/zsh-osx +caarlos0/zsh-pg +RudthMael/zsh-plugin-ibtool +paraqles/zsh-plugin-rails +RobSis/zsh-reentry-hook +srijanshetty/zsh-suffix-alias +zsh-users/zsh-syntax-highlighting +chrissicool/zsh-t32 +TBSliver/zsh-plugin-tmux-simple +ascii-soup/zsh-url-highlighter +sharat87/zsh-vim-mode +jocelynmallon/zshmarks +# comments should be ignored +# URLs: +git@github.com:caarlos0/jvm.git branch:gh-pages +https://github.com/caarlos0/zsh-open-pr +caarlos0/zsh-git-fetch-merge diff --git a/tests/testdata/antibody/bundles.txt b/tests/testdata/antibody/bundles.txt new file mode 100644 index 0000000..111fbae --- /dev/null +++ b/tests/testdata/antibody/bundles.txt @@ -0,0 +1,45 @@ +# plugins +zsh-users/zsh-history-substring-search +https://github.com/zsh-users/zsh-completions + +# git@ repo URLs aren't good for CI... revisit +# git@github.com:zsh-users/zsh-completions.git + +# kind:zsh +zsh-users/zsh-syntax-highlighting kind:zsh + +# kind:clone +zsh-users/antigen kind:clone + +# kind:fpath +sindresorhus/pure kind:fpath + +# kind:path +romkatv/zsh-bench kind:path + +# kind:autoload +mattmc3/zman path:functions kind:autoload + +# conditional +ohmyzsh/ohmyzsh path:plugins/macos conditional:is-macos + +# branches +mattmc3/antidote branch:pz + +# subpath plugins +ohmyzsh/ohmyzsh path:lib/clipboard.zsh +ohmyzsh/ohmyzsh path:plugins/extract +ohmyzsh/ohmyzsh path:plugins/magic-enter +ohmyzsh/ohmyzsh path:plugins/fancy-ctrl-z + +# deferred +zsh-users/zsh-autosuggestions kind:defer +zdharma-continuum/fast-syntax-highlighting kind:defer + +# theme +dracula/zsh + +# non-conforming plugins +peterhurford/up.zsh +rummik/zsh-tailf +rupa/z