fix(cli)!: remove harmful --unattended
flag for omz update
(#12935)
Co-authored-by: Carlo Sala <carlosalag@protonmail.com>
This commit is contained in:
parent
d2e79501b2
commit
85c4941492
2 changed files with 20 additions and 6 deletions
11
README.md
11
README.md
|
@ -487,6 +487,17 @@ wait a week?) you just need to run:
|
||||||
omz update
|
omz update
|
||||||
```
|
```
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> If you want to automate this process in a script, you should call directly the `upgrade` script, like this:
|
||||||
|
>
|
||||||
|
> ```sh
|
||||||
|
> $ZSH/tools/upgrade.sh
|
||||||
|
> ```
|
||||||
|
>
|
||||||
|
> See more options in the [FAQ: How do I update Oh My Zsh?](https://github.com/ohmyzsh/ohmyzsh/wiki/FAQ#how-do-i-update-oh-my-zsh).
|
||||||
|
>
|
||||||
|
> **USE OF `omz update --unattended` HAS BEEN REMOVED, AS IT HAS SIDE EFFECTS**.
|
||||||
|
|
||||||
Magic! 🎉
|
Magic! 🎉
|
||||||
|
|
||||||
## Uninstalling Oh My Zsh
|
## Uninstalling Oh My Zsh
|
||||||
|
|
13
lib/cli.zsh
13
lib/cli.zsh
|
@ -823,6 +823,13 @@ function _omz::update {
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Check if --unattended was passed
|
||||||
|
[[ "$1" != --unattended ]] || {
|
||||||
|
_omz::log error "the \`\e[2m--unattended\e[0m\` flag is no longer supported, use the \`\e[2mupgrade.sh\e[0m\` script instead."
|
||||||
|
_omz::log error "for more information see https://github.com/ohmyzsh/ohmyzsh/wiki/FAQ#how-do-i-update-oh-my-zsh"
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
local last_commit=$(builtin cd -q "$ZSH"; git rev-parse HEAD 2>/dev/null)
|
local last_commit=$(builtin cd -q "$ZSH"; git rev-parse HEAD 2>/dev/null)
|
||||||
[[ $? -eq 0 ]] || {
|
[[ $? -eq 0 ]] || {
|
||||||
_omz::log error "\`$ZSH\` is not a git directory. Aborting..."
|
_omz::log error "\`$ZSH\` is not a git directory. Aborting..."
|
||||||
|
@ -831,11 +838,7 @@ function _omz::update {
|
||||||
|
|
||||||
# Run update script
|
# Run update script
|
||||||
zstyle -s ':omz:update' verbose verbose_mode || verbose_mode=default
|
zstyle -s ':omz:update' verbose verbose_mode || verbose_mode=default
|
||||||
if [[ "$1" != --unattended ]]; then
|
|
||||||
ZSH="$ZSH" command zsh -f "$ZSH/tools/upgrade.sh" -i -v $verbose_mode || return $?
|
ZSH="$ZSH" command zsh -f "$ZSH/tools/upgrade.sh" -i -v $verbose_mode || return $?
|
||||||
else
|
|
||||||
ZSH="$ZSH" command zsh -f "$ZSH/tools/upgrade.sh" -v $verbose_mode || return $?
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Update last updated file
|
# Update last updated file
|
||||||
zmodload zsh/datetime
|
zmodload zsh/datetime
|
||||||
|
@ -844,7 +847,7 @@ function _omz::update {
|
||||||
command rm -rf "$ZSH/log/update.lock"
|
command rm -rf "$ZSH/log/update.lock"
|
||||||
|
|
||||||
# Restart the zsh session if there were changes
|
# Restart the zsh session if there were changes
|
||||||
if [[ "$1" != --unattended && "$(builtin cd -q "$ZSH"; git rev-parse HEAD)" != "$last_commit" ]]; then
|
if [[ "$(builtin cd -q "$ZSH"; git rev-parse HEAD)" != "$last_commit" ]]; then
|
||||||
# Old zsh versions don't have ZSH_ARGZERO
|
# Old zsh versions don't have ZSH_ARGZERO
|
||||||
local zsh="${ZSH_ARGZERO:-${functrace[-1]%:*}}"
|
local zsh="${ZSH_ARGZERO:-${functrace[-1]%:*}}"
|
||||||
# Check whether to run a login shell
|
# Check whether to run a login shell
|
||||||
|
|
Loading…
Reference in a new issue