antigen
antigen copied to clipboard
`antigen update` not working inside script
Description
TL;DR, unixorn/autoupdate-antigen.zshplugin does not seem to be working.
Steps to reproduce
Minimal steps to reproduce this behavior:
1 - `antigen bundle unixorn/autoupdate-antigen.zshplugin`
Expected behavior:
Should auto update once a week and produce some output like this:
Updating mafredri/zsh-async@master... Done. Took 0s.
Updating robbyrussell/oh-my-zsh@master... Done. Took 1s.
Updating sindresorhus/pure@master... Done. Took 0s.
Updating zsh-users/zsh-autosuggestions@master... Done. Took 1s.
Updating zsh-users/zsh-syntax-highlighting@master... Done. Took 1s.
Current behavior:
Never outputs anything.
Software version
antigen versionAntigen develop (d1dd78b) Revision date: 2018-01-15 14:37:21 -0300zsh --versionzsh 5.5.1 (x86_64-debian-linux-gnu)uname -aLinux (can't disclose)
Configuration
- gist of
.zshrc
source ~/.antigen/antigen.zsh
antigen use oh-my-zsh
# Plugins
antigen bundle git
antigen bundle sudo
antigen bundle history
antigen bundle extract
antigen bundle debian
antigen bundle zsh-users/zsh-syntax-highlighting
antigen bundle zsh-users/zsh-autosuggestions
antigen bundle unixorn/autoupdate-antigen.zshplugin # Auto updates for antigen
# Theme
antigen bundle mafredri/zsh-async
antigen bundle sindresorhus/pure
antigen apply
More information
I went through the hassle of forking and rewriting the auto update plugin here.
After some debugging, it seems that everything in the plugin should work, except running antigen update or antigen selfupdate finishes instantly with no output.
I ran which antigen inside the script and it produced this output:
antigen () {
local MATCH MBEGIN MEND
[[ "$ZSH_EVAL_CONTEXT" =~ "toplevel:*" || "$ZSH_EVAL_CONTEXT" =~ "cmdarg:*" ]] && source "/my/usr/path/.antigen/antigen.zsh" && eval antigen $@
return 0
}
It appears that [[ "$ZSH_EVAL_CONTEXT" =~ "toplevel:*" || "$ZSH_EVAL_CONTEXT" =~ "cmdarg:*" ]] evaluates to false. My question is, is this intended behavior for scripts? Why can we not use antigen update inside of a plugin?
Hi @jackcogdill,
have you found a solution to this problem? I would also like to call antigen update from a script of mine which executes update functions of several applications like Homebrew, SDKMAN, etc.
The following snippet inside a ZSH shell script doesn't do anything...
source /usr/local/share/antigen/antigen.zsh
antigen update
@svenjacobs I switched to using zplug since it seemed all around better.