1
0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2026-01-09 21:38:32 +08:00

Compare commits

...

4 Commits

Author SHA1 Message Date
Veesar
e48be7dfc8
feat(wp-cli): add aliases for DB management (#9469) 2020-12-07 21:23:55 +01:00
Marc Cornellà
4b7dba5b75 feat(lib)!: soft-deprecate upgrade_oh_my_zsh function for everybody
BREAKING CHANGE: the `upgrade_oh_my_zsh` function now calls `omz update` directly.
2020-12-07 20:58:12 +01:00
Marc Cornellà
92fa8153d5 fix(changelog): fix assoc array syntax for zsh 5.4.2 and older (#9495)
Also fixed a call to a defunct display:type-header function in displaying
breaking changes.
2020-12-07 20:58:12 +01:00
Marc Cornellà
5a888ff4ac fix(updater): don't show changelog when running unattended update (#9495)
Fixes #9495
2020-12-07 20:58:12 +01:00
7 changed files with 138 additions and 180 deletions

View File

@ -376,13 +376,19 @@ function _omz::theme::use {
function _omz::update {
# Run update script
env ZSH="$ZSH" zsh -f "$ZSH/tools/upgrade.sh"
if [[ "$1" != --unattended ]]; then
ZSH="$ZSH" zsh -f "$ZSH/tools/upgrade.sh" --interactive
else
ZSH="$ZSH" zsh -f "$ZSH/tools/upgrade.sh"
fi
local ret=$?
# 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"
# Restart the zsh session
if [[ $ret -eq 0 && "$1" != --unattended ]]; then
# Check whether to run a login shell

View File

@ -9,23 +9,8 @@ function uninstall_oh_my_zsh() {
}
function upgrade_oh_my_zsh() {
if (( $+functions[_omz::update] )); then
echo >&2 "${fg[yellow]}Note: \`$0\` is deprecated. Use \`omz update\` instead.$reset_color"
fi
# Run update script
env ZSH="$ZSH" zsh -f "$ZSH/tools/upgrade.sh"
local ret=$?
# 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"
# Restart the zsh session
if [[ $ret -eq 0 ]]; then
# Check whether to run a login shell
[[ "$ZSH_ARGZERO" = -* ]] && exec -l "${ZSH_ARGZERO#-}" || exec "$ZSH_ARGZERO"
fi
echo >&2 "${fg[yellow]}Note: \`$0\` is deprecated. Use \`omz update\` instead.$reset_color"
omz update
}
function take() {

View File

@ -1,107 +1,109 @@
# WP-CLI
The [WordPress CLI](https://wp-cli.org/) is a command-line tool for managing WordPress installations. You can update plugins, set up multisite installs and much more, without using a web browser.
This plugin adds [tab completion](https://wp-cli.org/#tab-completions) for `wp-cli` as well as several aliases for commonly used commands.
To use it, add `wp-cli` to the plugins array in your zshrc file:
```zsh
plugins=(... wp-cli)
```
**Maintainer:** [joshmedeski](https://github.com/joshmedeski)
WordPress Command Line Interface (https://wp-cli.org/)
## Aliases
WP-CLI is a set of command-line tools for managing WordPress installations. You can update plugins, set up multisite installs and much more, without using a web browser.
This plugin adds [tab completion](https://wp-cli.org/#tab-completions) for `wp-cli` as well as several aliases.
## List of Aliases
### Core
- wpcc='wp core config'
- wpcd='wp core download'
- wpci='wp core install'
- wpcii='wp core is-installed'
- wpcmc='wp core multisite-convert'
- wpcmi='wp core multisite-install'
- wpcu='wp core update'
- wpcudb='wp core update-db'
- wpcvc='wp core verify-checksums'
### Cron
- wpcre='wp cron event'
- wpcrs='wp cron schedule'
- wpcrt='wp cron test'
### Menu
- wpmc='wp menu create'
- wpmd='wp menu delete'
- wpmi='wp menu item'
- wpml='wp menu list'
- wpmlo='wp menu location'
### Plugin
- wppa='activate'
- wppda='deactivate'
- wppd='delete'
- wppg='get'
- wppi='install'
- wppis='is-installed'
- wppl='list'
- wppp='path'
- wpps='search'
- wppst='status'
- wppt='toggle'
- wppun='uninstall'
- wppu='update'
### Post
- wppoc='wp post create'
- wppod='wp post delete'
- wppoe='wp post edit'
- wppogen='wp post generate'
- wppog='wp post get'
- wppol='wp post list'
- wppom='wp post meta'
- wppou='wp post update'
- wppourl='wp post url'
### Sidebar
- wpsbl='wp sidebar list'
### Theme
- wpta='wp theme activate'
- wptd='wp theme delete'
- wptdis='wp theme disable'
- wpte='wp theme enable'
- wptg='wp theme get'
- wpti='wp theme install'
- wptis='wp theme is-installed'
- wptl='wp theme list'
- wptm='wp theme mod'
- wptp='wp theme path'
- wpts='wp theme search'
- wptst='wp theme status'
- wptu='wp theme update'
### User
- wpuac='wp user add-cap'
- wpuar='wp user add-role'
- wpuc='wp user create'
- wpud='wp user delete'
- wpugen='wp user generate'
- wpug='wp user get'
- wpui='wp user import-csv'
- wpul='wp user list'
- wpulc='wp user list-caps'
- wpum='wp user meta'
- wpurc='wp user remove-cap'
- wpurr='wp user remove-role'
- wpusr='wp user set-role'
- wpuu='wp user update'
### Widget
- wpwa='wp widget add'
- wpwda='wp widget deactivate'
- wpwd='wp widget delete'
- wpwl='wp widget list'
- wpwm='wp widget move'
- wpwu='wp widget update'
The entire list of wp-cli commands can be found here: https://wp-cli.org/commands/
I only included the commands that are most used. Please feel free to contribute to this project if you want more commands.
The entire list of `wp-cli` commands can be found here: https://developer.wordpress.org/cli/commands/
| Alias | Command |
|-----------|-----------------------------|
| **Core** |
| `wpcc` | `wp core config` |
| `wpcd` | `wp core download` |
| `wpci` | `wp core install` |
| `wpcii` | `wp core is-installed` |
| `wpcmc` | `wp core multisite-convert` |
| `wpcmi` | `wp core multisite-install` |
| `wpcu` | `wp core update` |
| `wpcudb` | `wp core update-db` |
| `wpcvc` | `wp core verify-checksums` |
| **Cron** |
| `wpcre` | `wp cron event` |
| `wpcrs` | `wp cron schedule` |
| `wpcrt` | `wp cron test` |
| **Database** |
| `wpdbe` | `wp db export` |
| `wpdbi` | `wp db import` |
| `wpdbcr` | `wp db create` |
| `wpdbs` | `wp db search` |
| `wpdbch` | `wp db check` |
| `wpdbr` | `wp db repair` |
| **Menu** |
| `wpmc` | `wp menu create` |
| `wpmd` | `wp menu delete` |
| `wpmi` | `wp menu item` |
| `wpml` | `wp menu list` |
| `wpmlo` | `wp menu location` |
| **Plugin** |
| `wppa` | `wp plugin activate` |
| `wppda` | `wp plugin deactivate` |
| `wppd` | `wp plugin delete` |
| `wppg` | `wp plugin get` |
| `wppi` | `wp plugin install` |
| `wppis` | `wp plugin is-installed` |
| `wppl` | `wp plugin list` |
| `wppp` | `wp plugin path` |
| `wpps` | `wp plugin search` |
| `wppst` | `wp plugin status` |
| `wppt` | `wp plugin toggle` |
| `wppun` | `wp plugin uninstall` |
| `wppu` | `wp plugin update` |
| **Post** |
| `wppoc` | `wp post create` |
| `wppod` | `wp post delete` |
| `wppoe` | `wp post edit` |
| `wppogen` | `wp post generate` |
| `wppog` | `wp post get` |
| `wppol` | `wp post list` |
| `wppom` | `wp post meta` |
| `wppou` | `wp post update` |
| `wppourl` | `wp post url` |
| **Sidebar** |
| `wpsbl` | `wp sidebar list` |
| **Theme** |
| `wpta` | `wp theme activate` |
| `wptd` | `wp theme delete` |
| `wptdis` | `wp theme disable` |
| `wpte` | `wp theme enable` |
| `wptg` | `wp theme get` |
| `wpti` | `wp theme install` |
| `wptis` | `wp theme is-installed` |
| `wptl` | `wp theme list` |
| `wptm` | `wp theme mod` |
| `wptp` | `wp theme path` |
| `wpts` | `wp theme search` |
| `wptst` | `wp theme status` |
| `wptu` | `wp theme update` |
| **User** |
| `wpuac` | `wp user add-cap` |
| `wpuar` | `wp user add-role` |
| `wpuc` | `wp user create` |
| `wpud` | `wp user delete` |
| `wpugen` | `wp user generate` |
| `wpug` | `wp user get` |
| `wpui` | `wp user import-csv` |
| `wpul` | `wp user list` |
| `wpulc` | `wp user list-caps` |
| `wpum` | `wp user meta` |
| `wpurc` | `wp user remove-cap` |
| `wpurr` | `wp user remove-role` |
| `wpusr` | `wp user set-role` |
| `wpuu` | `wp user update` |
| **Widget** |
| `wpwa` | `wp widget add` |
| `wpwda` | `wp widget deactivate` |
| `wpwd` | `wp widget delete` |
| `wpwl` | `wp widget list` |
| `wpwm` | `wp widget move` |
| `wpwu` | `wp widget update` |

View File

@ -2,14 +2,6 @@
# A command line interface for WordPress
# https://wp-cli.org/
# Cache
# Cap
# CLI
# Comment
# Core
alias wpcc='wp core config'
alias wpcd='wp core download'
@ -27,18 +19,12 @@ alias wpcrs='wp cron schedule'
alias wpcrt='wp cron test'
# Db
# Eval
# Eval-File
# Export
# Help
# Import
# Media
alias wpdbe='wp db export'
alias wpdbi='wp db import'
alias wpdbcr='wp db create'
alias wpdbs='wp db search'
alias wpdbch='wp db check'
alias wpdbr='wp db repair'
# Menu
alias wpmc='wp menu create'
@ -47,10 +33,6 @@ alias wpmi='wp menu item'
alias wpml='wp menu list'
alias wpmlo='wp menu location'
# Network
# Option
# Plugin
alias wppa='wp plugin activate'
alias wppda='wp plugin deactivate'
@ -77,25 +59,9 @@ alias wppom='wp post meta'
alias wppou='wp post update'
alias wppourl='wp post url'
# Rewrite
# Role
# Scaffold
# Search-Replace
# Shell
# Sidebar
alias wpsbl='wp sidebar list'
# Site
# Super-Admin
# Term
# Theme
alias wpta='wp theme activate'
alias wptd='wp theme delete'
@ -111,8 +77,6 @@ alias wpts='wp theme search'
alias wptst='wp theme status'
alias wptu='wp theme update'
# Transient
# User
alias wpuac='wp user add-cap'
alias wpuar='wp user add-role'
@ -138,9 +102,8 @@ alias wpwm='wp widget move'
alias wpwu='wp widget update'
# Completion for wp
autoload -U +X bashcompinit && bashcompinit
# bash completion for the `wp` command
_wp_complete() {
local cur=${COMP_WORDS[COMP_CWORD]}

View File

@ -8,16 +8,16 @@
#* and the display string of such type
local -A TYPES
TYPES=(
[build]="Build system"
[chore]="Chore"
[ci]="CI"
[docs]="Documentation"
[feat]="Features"
[fix]="Bug fixes"
[perf]="Performance"
[refactor]="Refactor"
[style]="Style"
[test]="Testing"
build "Build system"
chore "Chore"
ci "CI"
docs "Documentation"
feat "Features"
fix "Bug fixes"
perf "Performance"
refactor "Refactor"
style "Style"
test "Testing"
)
#* Types that will be displayed in their own section,
@ -274,8 +274,8 @@ function display-release {
(( $#breaking != 0 )) || return 0
case "$output" in
raw) display:type-header "BREAKING CHANGES" ;;
text|md) display:type-header "⚠ BREAKING CHANGES" ;;
raw) fmt:header "BREAKING CHANGES" 3 ;;
text|md) fmt:header "⚠ BREAKING CHANGES" 3 ;;
esac
local hash subject

View File

@ -24,7 +24,7 @@ function update_last_updated_file() {
}
function update_ohmyzsh() {
ZSH="$ZSH" zsh -f "$ZSH/tools/upgrade.sh"
ZSH="$ZSH" zsh -f "$ZSH/tools/upgrade.sh" --interactive
update_last_updated_file
}

View File

@ -70,10 +70,12 @@ if git pull --rebase --stat origin master; then
message="Hooray! Oh My Zsh has been updated!"
# Display changelog with less if available, otherwise just print it to the terminal
if (( $+commands[less] )); then
"$ZSH/tools/changelog.sh" HEAD "$last_commit" --text | command less -R
else
"$ZSH/tools/changelog.sh" HEAD "$last_commit"
if [[ "$1" = --interactive ]]; then
if (( $+commands[less] )); then
"$ZSH/tools/changelog.sh" HEAD "$last_commit" --text | LESS= command less -R
else
"$ZSH/tools/changelog.sh" HEAD "$last_commit"
fi
fi
fi