This commit is contained in:
abc 2023-07-12 10:00:24 +08:00
commit 7f72c40480
7 changed files with 3149 additions and 7 deletions

File diff suppressed because it is too large Load diff

View file

@ -36,9 +36,16 @@ if (( ! $+commands[docker] )); then
return
fi
# Standarized $0 handling
# https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html
0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
0="${${(M)0:#/*}:-$PWD/$0}"
{
# docker version returns `Docker version 24.0.2, build cb74dfcd85`
# with `s:,:` remove the comma after the version, and select third word of it
local _docker_version=${${(s:,:z)"$(command docker --version)"}[3]}
# `docker completion` is only available from 23.0.0 on
local _docker_version=$(command docker version --format '{{.Client.Version}}' 2>/dev/null)
if is-at-least 23.0.0 $_docker_version; then
# If the completion file doesn't exist yet, we need to autoload it and
# bind it to `docker`. Otherwise, compinit will have already done that.
@ -48,5 +55,7 @@ fi
_comps[docker]=_docker
fi
command docker completion zsh >| "$ZSH_CACHE_DIR/completions/_docker"
else
command cp "${0:h}/completions/_docker" "$ZSH_CACHE_DIR/completions/_docker"
fi
} &|

View file

@ -6,6 +6,7 @@
if [[ -z "${CLOUDSDK_HOME}" ]]; then
search_locations=(
"$HOME/google-cloud-sdk"
"/usr/local/share/google-cloud-sdk"
"/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk"
"/opt/homebrew/Caskroom/google-cloud-sdk/latest/google-cloud-sdk"
"/usr/share/google-cloud-sdk"

View file

@ -1,6 +1,6 @@
# git-extras
This plugin provides completion definitions for some of the commands defined by [git-extras](https://github.com/tj/git-extras).
This plugin provides completion definitions for some of the commands defined by [git-extras](https://github.com/tj/git-extras), which must already be installed.
To use it, add `git-extras` to the plugins array in your zshrc file:

View file

@ -26,8 +26,8 @@ plugins=(... git)
| gbda | git branch --no-color --merged \| grep -vE "^([+*]\|\s*(<span>$</span>(git_main_branch)\|<span>$</span>(git_develop_branch))\s*<span>$</span>)" \| xargs git branch --delete 2>/dev/null |
| gbD | git branch --delete --force |
| gbg | git branch -vv | grep ": gone\]" |
| gbgd | local res=$(git branch -vv | grep ": gone\]" | awk '{print $1}') && [[ $res ]] && echo $res | xargs git branch -d |
| gbgD | local res=$(git branch -vv | grep ": gone\]" | awk '{print $1}') && [[ $res ]] && echo $res | xargs git branch -D |
| gbgd | git branch --no-color -vv | grep ": gone\]" | awk '"'"'{print $1}'"'"' | xargs git branch -d |
| gbgD | git branch --no-color -vv | grep ": gone\]" | awk '"'"'{print $1}'"'"' | xargs git branch -D |
| gbl | git blame -b -w |
| gbnm | git branch --no-merged |
| gbr | git branch --remote |

View file

@ -84,8 +84,8 @@ alias gbd='git branch --delete'
alias gbda='git branch --no-color --merged | command grep -vE "^([+*]|\s*($(git_main_branch)|$(git_develop_branch))\s*$)" | command xargs git branch --delete 2>/dev/null'
alias gbD='git branch --delete --force'
alias gbg='git branch -vv | grep ": gone\]"'
alias gbgd='local res=$(gbg | awk '"'"'{print $1}'"'"') && [[ $res ]] && echo $res | xargs git branch -d'
alias gbgD='local res=$(gbg | awk '"'"'{print $1}'"'"') && [[ $res ]] && echo $res | xargs git branch -D'
alias gbgd='git branch --no-color -vv | grep ": gone\]" | awk '"'"'{print $1}'"'"' | xargs git branch -d'
alias gbgD='git branch --no-color -vv | grep ": gone\]" | awk '"'"'{print $1}'"'"' | xargs git branch -D'
alias gbl='git blame -b -w'
alias gbnm='git branch --no-merged'
alias gbr='git branch --remote'

View file

@ -80,7 +80,13 @@ function jira() {
issue_arg=${issue_arg##*/}
# Strip suffixes starting with _
issue_arg=(${(s:_:)issue_arg})
issue_arg=${issue_arg[1]}
# If there is only one part, it means that there is a different delimiter. Try with -
if [[ ${#issue_arg[@]} = 1 && ${issue_arg} == *-* ]]; then
issue_arg=(${(s:-:)issue_arg})
issue_arg="${issue_arg[1]}-${issue_arg[2]}"
else
issue_arg=${issue_arg[1]}
fi
if [[ "${issue_arg:l}" = ${jira_prefix:l}* ]]; then
issue="${issue_arg}"
else