Skip to content

Commit

Permalink
cli: add update command (ohmyzsh#9094)
Browse files Browse the repository at this point in the history
Co-authored-by: Marc Cornellà <marc.cornella@live.com>
  • Loading branch information
vladimyr and mcornella authored Aug 4, 2020
1 parent cf347ef commit 3935ccc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
11 changes: 11 additions & 0 deletions lib/cli.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ function _omz {
local -a cmds subcmds
cmds=(
'help:Usage information'
'update:Update Oh My Zsh'
'pr:Commands for Oh My Zsh Pull Requests'
)

Expand All @@ -48,6 +49,7 @@ Usage: omz <command> [options]
Available commands:
help Print this help message
update Update Oh My Zsh
pr <command> Commands for Oh My Zsh Pull Requests
EOF
Expand Down Expand Up @@ -197,3 +199,12 @@ function _omz::pr::test {
}
)
}

function _omz::update {
env ZSH="$ZSH" sh "$ZSH/tools/upgrade.sh"
# Update last updated file
zmodload zsh/datetime
echo "LAST_EPOCH=$(( EPOCHSECONDS / 60 / 60 / 24 ))" >! "${ZSH_CACHE_DIR}/.zsh-update"
# Remove update lock if it exists
command rm -rf "$ZSH/log/update.lock"
}
4 changes: 2 additions & 2 deletions lib/functions.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ function uninstall_oh_my_zsh() {
}

function upgrade_oh_my_zsh() {
env ZSH="$ZSH" sh "$ZSH/tools/upgrade.sh"
command rm -rf "$ZSH/log/update.lock"
echo >&2 "${fg[yellow]}Note: \`$0\` is deprecated. Use \`omz update\` instead.$reset_color"
omz update
}

function take() {
Expand Down

0 comments on commit 3935ccc

Please sign in to comment.