diff options
-rw-r--r-- | LICENSE.txt | 2 | ||||
-rw-r--r-- | lib/cli.zsh | 7 | ||||
-rw-r--r-- | plugins/docker-compose/README.md | 37 | ||||
-rw-r--r-- | plugins/docker-compose/docker-compose.plugin.zsh | 1 | ||||
-rw-r--r-- | plugins/git-flow/git-flow.plugin.zsh | 1 | ||||
-rw-r--r-- | plugins/git-prompt/README.md | 2 | ||||
-rw-r--r-- | plugins/mongocli/README.md | 19 | ||||
-rw-r--r-- | plugins/mongocli/mongocli.plugin.zsh | 4 | ||||
-rw-r--r-- | plugins/rails/rails.plugin.zsh | 4 | ||||
-rw-r--r-- | themes/gallois.zsh-theme | 15 | ||||
-rw-r--r-- | tools/check_for_upgrade.sh | 5 | ||||
-rwxr-xr-x | tools/upgrade.sh | 3 |
12 files changed, 64 insertions, 36 deletions
diff --git a/LICENSE.txt b/LICENSE.txt index 45ba85a37..becd6a7bd 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2009-2020 Robby Russell and contributors (https://github.com/ohmyzsh/ohmyzsh/contributors) +Copyright (c) 2009-2021 Robby Russell and contributors (https://github.com/ohmyzsh/ohmyzsh/contributors) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/lib/cli.zsh b/lib/cli.zsh index 3346d3973..38e2f72f8 100644 --- a/lib/cli.zsh +++ b/lib/cli.zsh @@ -401,13 +401,14 @@ function _omz::theme::use { } function _omz::update { + local last_commit=$(cd "$ZSH"; git rev-parse HEAD) + # Run update script 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 @@ -415,8 +416,8 @@ function _omz::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 + # Restart the zsh session if there were changes + if [[ "$1" != --unattended && "$(cd "$ZSH"; git rev-parse HEAD)" != "$last_commit" ]]; then # Old zsh versions don't have ZSH_ARGZERO local zsh="${ZSH_ARGZERO:-${functrace[-1]%:*}}" # Check whether to run a login shell diff --git a/plugins/docker-compose/README.md b/plugins/docker-compose/README.md index a81c2c78e..13f3c2cea 100644 --- a/plugins/docker-compose/README.md +++ b/plugins/docker-compose/README.md @@ -11,21 +11,22 @@ plugins=(... docker-compose) ## Aliases -| Alias | Command | Description | -|-----------|--------------------------|------------------------------------------------------------------| -| dco | `docker-compose` | Docker-compose main command | -| dcb | `docker-compose build` | Build containers | -| dce | `docker-compose exec` | Execute command inside a container | -| dcps | `docker-compose ps` | List containers | -| dcrestart | `docker-compose restart` | Restart container | -| dcrm | `docker-compose rm` | Remove container | -| dcr | `docker-compose run` | Run a command in container | -| dcstop | `docker-compose stop` | Stop a container | -| dcup | `docker-compose up` | Build, (re)create, start, and attach to containers for a service | -| dcupd | `docker-compose up -d` | Same as `dcup`, but starts as daemon | -| dcdn | `docker-compose down` | Stop and remove containers | -| dcl | `docker-compose logs` | Show logs of container | -| dclf | `docker-compose logs -f` | Show logs and follow output | -| dcpull | `docker-compose pull` | Pull image of a service | -| dcstart | `docker-compose start` | Start a container | -| dck | `docker-compose kill` | Kills containers | +| Alias | Command | Description | +|-----------|--------------------------------|------------------------------------------------------------------| +| dco | `docker-compose` | Docker-compose main command | +| dcb | `docker-compose build` | Build containers | +| dce | `docker-compose exec` | Execute command inside a container | +| dcps | `docker-compose ps` | List containers | +| dcrestart | `docker-compose restart` | Restart container | +| dcrm | `docker-compose rm` | Remove container | +| dcr | `docker-compose run` | Run a command in container | +| dcstop | `docker-compose stop` | Stop a container | +| dcup | `docker-compose up` | Build, (re)create, start, and attach to containers for a service | +| dcupb | `docker-compose up --build` | Same as `dcup`, but build images before starting containers | +| dcupd | `docker-compose up -d` | Same as `dcup`, but starts as daemon | +| dcdn | `docker-compose down` | Stop and remove containers | +| dcl | `docker-compose logs` | Show logs of container | +| dclf | `docker-compose logs -f` | Show logs and follow output | +| dcpull | `docker-compose pull` | Pull image of a service | +| dcstart | `docker-compose start` | Start a container | +| dck | `docker-compose kill` | Kills containers | diff --git a/plugins/docker-compose/docker-compose.plugin.zsh b/plugins/docker-compose/docker-compose.plugin.zsh index 5b25b63b9..85e03d343 100644 --- a/plugins/docker-compose/docker-compose.plugin.zsh +++ b/plugins/docker-compose/docker-compose.plugin.zsh @@ -18,6 +18,7 @@ alias dcrm='docker-compose rm' alias dcr='docker-compose run' alias dcstop='docker-compose stop' alias dcup='docker-compose up' +alias dcupb='docker-compose up --build' alias dcupd='docker-compose up -d' alias dcdn='docker-compose down' alias dcl='docker-compose logs' diff --git a/plugins/git-flow/git-flow.plugin.zsh b/plugins/git-flow/git-flow.plugin.zsh index eab969d8a..916cd5693 100644 --- a/plugins/git-flow/git-flow.plugin.zsh +++ b/plugins/git-flow/git-flow.plugin.zsh @@ -36,7 +36,6 @@ alias gflff='git flow feature finish' alias gflfp='git flow feature publish' alias gflhf='git flow hotfix finish' alias gflrf='git flow release finish' -alias gflfp='git flow feature publish' alias gflhp='git flow hotfix publish' alias gflrp='git flow release publish' alias gflfpll='git flow feature pull' diff --git a/plugins/git-prompt/README.md b/plugins/git-prompt/README.md index 83948f536..c6610fa94 100644 --- a/plugins/git-prompt/README.md +++ b/plugins/git-prompt/README.md @@ -24,6 +24,7 @@ The prompt may look like the following: - `(master|✖2✚3)`: on branch `master`, 2 conflicts, 3 files changed - `(experimental↓2↑3|✔)`: on branch `experimental`; your branch has diverged by 3 commits, remote by 2 commits; the repository is otherwise clean - `(:70c2952|✔)`: not on any branch; parent commit has hash `70c2952`; the repository is otherwise clean +- `(master|⚑2)`: on branch `master`, there are 2 stashed changes ## Prompt Structure @@ -43,6 +44,7 @@ The symbols are as follows: | ●n | there are `n` staged files | | ✖n | there are `n` unmerged files | | ✚n | there are `n` unstaged files | +| ⚑n | there are `n` stashed changes | | … | there are some untracked files | ### Branch Tracking Symbols diff --git a/plugins/mongocli/README.md b/plugins/mongocli/README.md new file mode 100644 index 000000000..e245f2a4a --- /dev/null +++ b/plugins/mongocli/README.md @@ -0,0 +1,19 @@ +# mongocli plugin + +The plugin adds several aliases for common [mongocli](https://docs.mongodb.com/mongocli/stable/) commands. + +To use it, add `mongocli` to the plugins array of your zshrc file: + +```zsh +plugins=(... mongocli) +``` + +## Aliases + +| Alias | Command | Description | +|----------|-------------------------------------------------------------|--------------------------------------------------------| +| `ma` | `mongocli atlas` | Shortcut for mongocli Atlas commands. | +| `mcm` | `mongocli cloud-manager` | Shortcut for mongocli Cloud Manager commands. | +| `mom` | `mongocli ops-manager` | Shortcut for mongocli Cloud Manager commands. | +| `miam` | `mongocli iam` | Shortcut for mongocli IAM commands. | + diff --git a/plugins/mongocli/mongocli.plugin.zsh b/plugins/mongocli/mongocli.plugin.zsh new file mode 100644 index 000000000..0ca877e61 --- /dev/null +++ b/plugins/mongocli/mongocli.plugin.zsh @@ -0,0 +1,4 @@ +alias ma='mongocli atlas' +alias mcm='mongocli cloud-manager' +alias mom='mongocli ops-manager' +alias miam='mongocli iam' diff --git a/plugins/rails/rails.plugin.zsh b/plugins/rails/rails.plugin.zsh index 1fd5f0f86..5b0be4f85 100644 --- a/plugins/rails/rails.plugin.zsh +++ b/plugins/rails/rails.plugin.zsh @@ -46,6 +46,8 @@ alias rdb='rails dbconsole' alias rgen='rails generate' alias rgm='rails generate migration' alias rp='rails plugin' +alias rr='rails routes' +alias rrg='rails routes | grep' alias ru='rails runner' alias rs='rails server' alias rsd='rails server --debugger' @@ -65,8 +67,6 @@ alias rdmtc='rake db:migrate db:test:clone' alias rdsl='rake db:schema:load' alias rlc='rake log:clear' alias rn='rake notes' -alias rr='rake routes' -alias rrg='rake routes | grep' alias rt='rake test' alias rmd='rake middleware' alias rsts='rake stats' diff --git a/themes/gallois.zsh-theme b/themes/gallois.zsh-theme index e6c2d8142..bb97bfb17 100644 --- a/themes/gallois.zsh-theme +++ b/themes/gallois.zsh-theme @@ -1,16 +1,18 @@ # Depends on the git plugin for work_in_progress() +(( $+functions[work_in_progress] )) || work_in_progress() {} ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}[" ZSH_THEME_GIT_PROMPT_SUFFIX="]%{$reset_color%}" ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}*%{$reset_color%}" ZSH_THEME_GIT_PROMPT_CLEAN="" -#Customized git status, oh-my-zsh currently does not allow render dirty status before branch +# Customized git status, oh-my-zsh currently does not allow render dirty status before branch git_custom_status() { - local cb=$(git_current_branch) - if [ -n "$cb" ]; then - echo "$(parse_git_dirty)%{$fg_bold[yellow]%}$(work_in_progress)%{$reset_color%}$ZSH_THEME_GIT_PROMPT_PREFIX$(git_current_branch)$ZSH_THEME_GIT_PROMPT_SUFFIX" - fi + local branch=$(git_current_branch) + [[ -n "$branch" ]] || return 0 + echo "$(parse_git_dirty)\ +%{${fg_bold[yellow]}%}$(work_in_progress)%{$reset_color%}\ +${ZSH_THEME_GIT_PROMPT_PREFIX}${branch}${ZSH_THEME_GIT_PROMPT_SUFFIX}" } # RVM component of prompt @@ -18,6 +20,5 @@ ZSH_THEME_RUBY_PROMPT_PREFIX="%{$fg[red]%}[" ZSH_THEME_RUBY_PROMPT_SUFFIX="]%{$reset_color%}" # Combine it all into a final right-side prompt -RPS1='$(git_custom_status)$(ruby_prompt_info) $EPS1' - +RPS1="\$(git_custom_status)\$(ruby_prompt_info)${RPS1:+ $RPS1}" PROMPT='%{$fg[cyan]%}[%~% ]%(?.%{$fg[green]%}.%{$fg[red]%})%B$%b ' diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh index d0ceba92d..29a48b880 100644 --- a/tools/check_for_upgrade.sh +++ b/tools/check_for_upgrade.sh @@ -24,8 +24,9 @@ function update_last_updated_file() { } function update_ohmyzsh() { - ZSH="$ZSH" zsh -f "$ZSH/tools/upgrade.sh" --interactive - update_last_updated_file + if ZSH="$ZSH" zsh -f "$ZSH/tools/upgrade.sh" --interactive; then + update_last_updated_file + fi } () { diff --git a/tools/upgrade.sh b/tools/upgrade.sh index 358242d0f..417e06fe8 100755 --- a/tools/upgrade.sh +++ b/tools/upgrade.sh @@ -1,7 +1,7 @@ #!/usr/bin/env zsh if [ -z "$ZSH_VERSION" ]; then - exec zsh "$0" + exec zsh "$0" "$@" fi cd "$ZSH" @@ -66,7 +66,6 @@ if git pull --rebase --stat origin master; then # Check if it was really updated or not if [[ "$(git rev-parse HEAD)" = "$last_commit" ]]; then message="Oh My Zsh is already at the latest version." - ret=80 # non-zero exit code to indicate no changes pulled else message="Hooray! Oh My Zsh has been updated!" |