summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CODE_OF_CONDUCT.md76
-rw-r--r--CONTRIBUTING.md4
-rw-r--r--LICENSE.txt2
-rw-r--r--README.md10
-rw-r--r--lib/compfix.zsh2
-rw-r--r--lib/functions.zsh6
-rw-r--r--lib/history.zsh4
-rw-r--r--lib/termsupport.zsh2
-rw-r--r--lib/theme-and-appearance.zsh3
-rw-r--r--oh-my-zsh.sh11
-rw-r--r--plugins/adb/_adb9
-rw-r--r--plugins/ansible/README.md3
-rw-r--r--plugins/ansible/ansible.plugin.zsh3
-rw-r--r--plugins/archlinux/README.md2
-rw-r--r--plugins/asdf/asdf.plugin.zsh8
-rw-r--r--plugins/aws/README.md28
-rw-r--r--plugins/aws/aws.plugin.zsh91
-rw-r--r--plugins/brew/README.md2
-rw-r--r--plugins/brew/brew.plugin.zsh2
-rw-r--r--plugins/cake/README.md15
-rw-r--r--plugins/cargo/README.md4
-rw-r--r--plugins/cargo/_cargo86
-rw-r--r--plugins/cloudapp/cloudapp.plugin.zsh8
-rw-r--r--plugins/command-not-found/README.md1
-rw-r--r--plugins/command-not-found/command-not-found.plugin.zsh7
-rw-r--r--plugins/docker-compose/_docker-compose168
-rw-r--r--plugins/drush/README.md83
-rw-r--r--plugins/drush/drush.complete.sh50
-rw-r--r--plugins/drush/drush.plugin.zsh104
-rw-r--r--plugins/fancy-ctrl-z/README.md6
-rw-r--r--plugins/fd/README.md13
-rw-r--r--plugins/fd/_fd83
-rw-r--r--plugins/git-prompt/gitstatus.py2
-rw-r--r--plugins/git/git.plugin.zsh12
-rw-r--r--plugins/gitfast/README.md129
-rw-r--r--plugins/gitfast/_git11
-rw-r--r--plugins/gitfast/git-completion.bash913
-rw-r--r--plugins/gitfast/git-prompt.sh9
-rw-r--r--plugins/gitfast/gitfast.plugin.zsh7
-rw-r--r--plugins/golang/golang.plugin.zsh79
-rw-r--r--plugins/gradle/gradle.plugin.zsh4
-rw-r--r--plugins/gulp/gulp.plugin.zsh4
-rw-r--r--plugins/httpie/README.md17
-rw-r--r--plugins/httpie/_httpie181
-rw-r--r--plugins/httpie/httpie.plugin.zsh33
-rw-r--r--plugins/iwhois/README.md24
-rw-r--r--plugins/iwhois/iwhois.plugin.zsh5
-rw-r--r--plugins/jenv/jenv.plugin.zsh2
-rw-r--r--plugins/kubectl/README.md3
-rw-r--r--plugins/kubectl/kubectl.plugin.zsh7
-rw-r--r--plugins/laravel/README.md45
-rw-r--r--plugins/laravel/laravel.plugin.zsh23
-rw-r--r--plugins/lighthouse/README.md26
-rw-r--r--plugins/lighthouse/lighthouse.plugin.zsh14
-rw-r--r--plugins/mvn/README.md54
-rw-r--r--plugins/mvn/mvn.plugin.zsh549
-rw-r--r--plugins/nvm/nvm.plugin.zsh7
-rw-r--r--plugins/osx/osx.plugin.zsh37
-rw-r--r--plugins/osx/spotify11
-rw-r--r--plugins/otp/otp.plugin.zsh54
-rw-r--r--plugins/per-directory-history/per-directory-history.zsh11
-rw-r--r--plugins/pip/pip.plugin.zsh4
-rw-r--r--plugins/pyenv/pyenv.plugin.zsh2
-rw-r--r--plugins/rake-fast/rake-fast.plugin.zsh2
-rw-r--r--plugins/react-native/README.md67
-rw-r--r--plugins/react-native/react-native.plugin.zsh17
-rw-r--r--plugins/ripgrep/README.md13
-rw-r--r--plugins/ripgrep/_ripgrep433
-rw-r--r--plugins/ros/README.mkd10
-rw-r--r--plugins/ros/_ros64
-rw-r--r--plugins/ssh-agent/ssh-agent.plugin.zsh22
-rw-r--r--plugins/suse/README.md40
-rw-r--r--plugins/suse/suse.plugin.zsh40
-rw-r--r--plugins/swiftpm/README.md2
-rw-r--r--plugins/swiftpm/_swift235
-rw-r--r--plugins/timer/README.md17
-rw-r--r--plugins/timer/timer.plugin.zsh29
-rw-r--r--plugins/tmuxinator/_tmuxinator6
-rw-r--r--plugins/transfer/transfer.plugin.zsh4
-rw-r--r--plugins/vault/README.md19
-rw-r--r--plugins/vi-mode/vi-mode.plugin.zsh3
-rw-r--r--plugins/web-search/README.md2
-rw-r--r--plugins/web-search/web-search.plugin.zsh4
-rw-r--r--plugins/wp-cli/wp-cli.plugin.zsh2
-rw-r--r--plugins/z/z.sh6
-rw-r--r--templates/zshrc.zsh-template3
-rw-r--r--themes/agnoster.zsh-theme14
-rw-r--r--themes/bira.zsh-theme5
-rw-r--r--themes/dst.zsh-theme2
-rw-r--r--themes/gallifrey.zsh-theme9
-rw-r--r--themes/gentoo.zsh-theme2
-rw-r--r--themes/pygmalion-virtualenv.zsh-theme50
-rw-r--r--themes/refined.zsh-theme1
-rw-r--r--themes/tjkirch.zsh-theme2
-rw-r--r--themes/tjkirch_mod.zsh-theme2
-rw-r--r--tools/check_for_upgrade.sh4
-rwxr-xr-xtools/install.sh2
-rw-r--r--tools/upgrade.sh2
98 files changed, 3224 insertions, 1086 deletions
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
new file mode 100644
index 000000000..20ad1ccee
--- /dev/null
+++ b/CODE_OF_CONDUCT.md
@@ -0,0 +1,76 @@
+# Contributor Covenant Code of Conduct
+
+## Our Pledge
+
+In the interest of fostering an open and welcoming environment, we as
+contributors and maintainers pledge to making participation in our project and
+our community a harassment-free experience for everyone, regardless of age, body
+size, disability, ethnicity, sex characteristics, gender identity and expression,
+level of experience, education, socio-economic status, nationality, personal
+appearance, race, religion, or sexual identity and orientation.
+
+## Our Standards
+
+Examples of behavior that contributes to creating a positive environment
+include:
+
+* Using welcoming and inclusive language
+* Being respectful of differing viewpoints and experiences
+* Gracefully accepting constructive criticism
+* Focusing on what is best for the community
+* Showing empathy towards other community members
+
+Examples of unacceptable behavior by participants include:
+
+* The use of sexualized language or imagery and unwelcome sexual attention or
+ advances
+* Trolling, insulting/derogatory comments, and personal or political attacks
+* Public or private harassment
+* Publishing others' private information, such as a physical or electronic
+ address, without explicit permission
+* Other conduct which could reasonably be considered inappropriate in a
+ professional setting
+
+## Our Responsibilities
+
+Project maintainers are responsible for clarifying the standards of acceptable
+behavior and are expected to take appropriate and fair corrective action in
+response to any instances of unacceptable behavior.
+
+Project maintainers have the right and responsibility to remove, edit, or
+reject comments, commits, code, wiki edits, issues, and other contributions
+that are not aligned to this Code of Conduct, or to ban temporarily or
+permanently any contributor for other behaviors that they deem inappropriate,
+threatening, offensive, or harmful.
+
+## Scope
+
+This Code of Conduct applies within all project spaces, and it also applies when
+an individual is representing the project or its community in public spaces.
+Examples of representing a project or community include using an official
+project e-mail address, posting via an official social media account, or acting
+as an appointed representative at an online or offline event. Representation of
+a project may be further defined and clarified by project maintainers.
+
+## Enforcement
+
+Instances of abusive, harassing, or otherwise unacceptable behavior may be
+reported by contacting the project team at ohmyzsh@planetargon.com. All
+complaints will be reviewed and investigated and will result in a response that
+is deemed necessary and appropriate to the circumstances. The project team is
+obligated to maintain confidentiality with regard to the reporter of an incident.
+Further details of specific enforcement policies may be posted separately.
+
+Project maintainers who do not follow or enforce the Code of Conduct in good
+faith may face temporary or permanent repercussions as determined by other
+members of the project's leadership.
+
+## Attribution
+
+This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
+available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
+
+[homepage]: https://www.contributor-covenant.org
+
+For answers to common questions about this code of conduct, see
+https://www.contributor-covenant.org/faq
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index ac263fd18..f575157c2 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -1,8 +1,10 @@
# CONTRIBUTING GUIDELINES
-Oh-My-Zsh is a community-driven project. Contribution is welcome, encouraged and appreciated.
+Oh-My-Zsh is a community-driven project. Contribution is welcome, encouraged, and appreciated.
It is also essential for the development of the project.
+First, please take a moment to review our [code of conduct](CODE_OF_CONDUCT.md).
+
These guidelines are an attempt at better addressing the huge amount of pending
issues and pull requests. Please read them closely.
diff --git a/LICENSE.txt b/LICENSE.txt
index 7af38f217..4d465b1c3 100644
--- a/LICENSE.txt
+++ b/LICENSE.txt
@@ -1,6 +1,6 @@
The MIT License (MIT)
-Copyright (c) 2009-2018 Robby Russell and contributors
+Copyright (c) 2009-2019 Robby Russell and contributors
See the full list at https://github.com/robbyrussell/oh-my-zsh/contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
diff --git a/README.md b/README.md
index b3651a99c..dd330d19e 100644
--- a/README.md
+++ b/README.md
@@ -75,7 +75,7 @@ Most plugins (should! we're working on this) include a __README__, which documen
### Themes
-We'll admit it. Early in the Oh My Zsh world, we may have gotten a bit too theme happy. We have over one hundred themes now bundled. Most of them have [screenshots](https://wiki.github.com/robbyrussell/oh-my-zsh/themes) on the wiki. Check them out!
+We'll admit it. Early in the Oh My Zsh world, we may have gotten a bit too theme happy. We have over one hundred themes now bundled. Most of them have [screenshots](https://github.com/robbyrussell/oh-my-zsh/wiki/Themes) on the wiki. Check them out!
#### Selecting a Theme
@@ -213,12 +213,16 @@ Oh My Zsh isn't for everyone. We'll miss you, but we want to make this an easy b
If you want to uninstall `oh-my-zsh`, just run `uninstall_oh_my_zsh` from the command-line. It will remove itself and revert your previous `bash` or `zsh` configuration.
-## Contributing
+## How do I contribute to Oh My Zsh?
+
+Before you participate in our delightful community, please read the [code of conduct](CODE_OF_CONDUCT.md).
I'm far from being a [Zsh](https://www.zsh.org/) expert and suspect there are many ways to improve – if you have ideas on how to make the configuration easier to maintain (and faster), don't hesitate to fork and send pull requests!
We also need people to test out pull-requests. So take a look through [the open issues](https://github.com/robbyrussell/oh-my-zsh/issues) and help where you can.
+See [Contributing](CONTRIBUTING.md) for more details.
+
### Do NOT send us themes
We have (more than) enough themes for the time being. Please add your theme to the [external themes](https://github.com/robbyrussell/oh-my-zsh/wiki/External-themes) wiki page.
@@ -238,7 +242,7 @@ We're on the social media.
## Merchandise
-We have [stickers](https://shop.planetargon.com/products/ohmyzsh-stickers-set-of-3-stickers) and [shirts](https://shop.planetargon.com/products/ohmyzsh-t-shirts) for you to show off your love of Oh My Zsh. Again, this will help you become the talk of the town!
+We have [stickers, shirts, and coffee mugs available](https://shop.planetargon.com/collections/oh-my-zsh?utm_source=github) for you to show off your love of Oh My Zsh. Again, you will become the talk of the town!
## License
diff --git a/lib/compfix.zsh b/lib/compfix.zsh
index 68decc1ed..b09b283f2 100644
--- a/lib/compfix.zsh
+++ b/lib/compfix.zsh
@@ -18,7 +18,7 @@ function handle_completion_insecurities() {
insecure_dirs=( ${(f@):-"$(compaudit 2>/dev/null)"} )
# If no such directories exist, get us out of here.
- (( ! ${#insecure_dirs} )) && return
+ [[ -z "${insecure_dirs}" ]] && return
# List ownership and permissions of all insecure directories.
print "[oh-my-zsh] Insecure completion-dependent directories detected:"
diff --git a/lib/functions.zsh b/lib/functions.zsh
index 4ef8920f6..9f8736bd7 100644
--- a/lib/functions.zsh
+++ b/lib/functions.zsh
@@ -79,7 +79,7 @@ function try_alias_value() {
# 0 if the variable exists, 3 if it was set
#
function default() {
- test `typeset +m "$1"` && return 0
+ (( $+parameters[$1] )) && return 0
typeset -g "$1"="$2" && return 3
}
@@ -93,8 +93,8 @@ function default() {
# 0 if the env variable exists, 3 if it was set
#
function env_default() {
- env | grep -q "^$1=" && return 0
- export "$1=$2" && return 3
+ (( ${${(@f):-$(typeset +xg)}[(I)$1]} )) && return 0
+ export "$1=$2" && return 3
}
diff --git a/lib/history.zsh b/lib/history.zsh
index d8bbd41c4..52e45bf4c 100644
--- a/lib/history.zsh
+++ b/lib/history.zsh
@@ -12,12 +12,12 @@ function omz_history {
builtin fc "$@"
else
# unless a number is provided, show all history events (starting from 1)
- [[ ${@[-1]} = *[0-9]* ]] && builtin fc -l "$@" || builtin fc -l "$@" 1
+ [[ ${@[-1]-} = *[0-9]* ]] && builtin fc -l "$@" || builtin fc -l "$@" 1
fi
}
# Timestamp format
-case $HIST_STAMPS in
+case ${HIST_STAMPS-} in
"mm/dd/yyyy") alias history='omz_history -f' ;;
"dd.mm.yyyy") alias history='omz_history -E' ;;
"yyyy-mm-dd") alias history='omz_history -i' ;;
diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh
index 87d55ee89..aa14f3f07 100644
--- a/lib/termsupport.zsh
+++ b/lib/termsupport.zsh
@@ -21,7 +21,7 @@ function title {
print -Pn "\e]2;$2:q\a" # set window name
print -Pn "\e]1;$1:q\a" # set tab name
;;
- screen*)
+ screen*|tmux*)
print -Pn "\ek$1:q\e\\" # set screen hardstatus
;;
*)
diff --git a/lib/theme-and-appearance.zsh b/lib/theme-and-appearance.zsh
index 96f34aa81..773b5972a 100644
--- a/lib/theme-and-appearance.zsh
+++ b/lib/theme-and-appearance.zsh
@@ -45,9 +45,6 @@ setopt prompt_subst
[[ -n "$WINDOW" ]] && SCREEN_NO="%B$WINDOW%b " || SCREEN_NO=""
-# Apply theming defaults
-PS1="%n@%m:%~%# "
-
# git theming default: Variables for theming the git info prompt
ZSH_THEME_GIT_PROMPT_PREFIX="git:(" # Prefix at the very beginning of the prompt, before the branch name
ZSH_THEME_GIT_PROMPT_SUFFIX=")" # At the very end of the prompt
diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh
index d7c68d35c..b1460b1d7 100644
--- a/oh-my-zsh.sh
+++ b/oh-my-zsh.sh
@@ -44,6 +44,7 @@ is_plugin() {
test -f $base_dir/plugins/$name/$name.plugin.zsh \
|| test -f $base_dir/plugins/$name/_$name
}
+
# Add all defined plugins to fpath. This must be done
# before running compinit.
for plugin ($plugins); do
@@ -51,6 +52,8 @@ for plugin ($plugins); do
fpath=($ZSH_CUSTOM/plugins/$plugin $fpath)
elif is_plugin $ZSH $plugin; then
fpath=($ZSH/plugins/$plugin $fpath)
+ else
+ echo "[oh-my-zsh] plugin '$plugin' not found"
fi
done
@@ -69,14 +72,12 @@ fi
if [[ $ZSH_DISABLE_COMPFIX != true ]]; then
# If completion insecurities exist, warn the user
- if ! compaudit &>/dev/null; then
- handle_completion_insecurities
- fi
+ handle_completion_insecurities
# Load only from secure directories
- compinit -i -d "${ZSH_COMPDUMP}"
+ compinit -i -C -d "${ZSH_COMPDUMP}"
else
# If the user wants it, load from all found directories
- compinit -u -d "${ZSH_COMPDUMP}"
+ compinit -u -C -d "${ZSH_COMPDUMP}"
fi
# Load all of the plugins that were defined in ~/.zshrc
diff --git a/plugins/adb/_adb b/plugins/adb/_adb
index e3c20d751..78c457746 100644
--- a/plugins/adb/_adb
+++ b/plugins/adb/_adb
@@ -49,7 +49,12 @@ _arguments \
case "$state" in
specify_device)
_values -C 'devices' ${$(adb devices -l|awk 'NR>1&& $1 \
- {sub(/ +/," ",$0);gsub(":","\\:",$1); printf "%s[%s] ",$1, $NF}'):-""}
+ {sub(/ +/," ",$0); \
+ gsub(":","\\:",$1); \
+ for(i=1;i<=NF;i++) {
+ if($i ~ /model:/) { split($i,m,":") } \
+ else if($i ~ /product:/) { split($i,p,":") } } \
+ printf "%s[%s(%s)] ",$1, p[2], m[2]}'):-""}
return
;;
esac
@@ -59,4 +64,4 @@ if (( CURRENT == 1 )); then
return
fi
-_files \ No newline at end of file
+_files
diff --git a/plugins/ansible/README.md b/plugins/ansible/README.md
index 38bc13775..e0e6a19bb 100644
--- a/plugins/ansible/README.md
+++ b/plugins/ansible/README.md
@@ -19,9 +19,8 @@ plugins=(... ansible)
| `a` | command `ansible` |
| `aconf` | command `ansible-config` |
| `acon` | command `ansible-console` |
-| `aconn` | command `ansible-connection` |
| `ainv` | command `ansible-inventory` |
-| `aplay` | command `ansible-playbook` |
+| `aplaybook` | command `ansible-playbook` |
| `ainv` | command `ansible-inventory` |
| `adoc` | command `ansible-doc` |
| `agal` | command `ansible-galaxy` |
diff --git a/plugins/ansible/ansible.plugin.zsh b/plugins/ansible/ansible.plugin.zsh
index 0e7aff528..f68ff23a5 100644
--- a/plugins/ansible/ansible.plugin.zsh
+++ b/plugins/ansible/ansible.plugin.zsh
@@ -18,10 +18,9 @@ function ansible-role-init(){
alias a='ansible '
alias aconf='ansible-config '
alias acon='ansible-console '
-alias aconn='ansible-connection '
alias aver='ansible-version'
alias arinit='ansible-role-init'
-alias aplay='ansible-playbook '
+alias aplaybook='ansible-playbook '
alias ainv='ansible-inventory '
alias adoc='ansible-doc '
alias agal='ansible-galaxy '
diff --git a/plugins/archlinux/README.md b/plugins/archlinux/README.md
index 7ebe8e53d..ff2b6a4c4 100644
--- a/plugins/archlinux/README.md
+++ b/plugins/archlinux/README.md
@@ -14,7 +14,7 @@
| yalocs | yay -Qs | Search for packages in the local database |
| yalst | yay -Qe | List installed packages including from AUR (tagged as "local") |
| yamir | yay -Syy | Force refresh of all package lists after updating mirrorlist |
-| yaorph | yay -Qtd | Remove orphans using yaourt |
+| yaorph | yay -Qtd | Remove orphans using yay |
| yare | yay -R | Remove packages, keeping its settings and dependencies |
| yarem | yay -Rns | Remove packages, including its settings and unneeded dependencies |
| yarep | yay -Si | Display information about a package in the repositories |
diff --git a/plugins/asdf/asdf.plugin.zsh b/plugins/asdf/asdf.plugin.zsh
index 75395c718..38b225538 100644
--- a/plugins/asdf/asdf.plugin.zsh
+++ b/plugins/asdf/asdf.plugin.zsh
@@ -1,9 +1,11 @@
# Find where asdf should be installed
ASDF_DIR="${ASDF_DIR:-$HOME/.asdf}"
+ASDF_COMPLETIONS="$ASDF_DIR/completions"
# If not found, check for Homebrew package
-if [[ ! -d $ASDF_DIR ]] && (( $+commands[brew] )); then
+if [[ ! -f "$ASDF_DIR/asdf.sh" ]] && (( $+commands[brew] )); then
ASDF_DIR="$(brew --prefix asdf)"
+ ASDF_COMPLETIONS="$ASDF_DIR/etc/bash_completion.d"
fi
# Load command
@@ -11,7 +13,7 @@ if [[ -f "$ASDF_DIR/asdf.sh" ]]; then
. "$ASDF_DIR/asdf.sh"
# Load completions
- if [[ -f "$ASDF_DIR/completions/asdf.bash" ]]; then
- . "$ASDF_DIR/completions/asdf.bash"
+ if [[ -f "$ASDF_COMPLETIONS/asdf.bash" ]]; then
+ . "$ASDF_COMPLETIONS/asdf.bash"
fi
fi
diff --git a/plugins/aws/README.md b/plugins/aws/README.md
index 8a45199b8..a52024128 100644
--- a/plugins/aws/README.md
+++ b/plugins/aws/README.md
@@ -1,8 +1,7 @@
# aws
This plugin provides completion support for [awscli](https://docs.aws.amazon.com/cli/latest/reference/index.html)
-and a few utilities to manage AWS profiles: a function to change profiles with autocompletion support
-and a function to get the current AWS profile. The current AWS profile is also displayed in `RPROMPT`.
+and a few utilities to manage AWS profiles and display them in the prompt.
To use it, add `aws` to the plugins array in your zshrc file.
@@ -12,9 +11,26 @@ plugins=(... aws)
## Plugin commands
-* `asp <profile>`: Sets `AWS_PROFILE` and `AWS_DEFAULT_PROFILE` (legacy) to `<profile>`.
-It also adds it to your RPROMPT.
+* `asp [<profile>]`: sets `$AWS_PROFILE` and `$AWS_DEFAULT_PROFILE` (legacy) to `<profile>`.
+ It also sets `$AWS_EB_PROFILE` to `<profile>` for the Elastic Beanstalk CLI.
+ Run `asp` without arguments to clear the profile.
-* `agp`: Gets the current value of `AWS_PROFILE`.
+* `agp`: gets the current value of `$AWS_PROFILE`.
-* `aws_profiles`: Lists the available profiles in the file referenced in `AWS_CONFIG_FILE` (default: ~/.aws/config). Used to provide completion for the `asp` function.
+* `aws_change_access_key`: changes the AWS access key of a profile.
+
+* `aws_profiles`: lists the available profiles in the `$AWS_CONFIG_FILE` (default: `~/.aws/config`).
+ Used to provide completion for the `asp` function.
+
+## Plugin options
+
+* Set `SHOW_AWS_PROMPT=false` in your zshrc file if you want to prevent the plugin from modifying your RPROMPT.
+
+## Theme
+
+The plugin creates an `aws_prompt_info` function that you can use in your theme, which displays
+the current `$AWS_PROFILE`. It uses two variables to control how that is shown:
+
+- ZSH_THEME_AWS_PREFIX: sets the prefix of the AWS_PROFILE. Defaults to `<aws:`.
+
+- ZSH_THEME_AWS_SUFFIX: sets the suffix of the AWS_PROFILE. Defaults to `>`.
diff --git a/plugins/aws/aws.plugin.zsh b/plugins/aws/aws.plugin.zsh
index af27e669a..6de329bb8 100644
--- a/plugins/aws/aws.plugin.zsh
+++ b/plugins/aws/aws.plugin.zsh
@@ -1,49 +1,78 @@
-_homebrew-installed() {
- type brew &> /dev/null
- _xit=$?
- if [ $_xit -eq 0 ];then
- # ok , we have brew installed
- # speculatively we check default brew prefix
- if [ -h /usr/local/opt/awscli ];then
- _brew_prefix="/usr/local/opt/awscli"
- else
- # ok , it is not default prefix
- # this call to brew is expensive ( about 400 ms ), so at least let's make it only once
- _brew_prefix=$(brew --prefix awscli)
- fi
- return 0
- else
- return $_xit
- fi
-}
-
-_awscli-homebrew-installed() {
- [ -r $_brew_prefix/libexec/bin/aws_zsh_completer.sh ] &> /dev/null
-}
+# AWS profile selection
function agp {
echo $AWS_PROFILE
}
function asp {
- local rprompt=${RPROMPT/<aws:$(agp)>/}
-
export AWS_DEFAULT_PROFILE=$1
export AWS_PROFILE=$1
+ export AWS_EB_PROFILE=$1
- export RPROMPT="<aws:$AWS_PROFILE>$rprompt"
+ if [[ -z "$1" ]]; then
+ echo AWS profile cleared.
+ fi
+}
+
+function aws_change_access_key {
+ if [[ -z "$1" ]] then
+ echo "usage: $0 <profile>"
+ return 1
+ fi
+
+ echo Insert the credentials when asked.
+ asp "$1"
+ aws iam create-access-key
+ aws configure --profile "$1"
+
+ echo You can now safely delete the old access key running \`aws iam delete-access-key --access-key-id ID\`
+ echo Your current keys are:
+ aws iam list-access-keys
}
function aws_profiles {
reply=($(grep '\[profile' "${AWS_CONFIG_FILE:-$HOME/.aws/config}"|sed -e 's/.*profile \([a-zA-Z0-9_\.-]*\).*/\1/'))
}
-compctl -K aws_profiles asp
+compctl -K aws_profiles asp aws_change_access_key
+
+
+# AWS prompt
+
+function aws_prompt_info() {
+ [[ -z $AWS_PROFILE ]] && return
+ echo "${ZSH_THEME_AWS_PREFIX:=<aws:}${AWS_PROFILE}${ZSH_THEME_AWS_SUFFIX:=>}"
+}
+
+if [ "$SHOW_AWS_PROMPT" != false ]; then
+ export RPROMPT='$(aws_prompt_info)'"$RPROMPT"
+fi
+
+
+# Load awscli completions
+
+_awscli-homebrew-installed() {
+ # check if Homebrew is installed
+ (( $+commands[brew] )) || return 1
+
+ # speculatively check default brew prefix
+ if [ -h /usr/local/opt/awscli ]; then
+ _brew_prefix=/usr/local/opt/awscli
+ else
+ # ok, it is not in the default prefix
+ # this call to brew is expensive (about 400 ms), so at least let's make it only once
+ _brew_prefix=$(brew --prefix awscli)
+ fi
+}
+
+# get aws_zsh_completer.sh location from $PATH
+_aws_zsh_completer_path="$commands[aws_zsh_completer.sh]"
-if which aws_zsh_completer.sh &>/dev/null; then
- _aws_zsh_completer_path=$(which aws_zsh_completer.sh 2>/dev/null)
-elif _homebrew-installed && _awscli-homebrew-installed; then
+# otherwise check if installed via Homebrew
+if [[ -z $_aws_zsh_completer_path ]] && _awscli-homebrew-installed; then
_aws_zsh_completer_path=$_brew_prefix/libexec/bin/aws_zsh_completer.sh
+else
+ _aws_zsh_completer_path=/usr/share/zsh/site-functions/aws_zsh_completer.sh
fi
-[ -n "$_aws_zsh_completer_path" ] && [ -x $_aws_zsh_completer_path ] && source $_aws_zsh_completer_path
-unset _aws_zsh_completer_path
+[[ -r $_aws_zsh_completer_path ]] && source $_aws_zsh_completer_path
+unset _aws_zsh_completer_path _brew_prefix
diff --git a/plugins/brew/README.md b/plugins/brew/README.md
index aab55ea39..c129a7652 100644
--- a/plugins/brew/README.md
+++ b/plugins/brew/README.md
@@ -17,3 +17,5 @@ plugins=(... brew)
| bubo | `brew update && brew outdated` | Fetch the newest version of Homebrew and all formulae, then list outdated formulae. |
| bubc | `brew upgrade && brew cleanup` | Upgrade outdated, unpinned brews (with existing install options), then removes stale lock files and outdated downloads for formulae and casks, and removes old versions of installed formulae. |
| bubu | `bubo && bubc` | Updates Homebrew, lists outdated formulae, upgrades oudated and unpinned formulae, and removes stale and outdated downloads and versions. |
+| bcubo | `brew update && brew cask outdated` | Fetch the newest version of Homebrew and all formulae, then list outdated casks. |
+| bcubc | `brew cask reinstall $(brew cask outdated) && brew cleanup` | Updates outdated casks, then runs cleanup. | \ No newline at end of file
diff --git a/plugins/brew/brew.plugin.zsh b/plugins/brew/brew.plugin.zsh
index 60b81f8ec..cfbaa3480 100644
--- a/plugins/brew/brew.plugin.zsh
+++ b/plugins/brew/brew.plugin.zsh
@@ -4,6 +4,8 @@ alias brewsp='brew list --pinned'
alias bubo='brew update && brew outdated'
alias bubc='brew upgrade && brew cleanup'
alias bubu='bubo && bubc'
+alias bcubo='brew update && brew cask outdated'
+alias bcubc='brew cask reinstall $(brew cask outdated) && brew cleanup'
if command mkdir "$ZSH_CACHE_DIR/.brew-completion-message" 2>/dev/null; then
print -P '%F{yellow}'Oh My Zsh brew plugin:
diff --git a/plugins/cake/README.md b/plugins/cake/README.md
new file mode 100644
index 000000000..aad92a3ec
--- /dev/null
+++ b/plugins/cake/README.md
@@ -0,0 +1,15 @@
+# Cake
+
+This plugin provides completion for [CakePHP](https://cakephp.org/).
+
+To use it add cake to the plugins array in your zshrc file.
+
+```bash
+plugins=(... cake)
+```
+
+## Note
+
+This plugin generates a cache file of the cake tasks found, named `.cake_task_cache`, in the current working directory.
+It is regenerated when the Cakefile is newer than the cache file. It is advised that you add the cake file to your
+`.gitignore` files.
diff --git a/plugins/cargo/README.md b/plugins/cargo/README.md
index 5fa688d21..31bae4efe 100644
--- a/plugins/cargo/README.md
+++ b/plugins/cargo/README.md
@@ -1,6 +1,6 @@
# cargo
-This plugin adds completion for the Rust build tool [`cargo`](https://github.com/rust-lang/cargo).
+This plugin adds completion for the Rust build tool [`Cargo`](https://github.com/rust-lang/cargo).
To use it, add `cargo` to the plugins array in your zshrc file:
@@ -8,4 +8,4 @@ To use it, add `cargo` to the plugins array in your zshrc file:
plugins=(... cargo)
```
-Updated on October 4th, 2016.
+Updated on March 3rd, 2019, from [Cargo 0.34.0](https://github.com/rust-lang/cargo/releases/tag/0.34.0).
diff --git a/plugins/cargo/_cargo b/plugins/cargo/_cargo
index 54e709ca0..395c517cd 100644
--- a/plugins/cargo/_cargo
+++ b/plugins/cargo/_cargo
@@ -1,23 +1,37 @@
#compdef cargo
-typeset -A opt_args
autoload -U regexp-replace
+zstyle -T ':completion:*:*:cargo:*' tag-order && \
+ zstyle ':completion:*:*:cargo:*' tag-order 'common-commands'
+
_cargo() {
+local context state state_descr line
+typeset -A opt_args
+# leading items in parentheses are an exclusion list for the arguments following that arg
+# See: http://zsh.sourceforge.net/Doc/Release/Completion-System.html#Completion-Functions
+# - => exclude all other options
+# 1 => exclude positional arg 1
+# * => exclude all other args
+# +blah => exclude +blah
_arguments \
'(- 1 *)'{-h,--help}'[show help message]' \
+ '(- 1 *)--list[list installed commands]' \
'(- 1 *)'{-V,--version}'[show version information]' \
- '(- 1 *)'--list'[list installed commands]' \
- '(- 1 *)'--explain'[Run `rustc --explain CODE`]' \
- '(- 1 *)'{-v,--verbose}'[use verbose output]' \
- '(- 1 *)'--color'[colorization option]' \
- '(- 1 *)'--frozen'[Require Cargo.lock and cache are up to date]' \
- '(- 1 *)'--locked'[Require Cargo.lock is up to date]' \
- '1: :_cargo_cmds' \
+ {-v,--verbose}'[use verbose output]' \
+ --color'[colorization option]' \
+ '(+beta +nightly)+stable[use the stable toolchain]' \
+ '(+stable +nightly)+beta[use the beta toolchain]' \
+ '(+stable +beta)+nightly[use the nightly toolchain]' \
+ '1: :->command' \
'*:: :->args'
case $state in
+ command)
+ _alternative 'common-commands:common:_cargo_cmds' 'all-commands:all:_cargo_all_cmds'
+ ;;
+
args)
case $words[1] in
bench)
@@ -54,6 +68,23 @@ case $state in
'--color=:colorization option:(auto always never)' \
;;
+ check)
+ _arguments \
+ '--features=[space separated feature list]' \
+ '--all-features[enable all available features]' \
+ '(-h, --help)'{-h,--help}'[show help message]' \
+ '(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \
+ "${command_scope_spec[@]}" \
+ '--manifest-path=[path to manifest]: :_files -/' \
+ '--no-default-features[do not check the default features]' \
+ '(-p,--package)'{-p=,--package=}'[package to check]:packages:_get_package_names' \
+ '--release=[check in release mode]' \
+ '--target=[target triple]' \
+ '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
+ '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
+ '--color=:colorization option:(auto always never)' \
+ ;;
+
clean)
_arguments \
'(-h, --help)'{-h,--help}'[show help message]' \
@@ -105,7 +136,7 @@ case $state in
git-checkout)
_arguments \
'(-h, --help)'{-h,--help}'[show help message]' \
- 'q(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
+ '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
'--reference=[REF]' \
'--url=[URL]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
@@ -142,10 +173,10 @@ case $state in
'(-h, --help)'{-h,--help}'[show help message]' \
'(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \
'--no-default-features[do not build the default features]' \
- '--path=[local filesystem path to crate to install]' \
+ '--path=[local filesystem path to crate to install]: :_files -/' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
'--rev=[specific commit to use when installing from git]' \
- '--root=[directory to install packages into]' \
+ '--root=[directory to install packages into]: :_files -/' \
'--tag=[tag to use when installing from git]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'--vers=[version to install from crates.io]' \
@@ -270,7 +301,7 @@ case $state in
'--all-features[enable all available features]' \
'(-h, --help)'{-h,--help}'[show help message]' \
'(-j, --jobs)'{-j,--jobs}'=[number of parallel jobs, defaults to # of CPUs]' \
- '--manifest-path=[path to the manifest to fetch dependencies for]' \
+ '--manifest-path=[path to the manifest to fetch dependencies for]: :_files -/' \
'--no-default-features[do not compile default features for the package]' \
'(-p, --package)'{-p,--package}'=[profile to compile for]' \
'--profile=[profile to build the selected target for]' \
@@ -288,7 +319,7 @@ case $state in
'--all-features[enable all available features]' \
'(-h, --help)'{-h,--help}'[show help message]' \
'(-j, --jobs)'{-j,--jobs}'=[number of parallel jobs, defaults to # of CPUs]' \
- '--manifest-path=[path to the manifest to document]' \
+ '--manifest-path=[path to the manifest to document]: :_files -/' \
'--no-default-features[do not build the `default` feature]' \
'--open[open the docs in a browser after the operation]' \
'(-p, --package)'{-p,--package}'=[package to document]' \
@@ -327,6 +358,15 @@ case $state in
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'--color=:colorization option:(auto always never)' \
'1: :_test_names' \
+ '(--doc --bin --example --test --bench)--lib[only test library]' \
+ '(--lib --bin --example --test --bench)--doc[only test documentation]' \
+ '(--lib --doc --example --test --bench)--bin=[binary name]' \
+ '(--lib --doc --bin --test --bench)--example=[example name]' \
+ '(--lib --doc --bin --example --bench)--test=[test name]' \
+ '(--lib --doc --bin --example --test)--bench=[benchmark name]' \
+ '--message-format:error format:(human json short)' \
+ '--frozen[require lock and cache up to date]' \
+ '--locked[require lock up to date]'
;;
uninstall)
@@ -335,7 +375,7 @@ case $state in
'--color=:colorization option:(auto always never)' \
'(-h, --help)'{-h,--help}'[show help message]' \
'(-q, --quiet)'{-q,--quiet}'[less output printed to stdout]' \
- '--root=[directory to uninstall packages from]' \
+ '--root=[directory to uninstall packages from]: :_files -/' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
;;
@@ -386,19 +426,20 @@ esac
_cargo_cmds(){
local -a commands;commands=(
'bench:execute all benchmarks of a local package'
-'build:compile the current project'
+'build:compile the current package'
+'check:check the current package without compiling'
'clean:remove generated artifacts'
'doc:build package documentation'
'fetch:fetch package dependencies'
'generate-lockfile:create lockfile'
'git-checkout:git checkout'
'help:get help for commands'
-'init:create new project in current directory'
+'init:create new package in current directory'
'install:install a Rust binary'
'locate-project:print "Cargo.toml" location'
'login:login to remote server'
-'metadata:the metadata for a project in json'
-'new:create a new project'
+'metadata:the metadata for a package in json'
+'new:create a new package'
'owner:manage the owners of a crate on the registry'
'package:assemble local package into a distributable tarball'
'pkgid:print a fully qualified package specification'
@@ -415,8 +456,12 @@ local -a commands;commands=(
'version:show version information'
'yank:remove pushed file from index'
)
-_describe 'command' commands
+_describe -t common-commands 'common commands' commands
+}
+_cargo_all_cmds(){
+local -a commands;commands=($(cargo --list))
+_describe -t all-commands 'all commands' commands
}
@@ -484,7 +529,7 @@ _benchmark_names()
_get_names_from_array "bench"
}
-# These flags are mutally exclusive specifiers for the scope of a command; as
+# These flags are mutually exclusive specifiers for the scope of a command; as
# they are used in multiple places without change, they are expanded into the
# appropriate command's `_arguments` where appropriate.
set command_scope_spec
@@ -496,5 +541,4 @@ command_scope_spec=(
'(--bench --bin --example --lib)--test=[test name]'
)
-
_cargo
diff --git a/plugins/cloudapp/cloudapp.plugin.zsh b/plugins/cloudapp/cloudapp.plugin.zsh
index 99252f690..3b363c81b 100644
--- a/plugins/cloudapp/cloudapp.plugin.zsh
+++ b/plugins/cloudapp/cloudapp.plugin.zsh
@@ -1,2 +1,6 @@
-#!/bin/zsh
-alias cloudapp=$ZSH/plugins/cloudapp/cloudapp.rb
+alias cloudapp="${0:a:h}/cloudapp.rb"
+
+# Ensure only the owner can access the credentials file
+if [[ -f ~/.cloudapp ]]; then
+ chmod 600 ~/.cloudapp
+fi
diff --git a/plugins/command-not-found/README.md b/plugins/command-not-found/README.md
index df62d1f07..1cf4ba66e 100644
--- a/plugins/command-not-found/README.md
+++ b/plugins/command-not-found/README.md
@@ -27,5 +27,6 @@ It works out of the box with the command-not-found packages for:
- [Arch Linux](https://wiki.archlinux.org/index.php/Pkgfile#Command_not_found)
- [macOS (Homebrew)](https://github.com/Homebrew/homebrew-command-not-found)
- [Fedora](https://fedoraproject.org/wiki/Features/PackageKitCommandNotFound)
+- [NixOS](https://github.com/NixOS/nixpkgs/tree/master/nixos/modules/programs/command-not-found)
You can add support for other platforms by submitting a Pull Request.
diff --git a/plugins/command-not-found/command-not-found.plugin.zsh b/plugins/command-not-found/command-not-found.plugin.zsh
index ba1262de6..dd1186e44 100644
--- a/plugins/command-not-found/command-not-found.plugin.zsh
+++ b/plugins/command-not-found/command-not-found.plugin.zsh
@@ -31,3 +31,10 @@ if type brew &> /dev/null; then
eval "$(brew command-not-found-init)";
fi
fi
+
+# NixOS command-not-found support
+if [ -x /run/current-system/sw/bin/command-not-found ]; then
+ command_not_found_handler () {
+ /run/current-system/sw/bin/command-not-found $@
+ }
+fi
diff --git a/plugins/docker-compose/_docker-compose b/plugins/docker-compose/_docker-compose
index c0a54cced..808b068a3 100644
--- a/plugins/docker-compose/_docker-compose
+++ b/plugins/docker-compose/_docker-compose
@@ -23,7 +23,7 @@ __docker-compose_all_services_in_compose_file() {
local already_selected
local -a services
already_selected=$(echo $words | tr " " "|")
- __docker-compose_q config --services \
+ __docker-compose_q ps --services "$@" \
| grep -Ev "^(${already_selected})$"
}
@@ -31,125 +31,42 @@ __docker-compose_all_services_in_compose_file() {
__docker-compose_services_all() {
[[ $PREFIX = -* ]] && return 1
integer ret=1
- services=$(__docker-compose_all_services_in_compose_file)
+ services=$(__docker-compose_all_services_in_compose_file "$@")
_alternative "args:services:($services)" && ret=0
return ret
}
-# All services that have an entry with the given key in their docker-compose.yml section
-__docker-compose_services_with_key() {
- local already_selected
- local -a buildable
- already_selected=$(echo $words | tr " " "|")
- # flatten sections to one line, then filter lines containing the key and return section name.
- __docker-compose_q config \
- | sed -n -e '/^services:/,/^[^ ]/p' \
- | sed -n 's/^ //p' \
- | awk '/^[a-zA-Z0-9]/{printf "\n"};{printf $0;next;}' \
- | grep " \+$1:" \
- | cut -d: -f1 \
- | grep -Ev "^(${already_selected})$"
-}
-
# All services that are defined by a Dockerfile reference
__docker-compose_services_from_build() {
[[ $PREFIX = -* ]] && return 1
- integer ret=1
- buildable=$(__docker-compose_services_with_key build)
- _alternative "args:buildable services:($buildable)" && ret=0
-
- return ret
+ __docker-compose_services_all --filter source=build
}
# All services that are defined by an image
__docker-compose_services_from_image() {
[[ $PREFIX = -* ]] && return 1
- integer ret=1
- pullable=$(__docker-compose_services_with_key image)
- _alternative "args:pullable services:($pullable)" && ret=0
-
- return ret
-}
-
-__docker-compose_get_services() {
- [[ $PREFIX = -* ]] && return 1
- integer ret=1
- local kind
- declare -a running paused stopped lines args services
-
- docker_status=$(docker ps > /dev/null 2>&1)
- if [ $? -ne 0 ]; then
- _message "Error! Docker is not running."
- return 1
- fi
-
- kind=$1
- shift
- [[ $kind =~ (stopped|all) ]] && args=($args -a)
-
- lines=(${(f)"$(_call_program commands docker $docker_options ps $args)"})
- services=(${(f)"$(_call_program commands docker-compose 2>/dev/null $compose_options ps -q)"})
-
- # Parse header line to find columns
- local i=1 j=1 k header=${lines[1]}
- declare -A begin end
- while (( j < ${#header} - 1 )); do
- i=$(( j + ${${header[$j,-1]}[(i)[^ ]]} - 1 ))
- j=$(( i + ${${header[$i,-1]}[(i) ]} - 1 ))
- k=$(( j + ${${header[$j,-1]}[(i)[^ ]]} - 2 ))
- begin[${header[$i,$((j-1))]}]=$i
- end[${header[$i,$((j-1))]}]=$k
- done
- lines=(${lines[2,-1]})
-
- # Container ID
- local line s name
- local -a names
- for line in $lines; do
- if [[ ${services[@]} == *"${line[${begin[CONTAINER ID]},${end[CONTAINER ID]}]%% ##}"* ]]; then
- names=(${(ps:,:)${${line[${begin[NAMES]},-1]}%% *}})
- for name in $names; do
- s="${${name%_*}#*_}:${(l:15:: :::)${${line[${begin[CREATED]},${end[CREATED]}]/ ago/}%% ##}}"
- s="$s, ${line[${begin[CONTAINER ID]},${end[CONTAINER ID]}]%% ##}"
- s="$s, ${${${line[${begin[IMAGE]},${end[IMAGE]}]}/:/\\:}%% ##}"
- if [[ ${line[${begin[STATUS]},${end[STATUS]}]} = Exit* ]]; then
- stopped=($stopped $s)
- else
- if [[ ${line[${begin[STATUS]},${end[STATUS]}]} = *\(Paused\)* ]]; then
- paused=($paused $s)
- fi
- running=($running $s)
- fi
- done
- fi
- done
-
- [[ $kind =~ (running|all) ]] && _describe -t services-running "running services" running "$@" && ret=0
- [[ $kind =~ (paused|all) ]] && _describe -t services-paused "paused services" paused "$@" && ret=0
- [[ $kind =~ (stopped|all) ]] && _describe -t services-stopped "stopped services" stopped "$@" && ret=0
-
- return ret
+ __docker-compose_services_all --filter source=image
}
__docker-compose_pausedservices() {
[[ $PREFIX = -* ]] && return 1
- __docker-compose_get_services paused "$@"
+ __docker-compose_services_all --filter status=paused
}
__docker-compose_stoppedservices() {
[[ $PREFIX = -* ]] && return 1
- __docker-compose_get_services stopped "$@"
+ __docker-compose_services_all --filter status=stopped
}
__docker-compose_runningservices() {
[[ $PREFIX = -* ]] && return 1
- __docker-compose_get_services running "$@"
+ __docker-compose_services_all --filter status=running
}
__docker-compose_services() {
[[ $PREFIX = -* ]] && return 1
- __docker-compose_get_services all "$@"
+ __docker-compose_services_all
}
__docker-compose_caching_policy() {
@@ -196,9 +113,12 @@ __docker-compose_subcommand() {
$opts_help \
"*--build-arg=[Set build-time variables for one service.]:<varname>=<value>: " \
'--force-rm[Always remove intermediate containers.]' \
- '--memory[Memory limit for the build container.]' \
+ '(--quiet -q)'{--quiet,-q}'[Curb build output]' \
+ '(--memory -m)'{--memory,-m}'[Memory limit for the build container.]' \
'--no-cache[Do not use cache when building the image.]' \
'--pull[Always attempt to pull a newer version of the image.]' \
+ '--compress[Compress the build context using gzip.]' \
+ '--parallel[Build images in parallel.]' \
'*:services:__docker-compose_services_from_build' && ret=0
;;
(bundle)
@@ -213,7 +133,8 @@ __docker-compose_subcommand() {
'(--quiet -q)'{--quiet,-q}"[Only validate the configuration, don't print anything.]" \
'--resolve-image-digests[Pin image tags to digests.]' \
'--services[Print the service names, one per line.]' \
- '--volumes[Print the volume names, one per line.]' && ret=0
+ '--volumes[Print the volume names, one per line.]' \
+ '--hash[Print the service config hash, one per line. Set "service1,service2" for a list of specified services.]' \ && ret=0
;;
(create)
_arguments \
@@ -222,11 +143,12 @@ __docker-compose_subcommand() {
$opts_no_recreate \
$opts_no_build \
"(--no-build)--build[Build images before creating containers.]" \
- '*:services:__docker-compose_services_all' && ret=0
+ '*:services:__docker-compose_services' && ret=0
;;
(down)
_arguments \
$opts_help \
+ $opts_timeout \
"--rmi[Remove images. Type must be one of: 'all': Remove all images used by any service. 'local': Remove only images that don't have a custom tag set by the \`image\` field.]:type:(all local)" \
'(-v --volumes)'{-v,--volumes}"[Remove named volumes declared in the \`volumes\` section of the Compose file and anonymous volumes attached to containers.]" \
$opts_remove_orphans && ret=0
@@ -235,16 +157,18 @@ __docker-compose_subcommand() {
_arguments \
$opts_help \
'--json[Output events as a stream of json objects]' \
- '*:services:__docker-compose_services_all' && ret=0
+ '*:services:__docker-compose_services' && ret=0
;;
(exec)
_arguments \
$opts_help \
'-d[Detached mode: Run command in the background.]' \
'--privileged[Give extended privileges to the process.]' \
- '(-u --user)'{-u,--user=}'[Run the command as this user.]:username:_users' \
+ '(-u --user)'{-u,--user=}'[Run the command as this user.]:username:_users' \
'-T[Disable pseudo-tty allocation. By default `docker-compose exec` allocates a TTY.]' \
'--index=[Index of the container if there are multiple instances of a service \[default: 1\]]:index: ' \
+ '*'{-e,--env}'[KEY=VAL Set an environment variable (can be used multiple times)]:environment variable KEY=VAL: ' \
+ '(-w --workdir)'{-w,--workdir=}'[Working directory inside the container]:workdir: ' \
'(-):running services:__docker-compose_runningservices' \
'(-):command: _command_names -e' \
'*::arguments: _normal' && ret=0
@@ -252,12 +176,12 @@ __docker-compose_subcommand() {
(help)
_arguments ':subcommand:__docker-compose_commands' && ret=0
;;
- (images)
- _arguments \
- $opts_help \
- '-q[Only display IDs]' \
- '*:services:__docker-compose_services_all' && ret=0
- ;;
+ (images)
+ _arguments \
+ $opts_help \
+ '-q[Only display IDs]' \
+ '*:services:__docker-compose_services' && ret=0
+ ;;
(kill)
_arguments \
$opts_help \
@@ -271,7 +195,7 @@ __docker-compose_subcommand() {
$opts_no_color \
'--tail=[Number of lines to show from the end of the logs for each container.]:number of lines: ' \
'(-t --timestamps)'{-t,--timestamps}'[Show timestamps]' \
- '*:services:__docker-compose_services_all' && ret=0
+ '*:services:__docker-compose_services' && ret=0
;;
(pause)
_arguments \
@@ -290,12 +214,16 @@ __docker-compose_subcommand() {
_arguments \
$opts_help \
'-q[Only display IDs]' \
- '*:services:__docker-compose_services_all' && ret=0
+ '--filter KEY=VAL[Filter services by a property]:<filtername>=<value>:' \
+ '*:services:__docker-compose_services' && ret=0
;;
(pull)
_arguments \
$opts_help \
'--ignore-pull-failures[Pull what it can and ignores images with pull failures.]' \
+ '--no-parallel[Disable parallel pulling]' \
+ '(-q --quiet)'{-q,--quiet}'[Pull without printing progress information]' \
+ '--include-deps[Also pull services declared as dependencies]' \
'*:services:__docker-compose_services_from_image' && ret=0
;;
(push)
@@ -317,6 +245,7 @@ __docker-compose_subcommand() {
$opts_no_deps \
'-d[Detached mode: Run container in the background, print new container name.]' \
'*-e[KEY=VAL Set an environment variable (can be used multiple times)]:environment variable KEY=VAL: ' \
+ '*'{-l,--label}'[KEY=VAL Add or override a label (can be used multiple times)]:label KEY=VAL: ' \
'--entrypoint[Overwrite the entrypoint of the image.]:entry point: ' \
'--name=[Assign a name to the container]:name: ' \
'(-p --publish)'{-p,--publish=}"[Publish a container's port(s) to the host]" \
@@ -326,6 +255,7 @@ __docker-compose_subcommand() {
'(-u --user)'{-u,--user=}'[Run as specified username or uid]:username or uid:_users' \
'(-v --volume)*'{-v,--volume=}'[Bind mount a volume]:volume: ' \
'(-w --workdir)'{-w,--workdir=}'[Working directory inside the container]:workdir: ' \
+ "--use-aliases[Use the services network aliases in the network(s) the container connects to]" \
'(-):services:__docker-compose_services' \
'(-):command: _command_names -e' \
'*::arguments: _normal' && ret=0
@@ -369,8 +299,10 @@ __docker-compose_subcommand() {
"(--no-build)--build[Build images before starting containers.]" \
"(-d)--abort-on-container-exit[Stops all containers if any container was stopped. Incompatible with -d.]" \
'(-t --timeout)'{-t,--timeout}"[Use this timeout in seconds for container shutdown when attached or when containers are already running. (default: 10)]:seconds: " \
+ '--scale[SERVICE=NUM Scale SERVICE to NUM instances. Overrides the `scale` setting in the Compose file if present.]:service scale SERVICE=NUM: ' \
+ '--exit-code-from=[Return the exit code of the selected service container. Implies --abort-on-container-exit]:service:__docker-compose_services' \
$opts_remove_orphans \
- '*:services:__docker-compose_services_all' && ret=0
+ '*:services:__docker-compose_services' && ret=0
;;
(version)
_arguments \
@@ -409,8 +341,11 @@ _docker-compose() {
'(- :)'{-h,--help}'[Get help]' \
'*'{-f,--file}"[${file_description}]:file:_files -g '*.yml'" \
'(-p --project-name)'{-p,--project-name}'[Specify an alternate project name (default: directory name)]:project name:' \
- '--verbose[Show more output]' \
+ "--compatibility[If set, Compose will attempt to convert keys in v3 files to their non-Swarm equivalent]" \
'(- :)'{-v,--version}'[Print version and exit]' \
+ '--verbose[Show more output]' \
+ '--log-level=[Set log level]:level:(DEBUG INFO WARNING ERROR CRITICAL)' \
+ '--no-ansi[Do not print ANSI control characters]' \
'(-H --host)'{-H,--host}'[Daemon socket to connect to]:host:' \
'--tls[Use TLS; implied by --tlsverify]' \
'--tlscacert=[Trust certs signed only by this CA]:ca path:' \
@@ -421,7 +356,7 @@ _docker-compose() {
'(-): :->command' \
'(-)*:: :->option-or-argument' && ret=0
- local -a relevant_compose_flags relevant_docker_flags compose_options docker_options
+ local -a relevant_compose_flags relevant_compose_repeatable_flags relevant_docker_flags compose_options docker_options
relevant_compose_flags=(
"--file" "-f"
@@ -435,6 +370,10 @@ _docker-compose() {
"--skip-hostname-check"
)
+ relevant_compose_repeatable_flags=(
+ "--file" "-f"
+ )
+
relevant_docker_flags=(
"--host" "-H"
"--tls"
@@ -452,9 +391,18 @@ _docker-compose() {
fi
fi
if [[ -n "${relevant_compose_flags[(r)$k]}" ]]; then
- compose_options+=$k
- if [[ -n "$opt_args[$k]" ]]; then
- compose_options+=$opt_args[$k]
+ if [[ -n "${relevant_compose_repeatable_flags[(r)$k]}" ]]; then
+ values=("${(@s/:/)opt_args[$k]}")
+ for value in $values
+ do
+ compose_options+=$k
+ compose_options+=$value
+ done
+ else
+ compose_options+=$k
+ if [[ -n "$opt_args[$k]" ]]; then
+ compose_options+=$opt_args[$k]
+ fi
fi
fi
done
diff --git a/plugins/drush/README.md b/plugins/drush/README.md
new file mode 100644
index 000000000..df7b82bdd
--- /dev/null
+++ b/plugins/drush/README.md
@@ -0,0 +1,83 @@
+# Drush
+
+## Description
+This plugin offers aliases and functions to make the work with drush easier and more productive.
+
+To enable it, add the `drush` to your `plugins` array in `~/.zshrc`:
+
+```
+plugins=(... drush)
+```
+
+## Aliases
+| Alias | Description | Command |
+|-------|-----------------------------------------------------------------------|-----------------------------|
+| dr | Display drush help | drush |
+| drca | Clear all drupal caches. | drush cc all |
+| drcb | Clear block cache. | drush cc block |
+| drcg | Clear registry cache. | drush cc registry |
+| drcj | Clear css-js cache. | drush cc css-js |
+| drcm | Clear menu cache. | drush cc menu |
+| drcml | Clear module-list cache. | drush cc module-list |
+| drcr | Run all cron hooks in all active modules for specified site. | drush core-cron |
+| drct | Clear theme-registry cache. | drush cc theme-registry |
+| drcv | Clear views cache. (Make sure that the views module is enabled) | drush cc views |
+| drdmp | Backup database in a new dump.sql file | drush drush sql-dump --ordered-dump --result-file=dump.sql|
+| drf | Display features status | drush features |
+| drfr | Revert a feature module on your site. | drush features-revert -y |
+| drfu | Update a feature module on your site. | drush features-update -y |
+| drfra | Revert all enabled feature module on your site. | drush features-revert-all |
+| drif | Flush all derived images. | drush image-flush --all |
+| drpm | Show a list of available modules. | drush pm-list --type=module |
+| drst | Provides a birds-eye view of the current Drupal installation, if any. | drush core-status |
+| drup | Apply any database updates required (as with running update.php). | drush updatedb |
+| drups | List any pending database updates. | drush updatedb-status |
+| drv | Show drush version. | drush version |
+| drvd | Delete a variable. | drush variable-del |
+| drvg | Get a list of some or all site variables and values. | drush variable-get |
+| drvs | Set a variable. | drush variable-set |
+
+## Functions
+
+### dren
+Download and enable one or more extensions (modules or themes).
+Must be invoked with one or more parameters. e.g.:
+`dren devel` or `dren devel module_filter views`
+
+### drf
+Edit drushrc, site alias, and Drupal settings.php files.
+Can be invoked with one or without parameters. e.g.:
+`drf 1`
+
+### dris
+Disable one or more extensions (modules or themes)
+Must be invoked with one or more parameters. e.g.:
+`dris devel` or `dris devel module_filter views`
+
+### drpu
+Uninstall one or more modules.
+Must be invoked with one or more parameters. e.g.:
+`drpu devel` or `drpu devel module_filter views`
+
+### drnew
+Creates a brand new drupal website.
+Note: As soon as the installation is complete, drush will print a username and a random password into the terminal:
+```
+Installation complete. User name: admin User password: cf7t8yqNEm
+```
+
+## Additional features
+
+### Autocomplete
+The [completion script for drush](https://github.com/drush-ops/drush/blob/8.0.1/drush.complete.sh) comes enabled with this plugin.
+So, it is possible to type a command:
+```
+drush sql
+```
+
+And as soon as the tab key is pressed, the script will display the available commands:
+```
+drush sql
+sqlc sql-conf sql-create sql-dump sql-query sql-sanitize
+sql-cli sql-connect sql-drop sqlq sqlsan sql-sync
+```
diff --git a/plugins/drush/drush.complete.sh b/plugins/drush/drush.complete.sh
new file mode 100644
index 000000000..38b882ec3
--- /dev/null
+++ b/plugins/drush/drush.complete.sh
@@ -0,0 +1,50 @@
+# BASH completion script for Drush.
+#
+# Place this in your /etc/bash_completion.d/ directory or source it from your
+# ~/.bash_completion or ~/.bash_profile files. Alternatively, source
+# examples/example.bashrc instead, as it will automatically find and source
+# this file.
+#
+# If you're using ZSH instead of BASH, add the following to your ~/.zshrc file
+# and source it.
+#
+# autoload bashcompinit
+# bashcompinit
+# source /path/to/your/drush.complete.sh
+
+# Ensure drush is available.
+which drush > /dev/null || alias drush &> /dev/null || return
+
+__drush_ps1() {
+ f="${TMPDIR:-/tmp/}/drush-env-${USER}/drush-drupal-site-$$"
+ if [ -f $f ]
+ then
+ __DRUPAL_SITE=$(cat "$f")
+ else
+ __DRUPAL_SITE="$DRUPAL_SITE"
+ fi
+
+ # Set DRUSH_PS1_SHOWCOLORHINTS to a non-empty value and define a
+ # __drush_ps1_colorize_alias() function for color hints in your Drush PS1
+ # prompt. See example.prompt.sh for an example implementation.
+ if [ -n "${__DRUPAL_SITE-}" ] && [ -n "${DRUSH_PS1_SHOWCOLORHINTS-}" ]; then
+ __drush_ps1_colorize_alias
+ fi
+
+ [[ -n "$__DRUPAL_SITE" ]] && printf "${1:- (%s)}" "$__DRUPAL_SITE"
+}
+
+# Completion function, uses the "drush complete" command to retrieve
+# completions for a specific command line COMP_WORDS.
+_drush_completion() {
+ # Set IFS to newline (locally), since we only use newline separators, and
+ # need to retain spaces (or not) after completions.
+ local IFS=$'\n'
+ # The '< /dev/null' is a work around for a bug in php libedit stdin handling.
+ # Note that libedit in place of libreadline in some distributions. See:
+ # https://bugs.launchpad.net/ubuntu/+source/php5/+bug/322214
+ COMPREPLY=( $(drush --early=includes/complete.inc "${COMP_WORDS[@]}" < /dev/null 2> /dev/null) )
+}
+
+# Register our completion function. We include common short aliases for Drush.
+complete -o bashdefault -o default -o nospace -F _drush_completion d dr drush drush5 drush6 drush7 drush8 drush.php
diff --git a/plugins/drush/drush.plugin.zsh b/plugins/drush/drush.plugin.zsh
new file mode 100644
index 000000000..8a20d79f2
--- /dev/null
+++ b/plugins/drush/drush.plugin.zsh
@@ -0,0 +1,104 @@
+# Drush support.
+
+function dren() {
+ drush en $@ -y
+}
+
+function dris() {
+ drush pm-disable $@ -y
+}
+
+function drpu() {
+ drush pm-uninstall $@ -y
+}
+
+function drf() {
+ if [[ $1 == "" ]] then
+ drush core-config
+ else
+ drush core-config --choice=$1
+ fi
+}
+
+function drfi() {
+ if [[ $1 == "fields" ]]; then
+ drush field-info fields
+ elif [[ $1 == "types" ]]; then
+ drush field-info types
+ else
+ drush field-info
+ fi
+}
+
+function drnew() {
+
+ cd ~
+ echo "Website's name: "
+ read WEBSITE_NAME
+
+ HOST=http://$(hostname -i)/
+
+ if [[ $WEBSITE_NAME == "" ]] then
+ MINUTES=$(date +%M:%S)
+ WEBSITE_NAME="Drupal-$MINUTES"
+ echo "Your website will be named: $WEBSITE_NAME"
+ fi
+
+ drush dl drupal --drupal-project-rename=$WEBSITE_NAME
+
+ echo "Type your localhost directory: (Leave empty for /var/www/html/)"
+ read DIRECTORY
+
+ if [[ $DIRECTORY == "" ]] then
+ DIRECTORY="/var/www/html/"
+ fi
+
+ echo "Moving to $DIRECTORY$WEBSITE_NAME"
+ sudo mv $WEBSITE_NAME $DIRECTORY
+ cd $DIRECTORY$WEBSITE_NAME
+
+ echo "Database's user: "
+ read DATABASE_USR
+ echo "Database's password: "
+ read -s DATABASE_PWD
+ echo "Database's name for your project: "
+ read DATABASE
+
+ DB_URL="mysql://$DATABASE_USR:$DATABASE_PWD@localhost/$DATABASE"
+ drush site-install standard --db-url=$DB_URL --site-name=$WEBSITE_NAME
+
+ open_command $HOST$WEBSITE_NAME
+ echo "Done"
+
+}
+
+# Aliases, sorted alphabetically.
+alias dr="drush"
+alias drca="drush cc all" # Deprecated for Drush 8
+alias drcb="drush cc block" # Deprecated for Drush 8
+alias drcg="drush cc registry" # Deprecated for Drush 8
+alias drcj="drush cc css-js"
+alias drcm="drush cc menu"
+alias drcml="drush cc module-list"
+alias drcr="drush core-cron"
+alias drct="drush cc theme-registry"
+alias drcv="drush cc views"
+alias drdmp="drush sql-dump --ordered-dump --result-file=dump.sql"
+alias drf="drush features"
+alias drfr="drush features-revert -y"
+alias drfu="drush features-update -y"
+alias drfra="drush features-revert-all"
+alias drif="drush image-flush --all"
+alias drpm="drush pm-list --type=module"
+alias drst="drush core-status"
+alias drup="drush updatedb"
+alias drups="drush updatedb-status"
+alias drv="drush version"
+alias drvd="drush variable-del"
+alias drvg="drush variable-get"
+alias drvs="drush variable-set"
+
+# Enable drush autocomplete support
+autoload bashcompinit
+bashcompinit
+source $(dirname $0)/drush.complete.sh
diff --git a/plugins/fancy-ctrl-z/README.md b/plugins/fancy-ctrl-z/README.md
index a7670fa2c..f1b1dfa5c 100644
--- a/plugins/fancy-ctrl-z/README.md
+++ b/plugins/fancy-ctrl-z/README.md
@@ -1,10 +1,10 @@
# Use Ctrl-Z to switch back to Vim
-I frequently need to execute random command in my shell. To achieve it I pause
+I frequently need to execute random commands in my shell. To achieve it I pause
Vim by pressing Ctrl-z, type command and press fg<Enter> to switch back to Vim.
-The fg part really hurt sme. I just wanted to hit Ctrl-z once again to get back
+The fg part really hurts me. I just wanted to hit Ctrl-z once again to get back
to Vim. I could not find a solution, so I developed one on my own that
-works wonderfully with ZSH
+works wonderfully with ZSH.
Source: http://sheerun.net/2014/03/21/how-to-boost-your-vim-productivity/
diff --git a/plugins/fd/README.md b/plugins/fd/README.md
new file mode 100644
index 000000000..aabd624b8
--- /dev/null
+++ b/plugins/fd/README.md
@@ -0,0 +1,13 @@
+# fd
+
+This plugin adds completion for the file search tool [`fd`](https://github.com/sharkdp/fd), also known as `fd-find`.
+
+To use it, add `fd` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... fd)
+```
+
+Completion is taken from the fd release [`7.3.0`](https://github.com/sharkdp/fd/releases/tag/v7.3.0).
+
+Updated on Febrary 13th, 2019.
diff --git a/plugins/fd/_fd b/plugins/fd/_fd
new file mode 100644
index 000000000..7a4c38753
--- /dev/null
+++ b/plugins/fd/_fd
@@ -0,0 +1,83 @@
+#compdef fd fdfind
+
+autoload -U is-at-least
+
+_fd() {
+ typeset -A opt_args
+ typeset -a _arguments_options
+ local ret=1
+
+ if is-at-least 5.2; then
+ _arguments_options=(-s -S -C)
+ else
+ _arguments_options=(-s -C)
+ fi
+
+ local context curcontext="$curcontext" state line
+ _arguments "${_arguments_options[@]}" \
+'-d+[Set maximum search depth (default: none)]' \
+'--max-depth=[Set maximum search depth (default: none)]' \
+'--maxdepth=[See --max-depth]' \
+'*-t+[Filter by type: file (f), directory (d), symlink (l),
+executable (x), empty (e)]: :(f file d directory l symlink x executable e empty)' \
+'*--type=[Filter by type: file (f), directory (d), symlink (l),
+executable (x), empty (e)]: :(f file d directory l symlink x executable e empty)' \
+'*-e+[Filter by file extension]' \
+'*--extension=[Filter by file extension]' \
+'-x+[Execute a command for each search result]' \
+'--exec=[Execute a command for each search result]' \
+'(-x --exec)-X+[Execute a command with all search results at once]' \
+'(-x --exec)--exec-batch=[Execute a command with all search results at once]' \
+'*-E+[Exclude entries that match the given glob pattern]' \
+'*--exclude=[Exclude entries that match the given glob pattern]' \
+'*--ignore-file=[Add a custom ignore-file in .gitignore format]' \
+'-c+[When to use colors: never, *auto*, always]: :(never auto always)' \
+'--color=[When to use colors: never, *auto*, always]: :(never auto always)' \
+'-j+[Set number of threads to use for searching & executing]' \
+'--threads=[Set number of threads to use for searching & executing]' \
+'*-S+[Limit results based on the size of files.]' \
+'*--size=[Limit results based on the size of files.]' \
+'--max-buffer-time=[the time (in ms) to buffer, before streaming to the console]' \
+'--changed-within=[Filter by file modification time (newer than)]' \
+'--changed-before=[Filter by file modification time (older than)]' \
+'*--search-path=[(hidden)]' \
+'-H[Search hidden files and directories]' \
+'--hidden[Search hidden files and directories]' \
+'-I[Do not respect .(git|fd)ignore files]' \
+'--no-ignore[Do not respect .(git|fd)ignore files]' \
+'--no-ignore-vcs[Do not respect .gitignore files]' \
+'*-u[Alias for no-ignore and/or hidden]' \
+'-s[Case-sensitive search (default: smart case)]' \
+'--case-sensitive[Case-sensitive search (default: smart case)]' \
+'-i[Case-insensitive search (default: smart case)]' \
+'--ignore-case[Case-insensitive search (default: smart case)]' \
+'-F[Treat the pattern as a literal string]' \
+'--fixed-strings[Treat the pattern as a literal string]' \
+'-a[Show absolute instead of relative paths]' \
+'--absolute-path[Show absolute instead of relative paths]' \
+'-L[Follow symbolic links]' \
+'--follow[Follow symbolic links]' \
+'-p[Search full path (default: file-/dirname only)]' \
+'--full-path[Search full path (default: file-/dirname only)]' \
+'-0[Separate results by the null character]' \
+'--print0[Separate results by the null character]' \
+'--show-errors[Enable display of filesystem errors]' \
+'-h[Prints help information]' \
+'--help[Prints help information]' \
+'-V[Prints version information]' \
+'--version[Prints version information]' \
+'::pattern -- the search pattern, a regular expression (optional):_files' \
+'::path -- the root directory for the filesystem search (optional):_files' \
+&& ret=0
+
+}
+
+(( $+functions[_fd_commands] )) ||
+_fd_commands() {
+ local commands; commands=(
+
+ )
+ _describe -t commands 'fd commands' commands "$@"
+}
+
+_fd "$@"
diff --git a/plugins/git-prompt/gitstatus.py b/plugins/git-prompt/gitstatus.py
index a4d07cde6..5243af23c 100644
--- a/plugins/git-prompt/gitstatus.py
+++ b/plugins/git-prompt/gitstatus.py
@@ -30,7 +30,7 @@ def get_tagname_or_hash():
# `git status --porcelain --branch` can collect all information
# branch, remote_branch, untracked, staged, changed, conflicts, ahead, behind
-po = Popen(['git', 'status', '--porcelain', '--branch'], stdout=PIPE, stderr=PIPE)
+po = Popen(['git', 'status', '--porcelain', '--branch'], env={"LANG": "C"}, stdout=PIPE, stderr=PIPE)
stdout, sterr = po.communicate()
if po.returncode != 0:
sys.exit(0) # Not a git repository
diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh
index fa2487a2c..344419f1e 100644
--- a/plugins/git/git.plugin.zsh
+++ b/plugins/git/git.plugin.zsh
@@ -73,7 +73,7 @@ alias gcsm='git commit -s -m'
alias gcb='git checkout -b'
alias gcf='git config --list'
alias gcl='git clone --recurse-submodules'
-alias gclean='git clean -fd'
+alias gclean='git clean -id'
alias gpristine='git reset --hard && git clean -dfx'
alias gcm='git checkout master'
alias gcd='git checkout develop'
@@ -112,8 +112,8 @@ ggf() {
git push --force origin "${b:=$1}"
}
ggfl() {
-[[ "$#" != 1 ]] && local b="$(git_current_branch)"
-git push --force-with-lease origin "${b:=$1}"
+ [[ "$#" != 1 ]] && local b="$(git_current_branch)"
+ git push --force-with-lease origin "${b:=$1}"
}
compdef _git ggf=git-checkout
@@ -220,12 +220,13 @@ alias grbm='git rebase master'
alias grbs='git rebase --skip'
alias grh='git reset'
alias grhh='git reset --hard'
+alias groh='git reset origin/$(git_current_branch) --hard'
alias grm='git rm'
alias grmc='git rm --cached'
alias grmv='git remote rename'
alias grrm='git remote remove'
alias grset='git remote set-url'
-alias grt='cd $(git rev-parse --show-toplevel || echo ".")'
+alias grt='cd "$(git rev-parse --show-toplevel || echo .)"'
alias gru='git reset --'
alias grup='git remote update'
alias grv='git remote -v'
@@ -255,6 +256,7 @@ alias gsu='git submodule update'
alias gts='git tag -s'
alias gtv='git tag | sort -V'
+alias gtl='gtl(){ git tag --sort=-v:refname -n -l ${1}* }; noglob gtl'
alias gunignore='git update-index --no-assume-unchanged'
alias gunwip='git log -n 1 | grep -q -c "\-\-wip\-\-" && git reset HEAD~1'
@@ -265,4 +267,4 @@ alias gupav='git pull --rebase --autostash -v'
alias glum='git pull upstream master'
alias gwch='git whatchanged -p --abbrev-commit --pretty=medium'
-alias gwip='git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify -m "--wip-- [skip ci]"'
+alias gwip='git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign -m "--wip-- [skip ci]"'
diff --git a/plugins/gitfast/README.md b/plugins/gitfast/README.md
index c3073709e..84e35d77c 100644
--- a/plugins/gitfast/README.md
+++ b/plugins/gitfast/README.md
@@ -10,129 +10,6 @@ plugins=(... gitfast)
## Aliases
-| Alias | Command |
-| -------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
-| g | `git` |
-| ga | `git add` |
-| gaa | `git add --all` |
-| gapa | `git add --patch` |
-| gau | `git add --update` |
-| gb | `git branch` |
-| gba | `git branch -a` |
-| gbd | `git branch -d` |
-| gbda | `git branch --no-color --merged | command grep -vE "^(\*|\s*(master|develop|dev)\s*$)" | command xargs -n 1 git branch -d` |
-| gbl | `git blame -b -w` |
-| gbnm | `git branch --no-merged` |
-| gbr | `git branch --remote` |
-| gbs | `git bisect` |
-| gbsb | `git bisect bad` |
-| gbsg | `git bisect good` |
-| gbsr | `git bisect reset` |
-| gbss | `git bisect start` |
-| gc | `git commit -v` |
-| gc! | `git commit -v --amend` |
-| gca | `git commit -v -a` |
-| gca! | `git commit -v -a --amend` |
-| gcam | `git commit -a -m` |
-| gcan! | `git commit -v -a --no-edit --amend` |
-| gcans! | `git commit -v -a -s --no-edit --amend` |
-| gcb | `git checkout -b` |
-| gcd | `git checkout develop` |
-| gcf | `git config --list` |
-| gcl | `git clone --recursive` |
-| gclean | `git clean -fd` |
-| gcm | `git checkout master` |
-| gcmsg | `git commit -m` |
-| gcn! | `git commit -v --no-edit --amend` |
-| gco | `git checkout` |
-| gcount | `git shortlog -sn` |
-| gcp | `git cherry-pick` |
-| gcpa | `git cherry-pick --abort` |
-| gcpc | `git cherry-pick --continue` |
-| gcs | `git commit -S` |
-| gcsm | `git commit -s -m` |
-| gd | `git diff` |
-| gdca | `git diff --cached` |
-| gdct | `` git describe --tags `git rev-list --tags --max-count=1` `` |
-| gdt | `git diff-tree --no-commit-id --name-only -r` |
-| gdw | `git diff --word-diff` |
-| gf | `git fetch` |
-| gfa | `git fetch --all --prune` |
-| gfo | `git fetch origin` |
-| gg | `git gui citool` |
-| gga | `git gui citool --amend` |
-| ggpull | `git pull origin $(git_current_branch)` |
-| ggpur | `ggu` |
-| ggpush | `git push origin $(git_current_branch)` |
-| ggsup | `git branch --set-upstream-to=origin/$(git_current_branch)` |
-| ghh | `git help` |
-| gignore | `git update-index --assume-unchanged` |
-| gignored | `git ls-files -v | grep "^[[:lower:]]"` |
-| git-svn-dcommit-push | `git svn dcommit && git push github master:svntrunk` |
-| gk | `\gitk --all --branches` |
-| gke | `\gitk --all $(git log -g --pretty=%h)` |
-| gl | `git pull` |
-| glg | `git log --stat` |
-| glgg | `git log --graph` |
-| glgga | `git log --graph --decorate --all` |
-| glgm | `git log --graph --max-count=10` |
-| glgp | `git log --stat -p` |
-| glo | `git log --oneline --decorate` |
-| glog | `git log --oneline --decorate --graph` |
-| gloga | `git log --oneline --decorate --graph --all` |
-| glol | `git log --graph --pretty='\''%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'\'' --abbrev-commit` |
-| glola | `git log --graph --pretty='\''%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'\'' --abbrev-commit --all` |
-| glp | `_git_log_prettily` |
-| glum | `git pull upstream master` |
-| gm | `git merge` |
-| gmom | `git merge origin/master` |
-| gmt | `git mergetool --no-prompt` |
-| gmtvim | `git mergetool --no-prompt --tool=vimdiff` |
-| gmum | `git merge upstream/master` |
-| gp | `git push` |
-| gpd | `git push --dry-run` |
-| gpoat | `git push origin --all && git push origin --tags` |
-| gpristine | `git reset --hard && git clean -dfx` |
-| gpsup | `git push --set-upstream origin $(git_current_branch)` |
-| gpu | `git push upstream` |
-| gpv | `git push -v` |
-| gr | `git remote` |
-| gra | `git remote add` |
-| grb | `git rebase` |
-| grba | `git rebase --abort` |
-| grbc | `git rebase --continue` |
-| grbi | `git rebase -i` |
-| grbm | `git rebase master` |
-| grbs | `git rebase --skip` |
-| grh | `git reset HEAD` |
-| grhh | `git reset HEAD --hard` |
-| grmv | `git remote rename` |
-| grrm | `git remote remove` |
-| grset | `git remote set-url` |
-| grt | `cd $(git rev-parse --show-toplevel || echo ".")` |
-| gru | `git reset --` |
-| grup | `git remote update` |
-| grv | `git remote -v` |
-| gsb | `git status -sb` |
-| gsd | `git svn dcommit` |
-| gsi | `git submodule init` |
-| gsps | `git show --pretty=short --show-signature` |
-| gsr | `git svn rebase` |
-| gss | `git status -s` |
-| gst | `git status` |
-| gsta | `git stash save` |
-| gstaa | `git stash apply` |
-| gstc | `git stash clear` |
-| gstd | `git stash drop` |
-| gstl | `git stash list` |
-| gstp | `git stash pop` |
-| gsts | `git stash show --text` |
-| gsu | `git submodule update` |
-| gts | `git tag -s` |
-| gtv | `git tag | sort -V` |
-| gunignore | `git update-index --no-assume-unchanged` |
-| gunwip | `git log -n 1 | grep -q -c "\-\-wip\-\-" && git reset HEAD~1` |
-| gup | `git pull --rebase` |
-| gupv | `git pull --rebase -v` |
-| gwch | `git whatchanged -p --abbrev-commit --pretty=medium` |
-| gwip | `git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify -m "--wip-- [skip ci]"` |
+An earlier version of the plugin also loaded the git plugin. If you want to keep those
+aliases enable the [git plugin](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/git)
+as well.
diff --git a/plugins/gitfast/_git b/plugins/gitfast/_git
index 6d1b4ecc7..78a6dbb3d 100644
--- a/plugins/gitfast/_git
+++ b/plugins/gitfast/_git
@@ -9,7 +9,7 @@
#
# If your script is somewhere else, you can configure it on your ~/.zshrc:
#
-# zstyle ':completion:*:*:git:*' script ~/.git-completion.sh
+# zstyle ':completion:*:*:git:*' script ~/.git-completion.zsh
#
# The recommended way to install this script is to copy to '~/.zsh/_git', and
# then add the following to your ~/.zshrc file:
@@ -67,6 +67,15 @@ __gitcomp ()
esac
}
+__gitcomp_direct ()
+{
+ emulate -L zsh
+
+ local IFS=$'\n'
+ compset -P '*[=:]'
+ compadd -Q -- ${=1} && _ret=0
+}
+
__gitcomp_nl ()
{
emulate -L zsh
diff --git a/plugins/gitfast/git-completion.bash b/plugins/gitfast/git-completion.bash
index 8ce6b5c5f..d93441747 100644
--- a/plugins/gitfast/git-completion.bash
+++ b/plugins/gitfast/git-completion.bash
@@ -28,27 +28,55 @@
# completion style. For example '!f() { : git commit ; ... }; f' will
# tell the completion to use commit completion. This also works with aliases
# of form "!sh -c '...'". For example, "!sh -c ': git commit ; ... '".
+#
+# You can set the following environment variables to influence the behavior of
+# the completion routines:
+#
+# GIT_COMPLETION_CHECKOUT_NO_GUESS
+#
+# When set to "1", do not include "DWIM" suggestions in git-checkout
+# completion (e.g., completing "foo" when "origin/foo" exists).
case "$COMP_WORDBREAKS" in
*:*) : great ;;
*) COMP_WORDBREAKS="$COMP_WORDBREAKS:"
esac
+# Discovers the path to the git repository taking any '--git-dir=<path>' and
+# '-C <path>' options into account and stores it in the $__git_repo_path
+# variable.
+__git_find_repo_path ()
+{
+ if [ -n "$__git_repo_path" ]; then
+ # we already know where it is
+ return
+ fi
+
+ if [ -n "${__git_C_args-}" ]; then
+ __git_repo_path="$(git "${__git_C_args[@]}" \
+ ${__git_dir:+--git-dir="$__git_dir"} \
+ rev-parse --absolute-git-dir 2>/dev/null)"
+ elif [ -n "${__git_dir-}" ]; then
+ test -d "$__git_dir" &&
+ __git_repo_path="$__git_dir"
+ elif [ -n "${GIT_DIR-}" ]; then
+ test -d "${GIT_DIR-}" &&
+ __git_repo_path="$GIT_DIR"
+ elif [ -d .git ]; then
+ __git_repo_path=.git
+ else
+ __git_repo_path="$(git rev-parse --git-dir 2>/dev/null)"
+ fi
+}
+
+# Deprecated: use __git_find_repo_path() and $__git_repo_path instead
# __gitdir accepts 0 or 1 arguments (i.e., location)
# returns location of .git repo
__gitdir ()
{
if [ -z "${1-}" ]; then
- if [ -n "${__git_dir-}" ]; then
- echo "$__git_dir"
- elif [ -n "${GIT_DIR-}" ]; then
- test -d "${GIT_DIR-}" || return 1
- echo "$GIT_DIR"
- elif [ -d .git ]; then
- echo .git
- else
- git rev-parse --git-dir 2>/dev/null
- fi
+ __git_find_repo_path || return 1
+ echo "$__git_repo_path"
elif [ -d "$1/.git" ]; then
echo "$1/.git"
else
@@ -56,6 +84,14 @@ __gitdir ()
fi
}
+# Runs git with all the options given as argument, respecting any
+# '--git-dir=<path>' and '-C <path>' options present on the command line
+__git ()
+{
+ git ${__git_C_args:+"${__git_C_args[@]}"} \
+ ${__git_dir:+--git-dir="$__git_dir"} "$@" 2>/dev/null
+}
+
# The following function is based on code from:
#
# bash_completion - programmable completion functions for bash 3.2+
@@ -185,6 +221,20 @@ _get_comp_words_by_ref ()
}
fi
+# Fills the COMPREPLY array with prefiltered words without any additional
+# processing.
+# Callers must take care of providing only words that match the current word
+# to be completed and adding any prefix and/or suffix (trailing space!), if
+# necessary.
+# 1: List of newline-separated matching completion words, complete with
+# prefix and suffix.
+__gitcomp_direct ()
+{
+ local IFS=$'\n'
+
+ COMPREPLY=($1)
+}
+
__gitcompappend ()
{
local x i=${#COMPREPLY[@]}
@@ -283,11 +333,11 @@ __gitcomp_file ()
__git_ls_files_helper ()
{
if [ "$2" == "--committable" ]; then
- git -C "$1" diff-index --name-only --relative HEAD
+ __git -C "$1" diff-index --name-only --relative HEAD
else
# NOTE: $2 is not quoted in order to support multiple options
- git -C "$1" ls-files --exclude-standard $2
- fi 2>/dev/null
+ __git -C "$1" ls-files --exclude-standard $2
+ fi
}
@@ -299,99 +349,195 @@ __git_ls_files_helper ()
# slash.
__git_index_files ()
{
- local dir="$(__gitdir)" root="${2-.}" file
+ local root="${2-.}" file
- if [ -d "$dir" ]; then
- __git_ls_files_helper "$root" "$1" |
- while read -r file; do
- case "$file" in
- ?*/*) echo "${file%%/*}" ;;
- *) echo "$file" ;;
- esac
- done | sort | uniq
- fi
+ __git_ls_files_helper "$root" "$1" |
+ while read -r file; do
+ case "$file" in
+ ?*/*) echo "${file%%/*}" ;;
+ *) echo "$file" ;;
+ esac
+ done | sort | uniq
}
+# Lists branches from the local repository.
+# 1: A prefix to be added to each listed branch (optional).
+# 2: List only branches matching this word (optional; list all branches if
+# unset or empty).
+# 3: A suffix to be appended to each listed branch (optional).
__git_heads ()
{
- local dir="$(__gitdir)"
- if [ -d "$dir" ]; then
- git --git-dir="$dir" for-each-ref --format='%(refname:short)' \
- refs/heads
- return
- fi
+ local pfx="${1-}" cur_="${2-}" sfx="${3-}"
+
+ __git for-each-ref --format="${pfx//\%/%%}%(refname:strip=2)$sfx" \
+ "refs/heads/$cur_*" "refs/heads/$cur_*/**"
}
+# Lists tags from the local repository.
+# Accepts the same positional parameters as __git_heads() above.
__git_tags ()
{
- local dir="$(__gitdir)"
- if [ -d "$dir" ]; then
- git --git-dir="$dir" for-each-ref --format='%(refname:short)' \
- refs/tags
- return
- fi
+ local pfx="${1-}" cur_="${2-}" sfx="${3-}"
+
+ __git for-each-ref --format="${pfx//\%/%%}%(refname:strip=2)$sfx" \
+ "refs/tags/$cur_*" "refs/tags/$cur_*/**"
}
-# __git_refs accepts 0, 1 (to pass to __gitdir), or 2 arguments
-# presence of 2nd argument means use the guess heuristic employed
-# by checkout for tracking branches
+# Lists refs from the local (by default) or from a remote repository.
+# It accepts 0, 1 or 2 arguments:
+# 1: The remote to list refs from (optional; ignored, if set but empty).
+# Can be the name of a configured remote, a path, or a URL.
+# 2: In addition to local refs, list unique branches from refs/remotes/ for
+# 'git checkout's tracking DWIMery (optional; ignored, if set but empty).
+# 3: A prefix to be added to each listed ref (optional).
+# 4: List only refs matching this word (optional; list all refs if unset or
+# empty).
+# 5: A suffix to be appended to each listed ref (optional; ignored, if set
+# but empty).
+#
+# Use __git_complete_refs() instead.
__git_refs ()
{
- local i hash dir="$(__gitdir "${1-}")" track="${2-}"
+ local i hash dir track="${2-}"
+ local list_refs_from=path remote="${1-}"
local format refs
- if [ -d "$dir" ]; then
- case "$cur" in
+ local pfx="${3-}" cur_="${4-$cur}" sfx="${5-}"
+ local match="${4-}"
+ local fer_pfx="${pfx//\%/%%}" # "escape" for-each-ref format specifiers
+
+ __git_find_repo_path
+ dir="$__git_repo_path"
+
+ if [ -z "$remote" ]; then
+ if [ -z "$dir" ]; then
+ return
+ fi
+ else
+ if __git_is_configured_remote "$remote"; then
+ # configured remote takes precedence over a
+ # local directory with the same name
+ list_refs_from=remote
+ elif [ -d "$remote/.git" ]; then
+ dir="$remote/.git"
+ elif [ -d "$remote" ]; then
+ dir="$remote"
+ else
+ list_refs_from=url
+ fi
+ fi
+
+ if [ "$list_refs_from" = path ]; then
+ if [[ "$cur_" == ^* ]]; then
+ pfx="$pfx^"
+ fer_pfx="$fer_pfx^"
+ cur_=${cur_#^}
+ match=${match#^}
+ fi
+ case "$cur_" in
refs|refs/*)
format="refname"
- refs="${cur%/*}"
+ refs=("$match*" "$match*/**")
track=""
;;
*)
for i in HEAD FETCH_HEAD ORIG_HEAD MERGE_HEAD; do
- if [ -e "$dir/$i" ]; then echo $i; fi
+ case "$i" in
+ $match*)
+ if [ -e "$dir/$i" ]; then
+ echo "$pfx$i$sfx"
+ fi
+ ;;
+ esac
done
- format="refname:short"
- refs="refs/tags refs/heads refs/remotes"
+ format="refname:strip=2"
+ refs=("refs/tags/$match*" "refs/tags/$match*/**"
+ "refs/heads/$match*" "refs/heads/$match*/**"
+ "refs/remotes/$match*" "refs/remotes/$match*/**")
;;
esac
- git --git-dir="$dir" for-each-ref --format="%($format)" \
- $refs
+ __git_dir="$dir" __git for-each-ref --format="$fer_pfx%($format)$sfx" \
+ "${refs[@]}"
if [ -n "$track" ]; then
# employ the heuristic used by git checkout
# Try to find a remote branch that matches the completion word
# but only output if the branch name is unique
- local ref entry
- git --git-dir="$dir" for-each-ref --shell --format="ref=%(refname:short)" \
- "refs/remotes/" | \
- while read -r entry; do
- eval "$entry"
- ref="${ref#*/}"
- if [[ "$ref" == "$cur"* ]]; then
- echo "$ref"
- fi
- done | sort | uniq -u
+ __git for-each-ref --format="$fer_pfx%(refname:strip=3)$sfx" \
+ --sort="refname:strip=3" \
+ "refs/remotes/*/$match*" "refs/remotes/*/$match*/**" | \
+ uniq -u
fi
return
fi
- case "$cur" in
+ case "$cur_" in
refs|refs/*)
- git ls-remote "$dir" "$cur*" 2>/dev/null | \
+ __git ls-remote "$remote" "$match*" | \
while read -r hash i; do
case "$i" in
*^{}) ;;
- *) echo "$i" ;;
+ *) echo "$pfx$i$sfx" ;;
esac
done
;;
*)
- echo "HEAD"
- git for-each-ref --format="%(refname:short)" -- \
- "refs/remotes/$dir/" 2>/dev/null | sed -e "s#^$dir/##"
+ if [ "$list_refs_from" = remote ]; then
+ case "HEAD" in
+ $match*) echo "${pfx}HEAD$sfx" ;;
+ esac
+ __git for-each-ref --format="$fer_pfx%(refname:strip=3)$sfx" \
+ "refs/remotes/$remote/$match*" \
+ "refs/remotes/$remote/$match*/**"
+ else
+ local query_symref
+ case "HEAD" in
+ $match*) query_symref="HEAD" ;;
+ esac
+ __git ls-remote "$remote" $query_symref \
+ "refs/tags/$match*" "refs/heads/$match*" \
+ "refs/remotes/$match*" |
+ while read -r hash i; do
+ case "$i" in
+ *^{}) ;;
+ refs/*) echo "$pfx${i#refs/*/}$sfx" ;;
+ *) echo "$pfx$i$sfx" ;; # symbolic refs
+ esac
+ done
+ fi
;;
esac
}
+# Completes refs, short and long, local and remote, symbolic and pseudo.
+#
+# Usage: __git_complete_refs [<option>]...
+# --remote=<remote>: The remote to list refs from, can be the name of a
+# configured remote, a path, or a URL.
+# --track: List unique remote branches for 'git checkout's tracking DWIMery.
+# --pfx=<prefix>: A prefix to be added to each ref.
+# --cur=<word>: The current ref to be completed. Defaults to the current
+# word to be completed.
+# --sfx=<suffix>: A suffix to be appended to each ref instead of the default
+# space.
+__git_complete_refs ()
+{
+ local remote track pfx cur_="$cur" sfx=" "
+
+ while test $# != 0; do
+ case "$1" in
+ --remote=*) remote="${1##--remote=}" ;;
+ --track) track="yes" ;;
+ --pfx=*) pfx="${1##--pfx=}" ;;
+ --cur=*) cur_="${1##--cur=}" ;;
+ --sfx=*) sfx="${1##--sfx=}" ;;
+ *) return 1 ;;
+ esac
+ shift
+ done
+
+ __gitcomp_direct "$(__git_refs "$remote" "$track" "$pfx" "$cur_" "$sfx")"
+}
+
# __git_refs2 requires 1 argument (to pass to __git_refs)
+# Deprecated: use __git_complete_fetch_refspecs() instead.
__git_refs2 ()
{
local i
@@ -400,11 +546,29 @@ __git_refs2 ()
done
}
+# Completes refspecs for fetching from a remote repository.
+# 1: The remote repository.
+# 2: A prefix to be added to each listed refspec (optional).
+# 3: The ref to be completed as a refspec instead of the current word to be
+# completed (optional)
+# 4: A suffix to be appended to each listed refspec instead of the default
+# space (optional).
+__git_complete_fetch_refspecs ()
+{
+ local i remote="$1" pfx="${2-}" cur_="${3-$cur}" sfx="${4- }"
+
+ __gitcomp_direct "$(
+ for i in $(__git_refs "$remote" "" "" "$cur_") ; do
+ echo "$pfx$i:$i$sfx"
+ done
+ )"
+}
+
# __git_refs_remotes requires 1 argument (to pass to ls-remote)
__git_refs_remotes ()
{
local i hash
- git ls-remote "$1" 'refs/heads/*' 2>/dev/null | \
+ __git ls-remote "$1" 'refs/heads/*' | \
while read -r hash i; do
echo "$i:refs/remotes/$1/${i#refs/heads/}"
done
@@ -412,9 +576,21 @@ __git_refs_remotes ()
__git_remotes ()
{
- local d="$(__gitdir)"
- test -d "$d/remotes" && ls -1 "$d/remotes"
- git --git-dir="$d" remote
+ __git_find_repo_path
+ test -d "$__git_repo_path/remotes" && ls -1 "$__git_repo_path/remotes"
+ __git remote
+}
+
+# Returns true if $1 matches the name of a configured remote, false otherwise.
+__git_is_configured_remote ()
+{
+ local remote
+ for remote in $(__git_remotes); do
+ if [ "$remote" = "$1" ]; then
+ return 0
+ fi
+ done
+ return 1
}
__git_list_merge_strategies ()
@@ -468,7 +644,7 @@ __git_complete_revlist_file ()
*) pfx="$ref:$pfx" ;;
esac
- __gitcomp_nl "$(git --git-dir="$(__gitdir)" ls-tree "$ls" 2>/dev/null \
+ __gitcomp_nl "$(__git ls-tree "$ls" \
| sed '/^100... blob /{
s,^.* ,,
s,$, ,
@@ -487,15 +663,15 @@ __git_complete_revlist_file ()
*...*)
pfx="${cur_%...*}..."
cur_="${cur_#*...}"
- __gitcomp_nl "$(__git_refs)" "$pfx" "$cur_"
+ __git_complete_refs --pfx="$pfx" --cur="$cur_"
;;
*..*)
pfx="${cur_%..*}.."
cur_="${cur_#*..}"
- __gitcomp_nl "$(__git_refs)" "$pfx" "$cur_"
+ __git_complete_refs --pfx="$pfx" --cur="$cur_"
;;
*)
- __gitcomp_nl "$(__git_refs)"
+ __git_complete_refs
;;
esac
}
@@ -541,6 +717,7 @@ __git_complete_remote_or_refspec ()
i="${words[c]}"
case "$i" in
--mirror) [ "$cmd" = "push" ] && no_complete_refspec=1 ;;
+ -d|--delete) [ "$cmd" = "push" ] && lhs=0 ;;
--all)
case "$cmd" in
push) no_complete_refspec=1 ;;
@@ -580,23 +757,23 @@ __git_complete_remote_or_refspec ()
case "$cmd" in
fetch)
if [ $lhs = 1 ]; then
- __gitcomp_nl "$(__git_refs2 "$remote")" "$pfx" "$cur_"
+ __git_complete_fetch_refspecs "$remote" "$pfx" "$cur_"
else
- __gitcomp_nl "$(__git_refs)" "$pfx" "$cur_"
+ __git_complete_refs --pfx="$pfx" --cur="$cur_"
fi
;;
pull|remote)
if [ $lhs = 1 ]; then
- __gitcomp_nl "$(__git_refs "$remote")" "$pfx" "$cur_"
+ __git_complete_refs --remote="$remote" --pfx="$pfx" --cur="$cur_"
else
- __gitcomp_nl "$(__git_refs)" "$pfx" "$cur_"
+ __git_complete_refs --pfx="$pfx" --cur="$cur_"
fi
;;
push)
if [ $lhs = 1 ]; then
- __gitcomp_nl "$(__git_refs)" "$pfx" "$cur_"
+ __git_complete_refs --pfx="$pfx" --cur="$cur_"
else
- __gitcomp_nl "$(__git_refs "$remote")" "$pfx" "$cur_"
+ __git_complete_refs --remote="$remote" --pfx="$pfx" --cur="$cur_"
fi
;;
esac
@@ -746,7 +923,7 @@ __git_compute_porcelain_commands ()
__git_get_config_variables ()
{
local section="$1" i IFS=$'\n'
- for i in $(git --git-dir="$(__gitdir)" config --name-only --get-regexp "^$section\..*" 2>/dev/null); do
+ for i in $(__git config --name-only --get-regexp "^$section\..*"); do
echo "${i#$section.}"
done
}
@@ -764,8 +941,7 @@ __git_aliases ()
# __git_aliased_command requires 1 argument
__git_aliased_command ()
{
- local word cmdline=$(git --git-dir="$(__gitdir)" \
- config --get "alias.$1")
+ local word cmdline=$(__git config --get "alias.$1")
for word in $cmdline; do
case "$word" in
\!gitk|gitk)
@@ -803,6 +979,50 @@ __git_find_on_cmdline ()
done
}
+# Echo the value of an option set on the command line or config
+#
+# $1: short option name
+# $2: long option name including =
+# $3: list of possible values
+# $4: config string (optional)
+#
+# example:
+# result="$(__git_get_option_value "-d" "--do-something=" \
+# "yes no" "core.doSomething")"
+#
+# result is then either empty (no option set) or "yes" or "no"
+#
+# __git_get_option_value requires 3 arguments
+__git_get_option_value ()
+{
+ local c short_opt long_opt val
+ local result= values config_key word
+
+ short_opt="$1"
+ long_opt="$2"
+ values="$3"
+ config_key="$4"
+
+ ((c = $cword - 1))
+ while [ $c -ge 0 ]; do
+ word="${words[c]}"
+ for val in $values; do
+ if [ "$short_opt$val" = "$word" ] ||
+ [ "$long_opt$val" = "$word" ]; then
+ result="$val"
+ break 2
+ fi
+ done
+ ((c--))
+ done
+
+ if [ -n "$config_key" ] && [ -z "$result" ]; then
+ result="$(__git config "$config_key")"
+ fi
+
+ echo "$result"
+}
+
__git_has_doubledash ()
{
local c=1
@@ -856,8 +1076,8 @@ __git_whitespacelist="nowarn warn error error-all fix"
_git_am ()
{
- local dir="$(__gitdir)"
- if [ -d "$dir"/rebase-apply ]; then
+ __git_find_repo_path
+ if [ -d "$__git_repo_path"/rebase-apply ]; then
__gitcomp "--skip --continue --resolved --abort"
return
fi
@@ -891,6 +1111,7 @@ _git_apply ()
--apply --no-add --exclude=
--ignore-whitespace --ignore-space-change
--whitespace= --inaccurate-eof --verbose
+ --recount --directory=
"
return
esac
@@ -902,13 +1123,17 @@ _git_add ()
--*)
__gitcomp "
--interactive --refresh --patch --update --dry-run
- --ignore-errors --intent-to-add
+ --ignore-errors --intent-to-add --force --edit --chmod=
"
return
esac
- # XXX should we check for --update and --all options ?
- __git_complete_index_file "--others --modified --directory --no-empty-directory"
+ local complete_opt="--others --modified --directory --no-empty-directory"
+ if test -n "$(__git_find_on_cmdline "-u --update")"
+ then
+ complete_opt="--modified"
+ fi
+ __git_complete_index_file "$complete_opt"
}
_git_archive ()
@@ -925,7 +1150,7 @@ _git_archive ()
--*)
__gitcomp "
--format= --list --verbose
- --prefix= --remote= --exec=
+ --prefix= --remote= --exec= --output
"
return
;;
@@ -940,7 +1165,8 @@ _git_bisect ()
local subcommands="start bad good skip reset visualize replay log run"
local subcommand="$(__git_find_on_cmdline "$subcommands")"
if [ -z "$subcommand" ]; then
- if [ -f "$(__gitdir)"/BISECT_START ]; then
+ __git_find_repo_path
+ if [ -f "$__git_repo_path"/BISECT_START ]; then
__gitcomp "$subcommands"
else
__gitcomp "replay start"
@@ -950,7 +1176,7 @@ _git_bisect ()
case "$subcommand" in
bad|good|reset|skip|start)
- __gitcomp_nl "$(__git_refs)"
+ __git_complete_refs
;;
*)
;;
@@ -964,29 +1190,30 @@ _git_branch ()
while [ $c -lt $cword ]; do
i="${words[c]}"
case "$i" in
- -d|-m) only_local_ref="y" ;;
- -r) has_r="y" ;;
+ -d|--delete|-m|--move) only_local_ref="y" ;;
+ -r|--remotes) has_r="y" ;;
esac
((c++))
done
case "$cur" in
--set-upstream-to=*)
- __gitcomp_nl "$(__git_refs)" "" "${cur##--set-upstream-to=}"
+ __git_complete_refs --cur="${cur##--set-upstream-to=}"
;;
--*)
__gitcomp "
--color --no-color --verbose --abbrev= --no-abbrev
- --track --no-track --contains --merged --no-merged
+ --track --no-track --contains --no-contains --merged --no-merged
--set-upstream-to= --edit-description --list
- --unset-upstream
+ --unset-upstream --delete --move --remotes
+ --column --no-column --sort= --points-at
"
;;
*)
if [ $only_local_ref = "y" -a $has_r = "n" ]; then
- __gitcomp_nl "$(__git_heads)"
+ __gitcomp_direct "$(__git_heads "" "$cur" " ")"
else
- __gitcomp_nl "$(__git_refs)"
+ __git_complete_refs
fi
;;
esac
@@ -1029,24 +1256,25 @@ _git_checkout ()
*)
# check if --track, --no-track, or --no-guess was specified
# if so, disable DWIM mode
- local flags="--track --no-track --no-guess" track=1
- if [ -n "$(__git_find_on_cmdline "$flags")" ]; then
- track=''
+ local flags="--track --no-track --no-guess" track_opt="--track"
+ if [ "$GIT_COMPLETION_CHECKOUT_NO_GUESS" = "1" ] ||
+ [ -n "$(__git_find_on_cmdline "$flags")" ]; then
+ track_opt=''
fi
- __gitcomp_nl "$(__git_refs '' $track)"
+ __git_complete_refs $track_opt
;;
esac
}
_git_cherry ()
{
- __gitcomp_nl "$(__git_refs)"
+ __git_complete_refs
}
_git_cherry_pick ()
{
- local dir="$(__gitdir)"
- if [ -f "$dir"/CHERRY_PICK_HEAD ]; then
+ __git_find_repo_path
+ if [ -f "$__git_repo_path"/CHERRY_PICK_HEAD ]; then
__gitcomp "--continue --quit --abort"
return
fi
@@ -1055,7 +1283,7 @@ _git_cherry_pick ()
__gitcomp "--edit --no-commit --signoff --strategy= --mainline"
;;
*)
- __gitcomp_nl "$(__git_refs)"
+ __git_complete_refs
;;
esac
}
@@ -1091,18 +1319,24 @@ _git_clone ()
--template=
--depth
--single-branch
+ --no-tags
--branch
+ --recurse-submodules
+ --no-single-branch
+ --shallow-submodules
"
return
;;
esac
}
+__git_untracked_file_modes="all no normal"
+
_git_commit ()
{
case "$prev" in
-c|-C)
- __gitcomp_nl "$(__git_refs)" "" "${cur}"
+ __git_complete_refs
return
;;
esac
@@ -1115,11 +1349,11 @@ _git_commit ()
;;
--reuse-message=*|--reedit-message=*|\
--fixup=*|--squash=*)
- __gitcomp_nl "$(__git_refs)" "" "${cur#*=}"
+ __git_complete_refs --cur="${cur#*=}"
return
;;
--untracked-files=*)
- __gitcomp "all no normal" "" "${cur##--untracked-files=}"
+ __gitcomp "$__git_untracked_file_modes" "" "${cur##--untracked-files=}"
return
;;
--*)
@@ -1131,11 +1365,12 @@ _git_commit ()
--reset-author --file= --message= --template=
--cleanup= --untracked-files --untracked-files=
--verbose --quiet --fixup= --squash=
+ --patch --short --date --allow-empty
"
return
esac
- if git rev-parse --verify --quiet HEAD >/dev/null; then
+ if __git rev-parse --verify --quiet HEAD >/dev/null; then
__git_complete_index_file "--committable"
else
# This is the first commit
@@ -1149,15 +1384,18 @@ _git_describe ()
--*)
__gitcomp "
--all --tags --contains --abbrev= --candidates=
- --exact-match --debug --long --match --always
+ --exact-match --debug --long --match --always --first-parent
+ --exclude
"
return
esac
- __gitcomp_nl "$(__git_refs)"
+ __git_complete_refs
}
__git_diff_algorithms="myers minimal patience histogram"
+__git_diff_submodule_formats="diff log short"
+
__git_diff_common_options="--stat --numstat --shortstat --summary
--patch-with-stat --name-only --name-status --color
--no-color --color-words --no-renames --check
@@ -1173,6 +1411,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary
--dirstat --dirstat= --dirstat-by-file
--dirstat-by-file= --cumulative
--diff-algorithm=
+ --submodule --submodule=
"
_git_diff ()
@@ -1184,6 +1423,10 @@ _git_diff ()
__gitcomp "$__git_diff_algorithms" "" "${cur##--diff-algorithm=}"
return
;;
+ --submodule=*)
+ __gitcomp "$__git_diff_submodule_formats" "" "${cur##--submodule=}"
+ return
+ ;;
--*)
__gitcomp "--cached --staged --pickaxe-all --pickaxe-regex
--base --ours --theirs --no-index
@@ -1225,6 +1468,7 @@ __git_fetch_recurse_submodules="yes on-demand no"
__git_fetch_options="
--quiet --verbose --append --upload-pack --force --keep --depth=
--tags --no-tags --all --prune --dry-run --recurse-submodules=
+ --unshallow --update-shallow
"
_git_fetch ()
@@ -1274,7 +1518,7 @@ _git_fsck ()
--*)
__gitcomp "
--tags --root --unreachable --cache --no-reflogs --full
- --strict --verbose --lost-found
+ --strict --verbose --lost-found --name-objects
"
return
;;
@@ -1296,8 +1540,43 @@ _git_gitk ()
_gitk
}
-__git_match_ctag() {
- awk "/^${1//\//\\/}/ { print \$1 }" "$2"
+# Lists matching symbol names from a tag (as in ctags) file.
+# 1: List symbol names matching this word.
+# 2: The tag file to list symbol names from.
+# 3: A prefix to be added to each listed symbol name (optional).
+# 4: A suffix to be appended to each listed symbol name (optional).
+__git_match_ctag () {
+ awk -v pfx="${3-}" -v sfx="${4-}" "
+ /^${1//\//\\/}/ { print pfx \$1 sfx }
+ " "$2"
+}
+
+# Complete symbol names from a tag file.
+# Usage: __git_complete_symbol [<option>]...
+# --tags=<file>: The tag file to list symbol names from instead of the
+# default "tags".
+# --pfx=<prefix>: A prefix to be added to each symbol name.
+# --cur=<word>: The current symbol name to be completed. Defaults to
+# the current word to be completed.
+# --sfx=<suffix>: A suffix to be appended to each symbol name instead
+# of the default space.
+__git_complete_symbol () {
+ local tags=tags pfx="" cur_="${cur-}" sfx=" "
+
+ while test $# != 0; do
+ case "$1" in
+ --tags=*) tags="${1##--tags=}" ;;
+ --pfx=*) pfx="${1##--pfx=}" ;;
+ --cur=*) cur_="${1##--cur=}" ;;
+ --sfx=*) sfx="${1##--sfx=}" ;;
+ *) return 1 ;;
+ esac
+ shift
+ done
+
+ if test -r "$tags"; then
+ __gitcomp_direct "$(__git_match_ctag "$cur_" "$tags" "$pfx" "$sfx")"
+ fi
}
_git_grep ()
@@ -1318,6 +1597,8 @@ _git_grep ()
--max-depth
--count
--and --or --not --all-match
+ --break --heading --show-function --function-context
+ --untracked --no-index
"
return
;;
@@ -1325,29 +1606,26 @@ _git_grep ()
case "$cword,$prev" in
2,*|*,-*)
- if test -r tags; then
- __gitcomp_nl "$(__git_match_ctag "$cur" tags)"
- return
- fi
+ __git_complete_symbol && return
;;
esac
- __gitcomp_nl "$(__git_refs)"
+ __git_complete_refs
}
_git_help ()
{
case "$cur" in
--*)
- __gitcomp "--all --info --man --web"
+ __gitcomp "--all --guides --info --man --web"
return
;;
esac
__git_compute_all_commands
__gitcomp "$__git_all_commands $(__git_aliases)
attributes cli core-tutorial cvs-migration
- diffcore gitk glossary hooks ignore modules
- namespaces repository-layout tutorial tutorial-2
+ diffcore everyday gitk glossary hooks ignore modules
+ namespaces repository-layout revisions tutorial tutorial-2
workflows
"
}
@@ -1390,6 +1668,12 @@ _git_ls_files ()
_git_ls_remote ()
{
+ case "$cur" in
+ --*)
+ __gitcomp "--heads --tags --refs --get-url --symref"
+ return
+ ;;
+ esac
__gitcomp_nl "$(__git_remotes)"
}
@@ -1427,12 +1711,25 @@ __git_log_date_formats="relative iso8601 rfc2822 short local default raw"
_git_log ()
{
__git_has_doubledash && return
+ __git_find_repo_path
- local g="$(git rev-parse --git-dir 2>/dev/null)"
local merge=""
- if [ -f "$g/MERGE_HEAD" ]; then
+ if [ -f "$__git_repo_path/MERGE_HEAD" ]; then
merge="--merge"
fi
+ case "$prev,$cur" in
+ -L,:*:*)
+ return # fall back to Bash filename completion
+ ;;
+ -L,:*)
+ __git_complete_symbol --cur="${cur#:}" --sfx=":"
+ return
+ ;;
+ -G,*|-S,*)
+ __git_complete_symbol
+ return
+ ;;
+ esac
case "$cur" in
--pretty=*|--format=*)
__gitcomp "$__git_log_pretty_formats $(__git_pretty_aliases)
@@ -1447,6 +1744,14 @@ _git_log ()
__gitcomp "full short no" "" "${cur##--decorate=}"
return
;;
+ --diff-algorithm=*)
+ __gitcomp "$__git_diff_algorithms" "" "${cur##--diff-algorithm=}"
+ return
+ ;;
+ --submodule=*)
+ __gitcomp "$__git_diff_submodule_formats" "" "${cur##--submodule=}"
+ return
+ ;;
--*)
__gitcomp "
$__git_log_common_options
@@ -1458,6 +1763,7 @@ _git_log ()
--relative-date --date=
--pretty= --format= --oneline
--show-signature
+ --cherry-mark
--cherry-pick
--graph
--decorate --decorate=
@@ -1469,6 +1775,21 @@ _git_log ()
"
return
;;
+ -L:*:*)
+ return # fall back to Bash filename completion
+ ;;
+ -L:*)
+ __git_complete_symbol --cur="${cur#-L:}" --sfx=":"
+ return
+ ;;
+ -G*)
+ __git_complete_symbol --pfx="-G" --cur="${cur#-G}"
+ return
+ ;;
+ -S*)
+ __git_complete_symbol --pfx="-S" --cur="${cur#-S}"
+ return
+ ;;
esac
__git_complete_revlist
}
@@ -1488,10 +1809,10 @@ _git_merge ()
case "$cur" in
--*)
__gitcomp "$__git_merge_options
- --rerere-autoupdate --no-rerere-autoupdate --abort"
+ --rerere-autoupdate --no-rerere-autoupdate --abort --continue"
return
esac
- __gitcomp_nl "$(__git_refs)"
+ __git_complete_refs
}
_git_mergetool ()
@@ -1502,7 +1823,7 @@ _git_mergetool ()
return
;;
--*)
- __gitcomp "--tool="
+ __gitcomp "--tool= --prompt --no-prompt"
return
;;
esac
@@ -1516,7 +1837,7 @@ _git_merge_base ()
return
;;
esac
- __gitcomp_nl "$(__git_refs)"
+ __git_complete_refs
}
_git_mv ()
@@ -1554,7 +1875,7 @@ _git_notes ()
,*)
case "$prev" in
--ref)
- __gitcomp_nl "$(__git_refs)"
+ __git_complete_refs
;;
*)
__gitcomp "$subcommands --ref"
@@ -1563,7 +1884,7 @@ _git_notes ()
;;
add,--reuse-message=*|append,--reuse-message=*|\
add,--reedit-message=*|append,--reedit-message=*)
- __gitcomp_nl "$(__git_refs)" "" "${cur#*=}"
+ __git_complete_refs --cur="${cur#*=}"
;;
add,--*|append,--*)
__gitcomp '--file= --message= --reedit-message=
@@ -1582,7 +1903,7 @@ _git_notes ()
-m|-F)
;;
*)
- __gitcomp_nl "$(__git_refs)"
+ __git_complete_refs
;;
esac
;;
@@ -1610,7 +1931,7 @@ _git_pull ()
__git_complete_remote_or_refspec
}
-__git_push_recurse_submodules="check on-demand"
+__git_push_recurse_submodules="check on-demand only"
__git_complete_force_with_lease ()
{
@@ -1620,10 +1941,10 @@ __git_complete_force_with_lease ()
--*=)
;;
*:*)
- __gitcomp_nl "$(__git_refs)" "" "${cur_#*:}"
+ __git_complete_refs --cur="${cur_#*:}"
;;
*)
- __gitcomp_nl "$(__git_refs)" "" "$cur_"
+ __git_complete_refs --cur="$cur_"
;;
esac
}
@@ -1668,12 +1989,13 @@ _git_push ()
_git_rebase ()
{
- local dir="$(__gitdir)"
- if [ -f "$dir"/rebase-merge/interactive ]; then
- __gitcomp "--continue --skip --abort --edit-todo"
+ __git_find_repo_path
+ if [ -f "$__git_repo_path"/rebase-merge/interactive ]; then
+ __gitcomp "--continue --skip --abort --quit --edit-todo"
return
- elif [ -d "$dir"/rebase-apply ] || [ -d "$dir"/rebase-merge ]; then
- __gitcomp "--continue --skip --abort"
+ elif [ -d "$__git_repo_path"/rebase-apply ] || \
+ [ -d "$__git_repo_path"/rebase-merge ]; then
+ __gitcomp "--continue --skip --abort --quit"
return
fi
__git_complete_strategy && return
@@ -1698,7 +2020,7 @@ _git_rebase ()
return
esac
- __gitcomp_nl "$(__git_refs)"
+ __git_complete_refs
}
_git_reflog ()
@@ -1709,7 +2031,7 @@ _git_reflog ()
if [ -z "$subcommand" ]; then
__gitcomp "$subcommands"
else
- __gitcomp_nl "$(__git_refs)"
+ __git_complete_refs
fi
}
@@ -1720,9 +2042,7 @@ _git_send_email ()
{
case "$prev" in
--to|--cc|--bcc|--from)
- __gitcomp "
- $(git --git-dir="$(__gitdir)" send-email --dump-aliases 2>/dev/null)
- "
+ __gitcomp "$(__git send-email --dump-aliases)"
return
;;
esac
@@ -1752,9 +2072,7 @@ _git_send_email ()
return
;;
--to=*|--cc=*|--bcc=*|--from=*)
- __gitcomp "
- $(git --git-dir="$(__gitdir)" send-email --dump-aliases 2>/dev/null)
- " "" "${cur#--*=}"
+ __gitcomp "$(__git send-email --dump-aliases)" "" "${cur#--*=}"
return
;;
--*)
@@ -1779,6 +2097,56 @@ _git_stage ()
_git_add
}
+_git_status ()
+{
+ local complete_opt
+ local untracked_state
+
+ case "$cur" in
+ --ignore-submodules=*)
+ __gitcomp "none untracked dirty all" "" "${cur##--ignore-submodules=}"
+ return
+ ;;
+ --untracked-files=*)
+ __gitcomp "$__git_untracked_file_modes" "" "${cur##--untracked-files=}"
+ return
+ ;;
+ --column=*)
+ __gitcomp "
+ always never auto column row plain dense nodense
+ " "" "${cur##--column=}"
+ return
+ ;;
+ --*)
+ __gitcomp "
+ --short --branch --porcelain --long --verbose
+ --untracked-files= --ignore-submodules= --ignored
+ --column= --no-column
+ "
+ return
+ ;;
+ esac
+
+ untracked_state="$(__git_get_option_value "-u" "--untracked-files=" \
+ "$__git_untracked_file_modes" "status.showUntrackedFiles")"
+
+ case "$untracked_state" in
+ no)
+ # --ignored option does not matter
+ complete_opt=
+ ;;
+ all|normal|*)
+ complete_opt="--cached --directory --no-empty-directory --others"
+
+ if [ -n "$(__git_find_on_cmdline "--ignored")" ]; then
+ complete_opt="$complete_opt --ignored --exclude=*"
+ fi
+ ;;
+ esac
+
+ __git_complete_index_file "$complete_opt"
+}
+
__git_config_get_set_variables ()
{
local prevword word config_file= c=$cword
@@ -1798,7 +2166,7 @@ __git_config_get_set_variables ()
c=$((--c))
done
- git --git-dir="$(__gitdir)" config $config_file --name-only --list 2>/dev/null
+ __git config $config_file --name-only --list
}
_git_config ()
@@ -1809,7 +2177,7 @@ _git_config ()
return
;;
branch.*.merge)
- __gitcomp_nl "$(__git_refs)"
+ __git_complete_refs
return
;;
branch.*.rebase)
@@ -1833,9 +2201,8 @@ _git_config ()
remote.*.push)
local remote="${prev#remote.}"
remote="${remote%.push}"
- __gitcomp_nl "$(git --git-dir="$(__gitdir)" \
- for-each-ref --format='%(refname):%(refname)' \
- refs/heads)"
+ __gitcomp_nl "$(__git for-each-ref \
+ --format='%(refname):%(refname)' refs/heads)"
return
;;
pull.twohead|pull.octopus)
@@ -1914,7 +2281,7 @@ _git_config ()
;;
branch.*)
local pfx="${cur%.*}." cur_="${cur#*.}"
- __gitcomp_nl "$(__git_heads)" "$pfx" "$cur_" "."
+ __gitcomp_direct "$(__git_heads "$pfx" "$cur_" ".")"
__gitcomp_nl_append $'autosetupmerge\nautosetuprebase\n' "$pfx" "$cur_"
return
;;
@@ -1969,14 +2336,23 @@ _git_config ()
esac
__gitcomp "
add.ignoreErrors
+ advice.amWorkDir
advice.commitBeforeMerge
advice.detachedHead
advice.implicitIdentity
- advice.pushNonFastForward
+ advice.pushAlreadyExists
+ advice.pushFetchFirst
+ advice.pushNeedsForce
+ advice.pushNonFFCurrent
+ advice.pushNonFFMatching
+ advice.pushUpdateRejected
advice.resolveConflict
+ advice.rmHints
advice.statusHints
+ advice.statusUoption
alias.
am.keepcr
+ am.threeWay
apply.ignorewhitespace
apply.whitespace
branch.autosetupmerge
@@ -2021,19 +2397,26 @@ _git_config ()
color.status.added
color.status.changed
color.status.header
+ color.status.localBranch
color.status.nobranch
+ color.status.remoteBranch
color.status.unmerged
color.status.untracked
color.status.updated
color.ui
+ commit.cleanup
+ commit.gpgSign
commit.status
commit.template
+ commit.verbose
core.abbrev
core.askpass
core.attributesfile
core.autocrlf
core.bare
core.bigFileThreshold
+ core.checkStat
+ core.commentChar
core.compression
core.createObject
core.deltaBaseCacheLimit
@@ -2043,6 +2426,8 @@ _git_config ()
core.fileMode
core.fsyncobjectfiles
core.gitProxy
+ core.hideDotFiles
+ core.hooksPath
core.ignoreStat
core.ignorecase
core.logAllRefUpdates
@@ -2050,20 +2435,30 @@ _git_config ()
core.notesRef
core.packedGitLimit
core.packedGitWindowSize
+ core.packedRefsTimeout
core.pager
+ core.precomposeUnicode
core.preferSymlinkRefs
core.preloadindex
+ core.protectHFS
+ core.protectNTFS
core.quotepath
core.repositoryFormatVersion
core.safecrlf
core.sharedRepository
core.sparseCheckout
+ core.splitIndex
+ core.sshCommand
core.symlinks
core.trustctime
core.untrackedCache
core.warnAmbiguousRefs
core.whitespace
core.worktree
+ credential.helper
+ credential.useHttpPath
+ credential.username
+ credentialCache.ignoreSIGHUP
diff.autorefreshindex
diff.external
diff.ignoreSubmodules
@@ -2084,6 +2479,7 @@ _git_config ()
format.attach
format.cc
format.coverLetter
+ format.from
format.headers
format.numbered
format.pretty
@@ -2094,15 +2490,19 @@ _git_config ()
format.thread
format.to
gc.
+ gc.aggressiveDepth
gc.aggressiveWindow
gc.auto
+ gc.autoDetach
gc.autopacklimit
+ gc.logExpiry
gc.packrefs
gc.pruneexpire
gc.reflogexpire
gc.reflogexpireunreachable
gc.rerereresolved
gc.rerereunresolved
+ gc.worktreePruneExpire
gitcvs.allbinary
gitcvs.commitmsgannotation
gitcvs.dbTableNamePrefix
@@ -2241,6 +2641,8 @@ _git_config ()
sendemail.thread
sendemail.to
sendemail.validate
+ sendemail.smtpbatchsize
+ sendemail.smtprelogindelay
showbranch.default
status.relativePaths
status.showUntrackedFiles
@@ -2259,31 +2661,79 @@ _git_config ()
_git_remote ()
{
- local subcommands="add rename remove set-head set-branches set-url show prune update"
+ local subcommands="
+ add rename remove set-head set-branches
+ get-url set-url show prune update
+ "
local subcommand="$(__git_find_on_cmdline "$subcommands")"
if [ -z "$subcommand" ]; then
- __gitcomp "$subcommands"
+ case "$cur" in
+ --*)
+ __gitcomp "--verbose"
+ ;;
+ *)
+ __gitcomp "$subcommands"
+ ;;
+ esac
return
fi
- case "$subcommand" in
- rename|remove|set-url|show|prune)
- __gitcomp_nl "$(__git_remotes)"
+ case "$subcommand,$cur" in
+ add,--*)
+ __gitcomp "--track --master --fetch --tags --no-tags --mirror="
+ ;;
+ add,*)
+ ;;
+ set-head,--*)
+ __gitcomp "--auto --delete"
+ ;;
+ set-branches,--*)
+ __gitcomp "--add"
;;
- set-head|set-branches)
+ set-head,*|set-branches,*)
__git_complete_remote_or_refspec
;;
- update)
+ update,--*)
+ __gitcomp "--prune"
+ ;;
+ update,*)
__gitcomp "$(__git_get_config_variables "remotes")"
;;
+ set-url,--*)
+ __gitcomp "--push --add --delete"
+ ;;
+ get-url,--*)
+ __gitcomp "--push --all"
+ ;;
+ prune,--*)
+ __gitcomp "--dry-run"
+ ;;
*)
+ __gitcomp_nl "$(__git_remotes)"
;;
esac
}
_git_replace ()
{
- __gitcomp_nl "$(__git_refs)"
+ case "$cur" in
+ --*)
+ __gitcomp "--edit --graft --format= --list --delete"
+ return
+ ;;
+ esac
+ __git_complete_refs
+}
+
+_git_rerere ()
+{
+ local subcommands="clear forget diff remaining status gc"
+ local subcommand="$(__git_find_on_cmdline "$subcommands")"
+ if test -z "$subcommand"
+ then
+ __gitcomp "$subcommands"
+ return
+ fi
}
_git_reset ()
@@ -2292,27 +2742,30 @@ _git_reset ()
case "$cur" in
--*)
- __gitcomp "--merge --mixed --hard --soft --patch"
+ __gitcomp "--merge --mixed --hard --soft --patch --keep"
return
;;
esac
- __gitcomp_nl "$(__git_refs)"
+ __git_complete_refs
}
_git_revert ()
{
- local dir="$(__gitdir)"
- if [ -f "$dir"/REVERT_HEAD ]; then
+ __git_find_repo_path
+ if [ -f "$__git_repo_path"/REVERT_HEAD ]; then
__gitcomp "--continue --quit --abort"
return
fi
case "$cur" in
--*)
- __gitcomp "--edit --mainline --no-edit --no-commit --signoff"
+ __gitcomp "
+ --edit --mainline --no-edit --no-commit --signoff
+ --strategy= --strategy-option=
+ "
return
;;
esac
- __gitcomp_nl "$(__git_refs)"
+ __git_complete_refs
}
_git_rm ()
@@ -2336,7 +2789,7 @@ _git_shortlog ()
__gitcomp "
$__git_log_common_options
$__git_log_shortlog_options
- --numbered --summary
+ --numbered --summary --email
"
return
;;
@@ -2358,6 +2811,10 @@ _git_show ()
__gitcomp "$__git_diff_algorithms" "" "${cur##--diff-algorithm=}"
return
;;
+ --submodule=*)
+ __gitcomp "$__git_diff_submodule_formats" "" "${cur##--submodule=}"
+ return
+ ;;
--*)
__gitcomp "--pretty= --format= --abbrev-commit --oneline
--show-signature
@@ -2388,7 +2845,7 @@ _git_show_branch ()
_git_stash ()
{
local save_opts='--all --keep-index --no-keep-index --quiet --patch --include-untracked'
- local subcommands='save list show apply clear drop pop create branch'
+ local subcommands='push save list show apply clear drop pop create branch'
local subcommand="$(__git_find_on_cmdline "$subcommands")"
if [ -z "$subcommand" ]; then
case "$cur" in
@@ -2403,6 +2860,9 @@ _git_stash ()
esac
else
case "$subcommand,$cur" in
+ push,--*)
+ __gitcomp "$save_opts --message"
+ ;;
save,--*)
__gitcomp "$save_opts"
;;
@@ -2416,14 +2876,14 @@ _git_stash ()
;;
branch,*)
if [ $cword -eq 3 ]; then
- __gitcomp_nl "$(__git_refs)";
+ __git_complete_refs
else
- __gitcomp_nl "$(git --git-dir="$(__gitdir)" stash list \
+ __gitcomp_nl "$(__git stash list \
| sed -n -e 's/:.*//p')"
fi
;;
show,*|apply,*|drop,*|pop,*)
- __gitcomp_nl "$(git --git-dir="$(__gitdir)" stash list \
+ __gitcomp_nl "$(__git stash list \
| sed -n -e 's/:.*//p')"
;;
*)
@@ -2437,10 +2897,11 @@ _git_submodule ()
__git_has_doubledash && return
local subcommands="add status init deinit update summary foreach sync"
- if [ -z "$(__git_find_on_cmdline "$subcommands")" ]; then
+ local subcommand="$(__git_find_on_cmdline "$subcommands")"
+ if [ -z "$subcommand" ]; then
case "$cur" in
--*)
- __gitcomp "--quiet --cached"
+ __gitcomp "--quiet"
;;
*)
__gitcomp "$subcommands"
@@ -2448,6 +2909,33 @@ _git_submodule ()
esac
return
fi
+
+ case "$subcommand,$cur" in
+ add,--*)
+ __gitcomp "--branch --force --name --reference --depth"
+ ;;
+ status,--*)
+ __gitcomp "--cached --recursive"
+ ;;
+ deinit,--*)
+ __gitcomp "--force --all"
+ ;;
+ update,--*)
+ __gitcomp "
+ --init --remote --no-fetch
+ --recommend-shallow --no-recommend-shallow
+ --force --rebase --merge --reference --depth --recursive --jobs
+ "
+ ;;
+ summary,--*)
+ __gitcomp "--cached --files --summary-limit"
+ ;;
+ foreach,--*|sync,--*)
+ __gitcomp "--recursive"
+ ;;
+ *)
+ ;;
+ esac
}
_git_svn ()
@@ -2468,14 +2956,14 @@ _git_svn ()
--no-metadata --use-svm-props --use-svnsync-props
--log-window-size= --no-checkout --quiet
--repack-flags --use-log-author --localtime
+ --add-author-from
--ignore-paths= --include-paths= $remote_opts
"
local init_opts="
--template= --shared= --trunk= --tags=
--branches= --stdlayout --minimize-url
--no-metadata --use-svm-props --use-svnsync-props
- --rewrite-root= --prefix= --use-log-author
- --add-author-from $remote_opts
+ --rewrite-root= --prefix= $remote_opts
"
local cmt_opts="
--edit --rmdir --find-copies-harder --copy-similarity=
@@ -2555,7 +3043,7 @@ _git_tag ()
i="${words[c]}"
case "$i" in
-d|-v)
- __gitcomp_nl "$(__git_tags)"
+ __gitcomp_direct "$(__git_tags "" "$cur" " ")"
return
;;
-f)
@@ -2570,11 +3058,11 @@ _git_tag ()
;;
-*|tag)
if [ $f = 1 ]; then
- __gitcomp_nl "$(__git_tags)"
+ __gitcomp_direct "$(__git_tags "" "$cur" " ")"
fi
;;
*)
- __gitcomp_nl "$(__git_refs)"
+ __git_complete_refs
;;
esac
@@ -2582,8 +3070,8 @@ _git_tag ()
--*)
__gitcomp "
--list --delete --verify --annotate --message --file
- --sign --cleanup --local-user --force --column --sort
- --contains --points-at
+ --sign --cleanup --local-user --force --column --sort=
+ --contains --no-contains --points-at --merged --no-merged --create-reflog
"
;;
esac
@@ -2594,9 +3082,36 @@ _git_whatchanged ()
_git_log
}
+_git_worktree ()
+{
+ local subcommands="add list lock prune unlock"
+ local subcommand="$(__git_find_on_cmdline "$subcommands")"
+ if [ -z "$subcommand" ]; then
+ __gitcomp "$subcommands"
+ else
+ case "$subcommand,$cur" in
+ add,--*)
+ __gitcomp "--detach"
+ ;;
+ list,--*)
+ __gitcomp "--porcelain"
+ ;;
+ lock,--*)
+ __gitcomp "--reason"
+ ;;
+ prune,--*)
+ __gitcomp "--dry-run --expire --verbose"
+ ;;
+ *)
+ ;;
+ esac
+ fi
+}
+
__git_main ()
{
- local i c=1 command __git_dir
+ local i c=1 command __git_dir __git_repo_path
+ local __git_C_args C_args_count=0
while [ $c -lt $cword ]; do
i="${words[c]}"
@@ -2606,6 +3121,10 @@ __git_main ()
--bare) __git_dir="." ;;
--help) command="help"; break ;;
-c|--work-tree|--namespace) ((c++)) ;;
+ -C) __git_C_args[C_args_count++]=-C
+ ((c++))
+ __git_C_args[C_args_count++]="${words[c]}"
+ ;;
-*) ;;
*) command="$i"; break ;;
esac
@@ -2613,6 +3132,17 @@ __git_main ()
done
if [ -z "$command" ]; then
+ case "$prev" in
+ --git-dir|-C|--work-tree)
+ # these need a path argument, let's fall back to
+ # Bash filename completion
+ return
+ ;;
+ -c|--namespace)
+ # we don't support completing these options' arguments
+ return
+ ;;
+ esac
case "$cur" in
--*) __gitcomp "
--paginate
@@ -2638,13 +3168,13 @@ __git_main ()
fi
local completion_func="_git_${command//-/_}"
- declare -f $completion_func >/dev/null && $completion_func && return
+ declare -f $completion_func >/dev/null 2>/dev/null && $completion_func && return
local expansion=$(__git_aliased_command "$command")
if [ -n "$expansion" ]; then
words[1]=$expansion
completion_func="_git_${expansion//-/_}"
- declare -f $completion_func >/dev/null && $completion_func
+ declare -f $completion_func >/dev/null 2>/dev/null && $completion_func
fi
}
@@ -2652,9 +3182,11 @@ __gitk_main ()
{
__git_has_doubledash && return
- local g="$(__gitdir)"
+ local __git_repo_path
+ __git_find_repo_path
+
local merge=""
- if [ -f "$g/MERGE_HEAD" ]; then
+ if [ -f "$__git_repo_path/MERGE_HEAD" ]; then
merge="--merge"
fi
case "$cur" in
@@ -2701,6 +3233,15 @@ if [[ -n ${ZSH_VERSION-} ]]; then
esac
}
+ __gitcomp_direct ()
+ {
+ emulate -L zsh
+
+ local IFS=$'\n'
+ compset -P '*[=:]'
+ compadd -Q -- ${=1} && _ret=0
+ }
+
__gitcomp_nl ()
{
emulate -L zsh
@@ -2771,6 +3312,6 @@ __git_complete gitk __gitk_main
# when the user has tab-completed the executable name and consequently
# included the '.exe' suffix.
#
-if [[ "$OSTYPE" = cygwin* ]]; then
+if [ Cygwin = "$(uname -o 2>/dev/null)" ]; then
__git_complete git.exe __git_main
fi
diff --git a/plugins/gitfast/git-prompt.sh b/plugins/gitfast/git-prompt.sh
index 0da14eee9..cd905759e 100644
--- a/plugins/gitfast/git-prompt.sh
+++ b/plugins/gitfast/git-prompt.sh
@@ -82,6 +82,7 @@
# contains relative to newer annotated tag (v1.6.3.2~35)
# branch relative to newer tag or branch (master~4)
# describe relative to older annotated tag (v1.6.3.1-13-gdd42c2f)
+# tag relative to any older tag (v1.6.3.1-13-gdd42c2f)
# default exactly matching tag
#
# If you would like a colored hint about the current dirty state, set
@@ -355,8 +356,8 @@ __git_ps1 ()
# incorrect.)
#
local ps1_expanded=yes
- [ -z "$ZSH_VERSION" ] || [[ -o PROMPT_SUBST ]] || ps1_expanded=no
- [ -z "$BASH_VERSION" ] || shopt -q promptvars || ps1_expanded=no
+ [ -z "${ZSH_VERSION-}" ] || [[ -o PROMPT_SUBST ]] || ps1_expanded=no
+ [ -z "${BASH_VERSION-}" ] || shopt -q promptvars || ps1_expanded=no
local repo_info rev_parse_exit_code
repo_info="$(git rev-parse --git-dir --is-inside-git-dir \
@@ -368,7 +369,7 @@ __git_ps1 ()
return $exit
fi
- local short_sha
+ local short_sha=""
if [ "$rev_parse_exit_code" = "0" ]; then
short_sha="${repo_info##*$'\n'}"
repo_info="${repo_info%$'\n'*}"
@@ -443,6 +444,8 @@ __git_ps1 ()
git describe --contains HEAD ;;
(branch)
git describe --contains --all HEAD ;;
+ (tag)
+ git describe --tags HEAD ;;
(describe)
git describe HEAD ;;
(* | default)
diff --git a/plugins/gitfast/gitfast.plugin.zsh b/plugins/gitfast/gitfast.plugin.zsh
index dba1b1315..8c2aea497 100644
--- a/plugins/gitfast/gitfast.plugin.zsh
+++ b/plugins/gitfast/gitfast.plugin.zsh
@@ -1,8 +1,9 @@
-dir=$(dirname $0)
-source $dir/../git/git.plugin.zsh
-source $dir/git-prompt.sh
+dir="${0:A:h}"
+source "$dir/git-prompt.sh"
function git_prompt_info() {
dirty="$(parse_git_dirty)"
__git_ps1 "${ZSH_THEME_GIT_PROMPT_PREFIX//\%/%%}%s${dirty//\%/%%}${ZSH_THEME_GIT_PROMPT_SUFFIX//\%/%%}"
}
+
+unset dir
diff --git a/plugins/golang/golang.plugin.zsh b/plugins/golang/golang.plugin.zsh
index 8284ab83c..47b10988e 100644
--- a/plugins/golang/golang.plugin.zsh
+++ b/plugins/golang/golang.plugin.zsh
@@ -28,6 +28,7 @@ __go_tool_complete() {
'help[display help]'
'install[compile and install packages and dependencies]'
'list[list packages]'
+ 'mod[modules maintenance]'
'run[compile and run Go program]'
'test[test packages]'
'tool[run specified go tool]'
@@ -83,7 +84,7 @@ __go_tool_complete() {
"-x[print remove commands as it executes them]" \
"*:importpaths:__go_packages"
;;
- fix|fmt|list|vet)
+ fix|fmt|vet)
_alternative ':importpaths:__go_packages' ':files:_path_files -g "*.go"'
;;
install)
@@ -124,6 +125,81 @@ __go_tool_complete() {
"-memprofilerate[set heap profiling rate]:number" \
"*:args:{ _alternative ':importpaths:__go_packages' ':files:_path_files -g \"*.go\"' }"
;;
+ list)
+ _arguments -s -w : \
+ "-f[alternative format for the list]:format" \
+ "-json[print data in json format]" \
+ "-compiled[set CompiledGoFiles to the Go source files presented to the compiler]" \
+ "-deps[iterate over not just the named packages but also all their dependencies]" \
+ "-e[change the handling of erroneous packages]" \
+ "-export[set the Export field to the name of a file containing up-to-date export information for the given package]" \
+ "-find[identify the named packages but not resolve their dependencies]" \
+ "-test[report not only the named packages but also their test binaries]" \
+ "-m[list modules instead of packages]" \
+ "-u[adds information about available upgrades]" \
+ "-versions[set the Module's Versions field to a list of all known versions of that module]:number" \
+ "*:importpaths:__go_packages"
+ ;;
+ mod)
+ typeset -a mod_commands
+ mod_commands+=(
+ 'download[download modules to local cache]'
+ 'edit[edit go.mod from tools or scripts]'
+ 'graph[print module requirement graph]'
+ 'init[initialize new module in current directory]'
+ 'tidy[add missing and remove unused modules]'
+ 'vendor[make vendored copy of dependencies]'
+ 'verify[verify dependencies have expected content]'
+ 'why[explain why packages or modules are needed]'
+ )
+ if (( CURRENT == 3 )); then
+ _values 'go mod commands' ${mod_commands[@]} "help[display help]"
+ return
+ fi
+ case ${words[3]} in
+ help)
+ _values 'go mod commands' ${mod_commands[@]}
+ ;;
+ download)
+ _arguments -s -w : \
+ "-json[print a sequence of JSON objects standard output]" \
+ "*:flags"
+ ;;
+ edit)
+ _arguments -s -w : \
+ "-fmt[reformat the go.mod file]" \
+ "-module[change the module's path]" \
+ "-replace[=old{@v}=new{@v} add a replacement of the given module path and version pair]:name" \
+ "-dropreplace[=old{@v}=new{@v} drop a replacement of the given module path and version pair]:name" \
+ "-go[={version} set the expected Go language version]:number" \
+ "-print[print the final go.mod in its text format]" \
+ "-json[print the final go.mod file in JSON format]" \
+ "*:flags"
+ ;;
+ graph)
+ ;;
+ init)
+ ;;
+ tidy)
+ _arguments -s -w : \
+ "-v[print information about removed modules]" \
+ "*:flags"
+ ;;
+ vendor)
+ _arguments -s -w : \
+ "-v[print the names of vendored]" \
+ "*:flags"
+ ;;
+ verify)
+ ;;
+ why)
+ _arguments -s -w : \
+ "-m[treats the arguments as a list of modules and finds a path to any package in each of the modules]" \
+ "-vendor[exclude tests of dependencies]" \
+ "*:importpaths:__go_packages"
+ ;;
+ esac
+ ;;
help)
_values "${commands[@]}" \
'environment[show Go environment variables available]' \
@@ -189,6 +265,7 @@ alias gofa='go fmt ./...'
alias gog='go get'
alias goi='go install'
alias gol='go list'
+alias gom='go mod'
alias gop='cd $GOPATH'
alias gopb='cd $GOPATH/bin'
alias gops='cd $GOPATH/src'
diff --git a/plugins/gradle/gradle.plugin.zsh b/plugins/gradle/gradle.plugin.zsh
index 8df62c2e2..8d578e27b 100644
--- a/plugins/gradle/gradle.plugin.zsh
+++ b/plugins/gradle/gradle.plugin.zsh
@@ -156,7 +156,7 @@ _gradle_parse_and_extract_tasks () {
# Discover the gradle tasks by running "gradle tasks --all"
############################################################################
_gradle_tasks () {
- if [[ -f build.gradle || -f build.gradle.kts ]]; then
+ if [[ -f build.gradle || -f build.gradle.kts || -f settings.gradle || -f settings.gradle.kts ]]; then
_gradle_arguments
if _gradle_does_task_list_need_generating; then
_gradle_parse_and_extract_tasks "$(gradle tasks --all)" > .gradletasknamecache
@@ -166,7 +166,7 @@ _gradle_tasks () {
}
_gradlew_tasks () {
- if [[ -f build.gradle || -f build.gradle.kts ]]; then
+ if [[ -f build.gradle || -f build.gradle.kts || -f settings.gradle || -f settings.gradle.kts ]]; then
_gradle_arguments
if _gradle_does_task_list_need_generating; then
_gradle_parse_and_extract_tasks "$(./gradlew tasks --all)" > .gradletasknamecache
diff --git a/plugins/gulp/gulp.plugin.zsh b/plugins/gulp/gulp.plugin.zsh
index 2b3105135..ec597421d 100644
--- a/plugins/gulp/gulp.plugin.zsh
+++ b/plugins/gulp/gulp.plugin.zsh
@@ -19,11 +19,11 @@
# Grabs all available tasks from the `gulpfile.js`
# in the current directory.
#
-function $$gulp_completion {
+function _gulp_completion {
compls=$(gulp --tasks-simple 2>/dev/null)
completions=(${=compls})
compadd -- $completions
}
-compdef $$gulp_completion gulp
+compdef _gulp_completion gulp
diff --git a/plugins/httpie/README.md b/plugins/httpie/README.md
index 56aa6a8ca..f22d3a64e 100644
--- a/plugins/httpie/README.md
+++ b/plugins/httpie/README.md
@@ -1,6 +1,15 @@
-## HTTPie
-**Maintainer:** [lululau](https://github.com/lululau)
+# HTTPie plugin
+
+This plugin adds completion for [HTTPie](https://httpie.org), a command line HTTP
+client, a friendlier cURL replacement.
+
+To use it, add `httpie` to the plugins array in your zshrc file:
-This plugin adds completion for HTTPie, which is a command line HTTP client, a user-friendly cURL replacement.
+```zsh
+plugins=(... httpie)
+```
-[HTTPie Homepage](https://httpie.org)
+It uses completion from [zsh-completions](https://github.com/zsh-users/zsh-completions).
+
+
+**Maintainer:** [lululau](https://github.com/lululau)
diff --git a/plugins/httpie/_httpie b/plugins/httpie/_httpie
new file mode 100644
index 000000000..4d702ef60
--- /dev/null
+++ b/plugins/httpie/_httpie
@@ -0,0 +1,181 @@
+#compdef http
+# ------------------------------------------------------------------------------
+# Copyright (c) 2015 Github zsh-users - http://github.com/zsh-users
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# * Neither the name of the zsh-users nor the
+# names of its contributors may be used to endorse or promote products
+# derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY
+# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+# ------------------------------------------------------------------------------
+# Description
+# -----------
+#
+# Completion script for httpie 0.7.2 (http://httpie.org)
+#
+# ------------------------------------------------------------------------------
+# Authors
+# -------
+#
+# * Akira Maeda <https://github.com/glidenote>
+# * Valodim <https://github.com/Valodim>
+# * Claus Klingberg <https://github.com/cjk>
+#
+# ------------------------------------------------------------------------------
+# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
+# vim: ft=zsh sw=2 ts=2 et
+# ------------------------------------------------------------------------------
+
+_httpie_params () {
+
+ local ret=1 expl
+
+ # or a url
+ if (( CURRENT <= NORMARG+1 )) && [[ $words[NORMARG] != *:* ]] ; then
+ _httpie_urls && ret=0
+
+ # regular param, if we already have a url
+ elif (( CURRENT > NORMARG )); then
+
+ # if the suffix is precisely : this is shorthand for a header
+ if [[ -prefix ':' ]]; then
+ PREFIX=
+ SUFFIX=:
+ fi
+
+ # if we are in front of a : (possibly due to the PREFIX move before)
+ if [[ -suffix ':' ]]; then
+
+ # this is rather buggy with normal tab behavior :\
+ compstate[insert]=menu
+ _wanted http_header expl 'HTTP Header' \
+ compadd -s ':' -S '' -- Content-Type Cookie && return 0
+ fi
+
+ # ignore all prefix stuff
+ compset -P '(#b)([^:@=]#)'
+ local name=$match[1]
+
+ if compset -P '='; then
+ _message "$name data field value"
+ elif compset -P '@'; then
+ _files
+ elif compset -P ':=@'; then
+ _files
+ elif compset -P ':='; then
+ _message "$name raw json data"
+ elif compset -P '=='; then
+ _message "$name url parameter value"
+ elif compset -P ':'; then
+ _message "$name header content"
+ else
+ typeset -a ops
+ ops=(
+ '=:data field'
+ '\::header'
+ '==:request parameter'
+ '@:data file field'
+ '\:=:raw json field'
+ '\:=@:raw json field file path'
+ )
+ _describe -t httpparams "parameter types" ops -Q -S ''
+ fi
+
+ ret=0
+
+ fi
+
+ # first arg may be a request method
+ (( CURRENT == NORMARG )) &&
+ _wanted http_method expl 'Request Method' \
+ compadd GET POST PUT DELETE HEAD OPTIONS TRACE CONNECT PATCH LINK UNLINK && ret=0
+
+ return $ret
+
+}
+
+_httpie_urls() {
+
+ local ret=1
+
+ if ! [[ -prefix [-+.a-z0-9]#:// ]]; then
+ local expl
+ compset -S '[^:/]*' && compstate[to_end]=''
+ _wanted url-schemas expl 'URL schema' compadd -S '' http:// https:// && ret=0
+ else
+ _urls && ret=0
+ fi
+
+ return $ret
+
+}
+
+_httpie_printflags () {
+
+ local ret=1
+
+ # not sure why this is necessary, but it will complete "-pH" style without it
+ [[ $IPREFIX == "-p" ]] && IPREFIX+=" "
+
+ compset -P '(#b)([a-zA-Z]#)'
+
+ local -a flags
+ [[ $match[1] != *H* ]] && flags+=( "H:request headers" )
+ [[ $match[1] != *B* ]] && flags+=( "B:request body" )
+ [[ $match[1] != *h* ]] && flags+=( "h:response headers" )
+ [[ $match[1] != *b* ]] && flags+=( "b:response body" )
+
+ _describe -t printflags "print flags" flags -S '' && ret=0
+
+ return $ret
+
+}
+
+integer NORMARG
+
+_arguments -n -C -s \
+ '(-j --json -f)'{-j,--json}'[Data items from the command line are serialized as a JSON object.]' \
+ '(-f --form -j)'{-f,--form}'[Data items from the command line are serialized as form fields.]' \
+ '--pretty=[Controls output processing.]:output format:(all colors format none)' \
+ '(-s --style)'{-s,--style}'=[Output coloring style]:STYLE:(autumn borland bw colorful default emacs friendly fruity manni monokai murphy native pastie perldoc ttr solarized tango trac vim vs)' \
+ '(-p --print)'{-p,--print}'=[String specifying what the output should contain]:print flags:_httpie_printflags' \
+ '(-v --verbose)'{-v,--verbose}'[Print the whole request as well as the response.]' \
+ '(-p -h --headers)'{-h,--headers}'[Print only the response headers.]' \
+ '(-p -b --body)'{-b,--body}'[Print only the response body.]' \
+ '(-S --stream)'{-S,--stream}'[Always stream the output by line, i.e., behave like `tail -f`.]' \
+ '(-o --output)'{-o,--output}'=[Save output to FILE.]:output file:_files' \
+ '(-d --download)'{-d,--download}'=[Do not print the response body to stdout.]' \
+ '(-c --continue)'{-c,--continue}'[Resume an interrupted download.]' \
+ '(--session-read-only)--session=[Create, or reuse and update a session.]:session name (or path)' \
+ '(--session)--session-read-only=[Create or read a session without updating it form the request/response exchange.]:session name (or path)' \
+ '(-a --auth)'{-a,--auth}'=[If only the username is provided (-a username)]:USER\:PASS' \
+ '--auth-type=[The authentication mechanism to be used. Defaults to "basic".]:AUTH-TYPE:(basic digest)' \
+ '--proxy=[String mapping protocol to the URL of the proxy.]:PROXY' \
+ '--follow[Allow full redirects.]' \
+ "--verify=[Enable or disable verification of ssl certificates.]:verify certificate:(yes no)" \
+ '--allow-redirects[Set this flag if full redirects are allowed (e.g. re-POST-ing of data at new ``Location``)]' \
+ '--timeout=[Float describes the timeout of the request (Use socket.setdefaulttimeout() as fallback).]:timeout (seconds)' \
+ '--check-status[This flag instructs HTTPie to also check the HTTP status code and exit with an error if the status indicates one.]' \
+ '--ignore-stdin[Do not attempt to read stdin.]' \
+ '(- *)--help[show help message.]' \
+ "(- *)--version[show program's version number and exit.]" \
+ '--traceback[Prints exception traceback should one occur.]' \
+ '--debug[Prints exception traceback should one occur and other information useful for debugging HTTPie itself.]' \
+ '*:args:_httpie_params' && return 0
diff --git a/plugins/httpie/httpie.plugin.zsh b/plugins/httpie/httpie.plugin.zsh
deleted file mode 100644
index 68ead6c67..000000000
--- a/plugins/httpie/httpie.plugin.zsh
+++ /dev/null
@@ -1,33 +0,0 @@
-function _httpie_completion() {
- _arguments -C \
- '(- 1 *)--version[display version information]' \
- '(-j|--json)'{-j,--json}'[(default) Data items from the command line are serialized as a JSON object]' \
- '(-f|--form)'{-f,--form}'[Data items from the command line are serialized as form fields]' \
- '(--pretty)--pretty[<all,colors,format,none> Controls output processing]:options' \
- '(-s|--style)'{-s,--style}'[Output coloring style]' \
- '(-p|--print)'{-p,--print}'[String specifying what the output should contain: H(request headers), B(request body), h(response headers), b(response body)]' \
- '(-v|--verbose)'{-v,--verbose}'[Print the whole request as well as the response. Shortcut for --print=HBbh.]' \
- '(-h|--headers)'{-h,--headers}'[Print only the response headers. Shortcut for --print=h]' \
- '(-b|--body)'{-b,--body}'[Print only the response body. Shortcut for --print=b]' \
- '(-S|--stream)'{-S,--stream}'[Always stream the output by line, i.e., behave like `tail -f'"'"']' \
- '(-o|--output)'{-o,--output}'[Save output to FILE]:file:_files' \
- '(-d|--download)'{-d,--download}'[Do not print the response body to stdout. Rather, download it and store it in a file. The filename is guessed unless specified with --output filename. This action is similar to the default behaviour of wget.]' \
- '(-c|--continue)'{-c,--continue}'[Resume an interrupted download. Note that the --output option needs to be specified as well.]' \
- '(--session)--session[Create, or reuse and update a session. Within a session, custom headers, auth credential, as well as any cookies sent by the server persist between requests]:file:_files' \
- '(--session-read-only)--session-read-only[Create or read a session without updating it form the request/response exchange]:file:_files' \
- '(-a|--auth)'{-a,--auth}'[<USER:PASS> If only the username is provided (-a username), HTTPie will prompt for the password]' \
- '(--auth-type)--auth-type[<basic, digest> The authentication mechanism to be used. Defaults to "basic".]' \
- '(--proxy)--proxy[<PROTOCOL:PROXY_URL> String mapping protocol to the URL of the proxy]' \
- '(--follow)--follow[Set this flag if full redirects are allowed (e.g. re-POST-ing of data at new Location).]' \
- '(--verify)--verify[<VERIFY> Set to "no" to skip checking the host'"'"'s SSL certificate. You can also pass the path to a CA_BUNDLE file for private certs. You can also set the REQUESTS_CA_BUNDLE environment variable. Defaults to "yes".]' \
- '(--timeout)--timeout[<SECONDS> The connection timeout of the request in seconds. The default value is 30 seconds]' \
- '(--check-status)--check-status[By default, HTTPie exits with 0 when no network or other fatal errors occur. This flag instructs HTTPie to also check the HTTP status code and exit with an error if the status indicates one.]' \
- '(--ignore-stdin)--ignore-stdin[Do not attempt to read stdin]' \
- '(--help)--help[Show this help message and exit]' \
- '(--traceback)--traceback[Prints exception traceback should one occur]' \
- '(--debug)--debug[Prints exception traceback should one occur, and also other information that is useful for debugging HTTPie itself and for reporting bugs]' \
- '1: :->cmds' \
- '*: :->args' && ret=0
-}
-
-compdef _httpie_completion http \ No newline at end of file
diff --git a/plugins/iwhois/README.md b/plugins/iwhois/README.md
deleted file mode 100644
index 1626b8524..000000000
--- a/plugins/iwhois/README.md
+++ /dev/null
@@ -1,24 +0,0 @@
-# iwhois
-
-Provides a whois command with a more accurate and up-to-date list of whois servers
-using CNAMES, via [whois.geek.nz](https://github.com/iwantmyname/whois.geek.nz).
-
-To use it, add iwhois to the plugins array of your zshrc file:
-```
-plugins=(... iwhois)
-```
-
-### Usage
-
-The plugin defines the function `iwhois` that takes a domain name as an argument:
-
-```
-$ iwhois github.com
- Domain Name: GITHUB.COM
- Registry Domain ID: 1264983250_DOMAIN_COM-VRSN
- Registrar WHOIS Server: whois.markmonitor.com
- Registrar URL: http://www.markmonitor.com
- Updated Date: 2017-06-26T16:02:39Z
- Creation Date: 2007-10-09T18:20:50Z
- ...
-```
diff --git a/plugins/iwhois/iwhois.plugin.zsh b/plugins/iwhois/iwhois.plugin.zsh
deleted file mode 100644
index 22a75eec1..000000000
--- a/plugins/iwhois/iwhois.plugin.zsh
+++ /dev/null
@@ -1,5 +0,0 @@
-function iwhois() {
- resolver="whois.geek.nz"
- tld=`echo ${@: -1} | awk -F "." '{print $NF}'`
- whois -h ${tld}.${resolver} "$@" ;
-}
diff --git a/plugins/jenv/jenv.plugin.zsh b/plugins/jenv/jenv.plugin.zsh
index 14c586be9..2eda8037b 100644
--- a/plugins/jenv/jenv.plugin.zsh
+++ b/plugins/jenv/jenv.plugin.zsh
@@ -1,4 +1,4 @@
-jenvdirs=("$HOME/.jenv" "/usr/local/jenv" "/opt/jenv")
+jenvdirs=("$HOME/.jenv" "/usr/local" "/usr/local/jenv" "/opt/jenv")
FOUND_JENV=0
for jenvdir in $jenvdirs; do
diff --git a/plugins/kubectl/README.md b/plugins/kubectl/README.md
index a93a9339e..3343f0195 100644
--- a/plugins/kubectl/README.md
+++ b/plugins/kubectl/README.md
@@ -14,6 +14,7 @@ plugins=(... kubectl)
| Alias | Command | Description |
|:--------|:------------------------------------|:-------------------------------------------------------------------------------------------------|
| k | `kubectl` | The kubectl command |
+| kca | `kubectl --all-namespaces` | The kubectl command targeting all namespaces |
| kaf | `kubectl apply -f` | Apply a YML file |
| keti | `kubectl exec -ti` | Drop into an interactive terminal on a container |
| | | **Manage configuration quickly to switch contexts between local, dev and staging** |
@@ -46,6 +47,7 @@ plugins=(... kubectl)
| kdeli | `kubectl delete ingress` | Delete ingress resources matching passed argument |
| | | **Namespace management** |
| kgns | `kubectl get namespaces` | List the current namespaces in a cluster |
+| kcn | `kubectl config set-context ...` | Change current namespace |
| kens | `kubectl edit namespace` | Edit namespace resource from the default editor |
| kdns | `kubectl describe namespace` | Describe namespace resource in detail |
| kdelns | `kubectl delete namespace` | Delete the namespace. WARNING! This deletes everything in the namespace |
@@ -67,6 +69,7 @@ plugins=(... kubectl)
| kdeld | `kubectl delete deployment` | Delete the deployment |
| ksd | `kubectl scale deployment` | Scale a deployment |
| krsd | `kubectl rollout status deployment` | Check the rollout status of a deployment |
+| kres | `kubectl set env $@ REFRESHED_AT=...` | Recreate all pods in deployment with zero-downtime |
| | | **Rollout management** |
| kgrs | `kubectl get rs` | To see the ReplicaSet `rs` created by the deployment |
| krh | `kubectl rollout history` | Check the revisions of this deployment |
diff --git a/plugins/kubectl/kubectl.plugin.zsh b/plugins/kubectl/kubectl.plugin.zsh
index 4cfe3f45b..ab7a1a0a4 100644
--- a/plugins/kubectl/kubectl.plugin.zsh
+++ b/plugins/kubectl/kubectl.plugin.zsh
@@ -13,6 +13,9 @@ fi
# This command is used a LOT both below and in daily life
alias k=kubectl
+# Execute a kubectl command against all namespaces
+alias kca='f(){ kubectl "$@" --all-namespaces; unset -f f; }; f'
+
# Apply a YML file
alias kaf='kubectl apply -f'
@@ -59,6 +62,7 @@ alias kgns='kubectl get namespaces'
alias kens='kubectl edit namespace'
alias kdns='kubectl describe namespace'
alias kdelns='kubectl delete namespace'
+alias kcn='kubectl config set-context $(kubectl config current-context) --namespace'
# ConfigMap management
alias kgcm='kubectl get configmaps'
@@ -80,6 +84,9 @@ alias kdd='kubectl describe deployment'
alias kdeld='kubectl delete deployment'
alias ksd='kubectl scale deployment'
alias krsd='kubectl rollout status deployment'
+kres(){
+ kubectl set env $@ REFRESHED_AT=$(date +%Y%m%d%H%M%S)
+}
# Rollout management.
alias kgrs='kubectl get rs'
diff --git a/plugins/laravel/README.md b/plugins/laravel/README.md
index 067c1e9fb..44798b68d 100644
--- a/plugins/laravel/README.md
+++ b/plugins/laravel/README.md
@@ -1,19 +1,40 @@
-# Laravel plugin
+# Laravel
This plugin adds aliases and autocompletion for Laravel [Artisan](https://laravel.com/docs/artisan) and [Bob](http://daylerees.github.io/laravel-bob/) command-line interfaces.
-**NOTE:** completion might not work for recent Laravel versions since it hasn't been updated since 2012.
-In that case, check out plugins `laravel4` and `laravel5`.
-
-To use it, add `laravel` to the plugins array in your zshrc file:
-
-```zsh
+```
plugins=(... laravel)
```
-## Aliases
+| Alias | Description |
+|:-:|:-:|
+| `artisan` | `php artisan` |
+| `pas` | `php artisan serve` |
+
+## Database
+
+| Alias | Description |
+|:-:|:-:|
+| `pam` | `php artisan migrate` |
+| `pamf` | `php artisan migrate:fresh` |
+| `pamfs` | `php artisan migrate:fresh --seed` |
+| `pamr` | `php artisan migrate:rollback` |
+| `pads` | `php artisan db:seed` |
+
+## Makers
+
+| Alias | Description |
+|:-:|:-:|
+| `pamm` | `php artisan make:model` |
+| `pamc` | `php artisan make:controller` |
+| `pams` | `php artisan make:seeder` |
+| `pamt` | `php artisan make:test` |
+
+## Clears
-| Alias | Command | Description |
-|-----------|--------------------------|----------------------|
-| artisan | `php artisan` | Main Artisan command |
-| bob | `php artisan bob::build` | Main Bob command |
+| Alias | Description |
+|:-:|:-:|
+| `pacac` | `php artisan cache:clear` |
+| `pacoc` | `php artisan config:clear` |
+| `pavic` | `php artisan view:clear` |
+| `paroc` | `php artisan route:clear` |
diff --git a/plugins/laravel/laravel.plugin.zsh b/plugins/laravel/laravel.plugin.zsh
index ed932ee89..7ddfd85ba 100644
--- a/plugins/laravel/laravel.plugin.zsh
+++ b/plugins/laravel/laravel.plugin.zsh
@@ -1,3 +1,26 @@
#!zsh
alias artisan='php artisan'
alias bob='php artisan bob::build'
+
+# Development
+alias pas='php artisan serve'
+
+# Database
+alias pam='php artisan migrate'
+alias pamf='php artisan migrate:fresh'
+alias pamfs='php artisan migrate:fresh --seed'
+alias pamr='php artisan migrate:rollback'
+alias pads='php artisan db:seed'
+
+# Makers
+alias pamm='php artisan make:model'
+alias pamc='php artisan make:controller'
+alias pams='php artisan make:seeder'
+alias pamt='php artisan make:test'
+
+
+# Clears
+alias pacac='php artisan cache:clear'
+alias pacoc='php artisan config:clear'
+alias pavic='php artisan view:clear'
+alias paroc='php artisan route:clear'
diff --git a/plugins/lighthouse/README.md b/plugins/lighthouse/README.md
new file mode 100644
index 000000000..0db29b4e5
--- /dev/null
+++ b/plugins/lighthouse/README.md
@@ -0,0 +1,26 @@
+# Lighthouse plugin
+
+This plugin adds commands to manage [Lighthouse](https://lighthouseapp.com/).
+
+To use it, add `lighthouse` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... lighthouse)
+```
+
+## Commands
+
+* `open_lighthouse_ticket <issue>` (alias: `lho`):
+
+ Opens the URL to the issue passed as an argument. To use it, add a `.lighthouse-url`
+ file in your directory with the URL to the individual project.
+
+ Example:
+ ```zsh
+ $ cat .lighthouse-url
+ https://rails.lighthouseapp.com/projects/8994
+
+ $ lho 23
+ Opening ticket #23
+ # The browser goes to https://rails.lighthouseapp.com/projects/8994/tickets/23
+ ```
diff --git a/plugins/lighthouse/lighthouse.plugin.zsh b/plugins/lighthouse/lighthouse.plugin.zsh
index 4a47b6010..3fca2bf4f 100644
--- a/plugins/lighthouse/lighthouse.plugin.zsh
+++ b/plugins/lighthouse/lighthouse.plugin.zsh
@@ -1,16 +1,12 @@
-# To use: add a .lighthouse file into your directory with the URL to the
-# individual project. For example:
-# https://rails.lighthouseapp.com/projects/8994
-# Example usage: https://screencast.com/t/ZDgwNDUwNT
open_lighthouse_ticket () {
if [ ! -f .lighthouse-url ]; then
echo "There is no .lighthouse-url file in the current directory..."
- return 0;
- else
- lighthouse_url=$(cat .lighthouse-url);
- echo "Opening ticket #$1";
- open_command "$lighthouse_url/tickets/$1";
+ return 0
fi
+
+ lighthouse_url=$(cat .lighthouse-url)
+ echo "Opening ticket #$1"
+ open_command "$lighthouse_url/tickets/$1"
}
alias lho='open_lighthouse_ticket'
diff --git a/plugins/mvn/README.md b/plugins/mvn/README.md
index 986ac84a4..88f5be8ba 100644
--- a/plugins/mvn/README.md
+++ b/plugins/mvn/README.md
@@ -1,7 +1,7 @@
-## Introduction
+# mvn plugin
-The [mvn plugin](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/mvn) provides many
-[useful aliases](#aliases) as well as completion for the `mvn` command.
+The mvn plugin provides many [useful aliases](#aliases) as well as completion for
+the [Apache Maven](https://maven.apache.org/) command (`mvn`).
Enable it by adding `mvn` to the plugins array in your zshrc file:
```zsh
@@ -10,25 +10,49 @@ plugins=(... mvn)
## Aliases
+The plugin aliases mvn to a function that calls `mvnw` (the [Maven Wrapper](https://github.com/takari/maven-wrapper))
+if it's found, or the mvn command otherwise.
+
| Alias | Command |
|:---------------------|:------------------------------------------------|
-| `mvncie` | `mvn clean install eclipse:eclipse` |
+| `mvn!` | `mvn -f <root>/pom.xml` |
+| `mvnag` | `mvn archetype:generate` |
+| `mvnboot` | `mvn spring-boot:run` |
+| `mvnc` | `mvn clean` |
+| `mvncd` | `mvn clean deploy` |
+| `mvnce` | `mvn clean eclipse:clean eclipse:eclipse` |
| `mvnci` | `mvn clean install` |
+| `mvncie` | `mvn clean install eclipse:eclipse` |
+| `mvncini` | `mvn clean initialize` |
| `mvncist` | `mvn clean install -DskipTests` |
| `mvncisto` | `mvn clean install -DskipTests --offline` |
-| `mvne` | `mvn eclipse:eclipse` |
-| `mvncv` | `mvn clean verify` |
-| `mvnd` | `mvn deploy` |
-| `mvnp` | `mvn package` |
-| `mvnc` | `mvn clean` |
| `mvncom` | `mvn compile` |
+| `mvncp` | `mvn clean package` |
| `mvnct` | `mvn clean test` |
-| `mvnt` | `mvn test` |
-| `mvnag` | `mvn archetype:generate` |
-| `mvn-updates` | `mvn versions:display-dependency-updates` |
-| `mvntc7` | `mvn tomcat7:run` |
-| `mvnjetty` | `mvn jetty:run` |
+| `mvncv` | `mvn clean verify` |
+| `mvncvst` | `mvn clean verify -DskipTests` |
+| `mvnd` | `mvn deploy` |
+| `mvndocs` | `mvn dependency:resolve -Dclassifier=javadoc` |
| `mvndt` | `mvn dependency:tree` |
+| `mvne` | `mvn eclipse:eclipse` |
+| `mvnjetty` | `mvn jetty:run` |
+| `mvnp` | `mvn package` |
| `mvns` | `mvn site` |
| `mvnsrc` | `mvn dependency:sources` |
-| `mvndocs` | `mvn dependency:resolve -Dclassifier=javadoc` |
+| `mvnt` | `mvn test` |
+| `mvntc` | `mvn tomcat:run` |
+| `mvntc7` | `mvn tomcat7:run` |
+| `mvn-updates` | `mvn versions:display-dependency-updates` |
+
+## mvn-color
+
+It's a function that wraps the mvn command to colorize it's output. You can use it in place
+of the `mvn` command. For example: instead of `mvn test`, use `mvn-color test`.
+
+Since [Maven 3.5.0](https://maven.apache.org/docs/3.5.0/release-notes.html) the mvn command
+has colored output, so this function will be soon removed from the plugin.
+
+### Known bugs
+
+It has a bug where it will swallow mvn prompts for user input, _e.g._ when using
+`archetype:generate`. See [#5052](https://github.com/robbyrussell/oh-my-zsh/issues/5052).
diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh
index f367fecce..01aef814d 100644
--- a/plugins/mvn/mvn.plugin.zsh
+++ b/plugins/mvn/mvn.plugin.zsh
@@ -1,292 +1,325 @@
-# mvn-color based on https://gist.github.com/1027800
-BOLD=$(tput bold)
-UNDERLINE_ON=$(tput smul)
-UNDERLINE_OFF=$(tput rmul)
-TEXT_BLACK=$(tput setaf 0)
-TEXT_RED=$(tput setaf 1)
-TEXT_GREEN=$(tput setaf 2)
-TEXT_YELLOW=$(tput setaf 3)
-TEXT_BLUE=$(tput setaf 4)
-TEXT_MAGENTA=$(tput setaf 5)
-TEXT_CYAN=$(tput setaf 6)
-TEXT_WHITE=$(tput setaf 7)
-BACKGROUND_BLACK=$(tput setab 0)
-BACKGROUND_RED=$(tput setab 1)
-BACKGROUND_GREEN=$(tput setab 2)
-BACKGROUND_YELLOW=$(tput setab 3)
-BACKGROUND_BLUE=$(tput setab 4)
-BACKGROUND_MAGENTA=$(tput setab 5)
-BACKGROUND_CYAN=$(tput setab 6)
-BACKGROUND_WHITE=$(tput setab 7)
-RESET_FORMATTING=$(tput sgr0)
-
-# if found an executable ./mvnw file execute it otherwise execute orignal mvn
+# Calls ./mvnw if found, otherwise execute the original mvn
mvn-or-mvnw() {
- if [ -x ./mvnw ] ; then
- echo "executing mvnw instead of mvn"
- ./mvnw "$@";
+ if [ -x ./mvnw ]; then
+ echo "executing mvnw instead of mvn"
+ ./mvnw "$@"
else
- mvn "$@";
+ command mvn "$@"
fi
}
-# Wrapper function for Maven's mvn command.
+# Wrapper function for Maven's mvn command. Based on https://gist.github.com/1027800
mvn-color() {
- (
- # Filter mvn output using sed. Before filtering set the locale to C, so invalid characters won't break some sed implementations
- unset LANG
- LC_CTYPE=C mvn "$@" | sed -e "s/\(\[INFO\]\)\(.*\)/${TEXT_BLUE}${BOLD}\1${RESET_FORMATTING}\2/g" \
- -e "s/\(\[INFO\]\ BUILD SUCCESSFUL\)/${BOLD}${TEXT_GREEN}\1${RESET_FORMATTING}/g" \
- -e "s/\(\[WARNING\]\)\(.*\)/${BOLD}${TEXT_YELLOW}\1${RESET_FORMATTING}\2/g" \
- -e "s/\(\[ERROR\]\)\(.*\)/${BOLD}${TEXT_RED}\1${RESET_FORMATTING}\2/g" \
- -e "s/Tests run: \([^,]*\), Failures: \([^,]*\), Errors: \([^,]*\), Skipped: \([^,]*\)/${BOLD}${TEXT_GREEN}Tests run: \1${RESET_FORMATTING}, Failures: ${BOLD}${TEXT_RED}\2${RESET_FORMATTING}, Errors: ${BOLD}${TEXT_RED}\3${RESET_FORMATTING}, Skipped: ${BOLD}${TEXT_YELLOW}\4${RESET_FORMATTING}/g"
-
- # Make sure formatting is reset
- echo -ne "${RESET_FORMATTING}"
- )
-}
+ local BOLD=$(echoti bold)
+ local TEXT_RED=$(echoti setaf 1)
+ local TEXT_GREEN=$(echoti setaf 2)
+ local TEXT_YELLOW=$(echoti setaf 3)
+ local TEXT_BLUE=$(echoti setaf 4)
+ local TEXT_WHITE=$(echoti setaf 7)
+ local RESET_FORMATTING=$(echoti sgr0)
+ (
+ # Filter mvn output using sed. Before filtering set the locale to C, so invalid characters won't break some sed implementations
+ unset LANG
+ LC_CTYPE=C mvn "$@" | sed \
+ -e "s/\(\[INFO\]\)\(.*\)/${TEXT_BLUE}${BOLD}\1${RESET_FORMATTING}\2/g" \
+ -e "s/\(\[DEBUG\]\)\(.*\)/${TEXT_WHITE}${BOLD}\1${RESET_FORMATTING}\2/g" \
+ -e "s/\(\[INFO\]\ BUILD SUCCESSFUL\)/${BOLD}${TEXT_GREEN}\1${RESET_FORMATTING}/g" \
+ -e "s/\(\[WARNING\]\)\(.*\)/${BOLD}${TEXT_YELLOW}\1${RESET_FORMATTING}\2/g" \
+ -e "s/\(\[ERROR\]\)\(.*\)/${BOLD}${TEXT_RED}\1${RESET_FORMATTING}\2/g" \
+ -e "s/Tests run: \([^,]*\), Failures: \([^,]*\), Errors: \([^,]*\), Skipped: \([^,]*\)/${BOLD}${TEXT_GREEN}Tests run: \1${RESET_FORMATTING}, Failures: ${BOLD}${TEXT_RED}\2${RESET_FORMATTING}, Errors: ${BOLD}${TEXT_RED}\3${RESET_FORMATTING}, Skipped: ${BOLD}${TEXT_YELLOW}\4${RESET_FORMATTING}/g"
-# Override the mvn command with the colorized one.
-#alias mvn="mvn-color"
+ # Make sure formatting is reset
+ echo -ne "${RESET_FORMATTING}"
+ )
+}
-# either use orignal mvn oder the mvn wrapper
+# either use orignal mvn or the mvn wrapper
alias mvn="mvn-or-mvnw"
+# Run mvn against the pom found in a project's root directory (assumes a git repo)
+alias 'mvn!'='mvn -f $(git rev-parse --show-toplevel 2>/dev/null || echo ".")/pom.xml'
+
# aliases
-alias mvncie='mvn clean install eclipse:eclipse'
+alias mvnag='mvn archetype:generate'
+alias mvnboot='mvn spring-boot:run'
+alias mvnc='mvn clean'
+alias mvncd='mvn clean deploy'
+alias mvnce='mvn clean eclipse:clean eclipse:eclipse'
alias mvnci='mvn clean install'
+alias mvncie='mvn clean install eclipse:eclipse'
+alias mvncini='mvn clean initialize'
alias mvncist='mvn clean install -DskipTests'
alias mvncisto='mvn clean install -DskipTests --offline'
-alias mvne='mvn eclipse:eclipse'
-alias mvnce='mvn clean eclipse:clean eclipse:eclipse'
-alias mvncv='mvn clean verify'
-alias mvnd='mvn deploy'
-alias mvnp='mvn package'
-alias mvnc='mvn clean'
alias mvncom='mvn compile'
+alias mvncp='mvn clean package'
alias mvnct='mvn clean test'
-alias mvnt='mvn test'
-alias mvnag='mvn archetype:generate'
-alias mvn-updates='mvn versions:display-dependency-updates'
-alias mvntc7='mvn tomcat7:run'
-alias mvntc='mvn tomcat:run'
-alias mvnjetty='mvn jetty:run'
-alias mvnboot='mvn spring-boot:run'
+alias mvncv='mvn clean verify'
+alias mvncvst='mvn clean verify -DskipTests'
+alias mvnd='mvn deploy'
+alias mvndocs='mvn dependency:resolve -Dclassifier=javadoc'
alias mvndt='mvn dependency:tree'
+alias mvne='mvn eclipse:eclipse'
+alias mvnjetty='mvn jetty:run'
+alias mvnp='mvn package'
alias mvns='mvn site'
alias mvnsrc='mvn dependency:sources'
-alias mvndocs='mvn dependency:resolve -Dclassifier=javadoc'
+alias mvnt='mvn test'
+alias mvntc='mvn tomcat:run'
+alias mvntc7='mvn tomcat7:run'
+alias mvn-updates='mvn versions:display-dependency-updates'
+
+
+function listMavenCompletions {
+ local file new_file
+ local -a profiles POM_FILES
+ # Root POM
+ POM_FILES=(~/.m2/settings.xml)
-function listMavenCompletions {
- reply=(
- # common lifecycle
- clean process-resources compile process-test-resources test-compile test integration-test package verify install deploy site
+ # POM in the current directory
+ if [[ -f pom.xml ]]; then
+ local file=pom.xml
+ POM_FILES+=("${file:A}")
+ fi
+
+ # Look for POM files in parent directories
+ while [[ -n "$file" ]] && grep -q "<parent>" "$file"; do
+ # look for a new relativePath for parent pom.xml
+ new_file=$(grep -e "<relativePath>.*</relativePath>" "$file" | sed -e 's/.*<relativePath>\(.*\)<\/relativePath>.*/\1/')
+
+ # if <parent> is present but not defined, assume ../pom.xml
+ if [[ -z "$new_file" ]]; then
+ new_file="../pom.xml"
+ fi
+
+ # if file doesn't exist break
+ file="${file:h}/${new_file}"
+ if ! [[ -e "$file" ]]; then
+ break
+ fi
+
+ POM_FILES+=("${file:A}")
+ done
+
+ # Get profiles from found files
+ for file in $POM_FILES; do
+ [[ -e $file ]] || continue
+ profiles+=($(sed 's/<!--.*-->//' "$file" | sed '/<!--/,/-->/d' | grep -e "<profile>" -A 1 | grep -e "<id>.*</id>" | sed 's?.*<id>\(.*\)<\/id>.*?-P\1?'))
+ done
- # common plugins
- deploy failsafe install site surefire checkstyle javadoc jxr pmd ant antrun archetype assembly dependency enforcer gpg help release repository source eclipse idea jetty cargo jboss tomcat tomcat6 tomcat7 exec versions war ear ejb android scm buildnumber nexus repository sonar license hibernate3 liquibase flyway gwt
+ reply=(
+ # common lifecycle
+ clean initialize process-resources compile process-test-resources test-compile test package verify install deploy site
- # deploy
- deploy:deploy-file
- # failsafe
- failsafe:integration-test failsafe:verify
- # install
- install:install-file install:help
- # site
- site:site site:deploy site:run site:stage site:stage-deploy site:attach-descriptor site:jar site:effective-site
- # surefire
- surefire:test
+ # integration testing
+ pre-integration-test integration-test
- # checkstyle
- checkstyle:checkstyle checkstyle:check checkstyle:checkstyle-aggregate
- # javadoc
- javadoc:javadoc javadoc:test-javadoc javadoc:javadoc-no-fork javadoc:test-javadoc-no-fork javadoc:aggregate javadoc:test-aggregate javadoc:jar javadoc:test-jar javadoc:aggregate-jar javadoc:test-aggregate-jar javadoc:fix javadoc:test-fix javadoc:resource-bundle javadoc:test-resource-bundle
- # jxr
- jxr:jxr jxr:aggregate jxr:test-jxr jxr:test-aggregate
- # pmd
- pmd:pmd pmd:cpd pmd:check pmd:cpd-check
+ # common plugins
+ deploy failsafe install site surefire checkstyle javadoc jxr pmd ant antrun archetype assembly dependency enforcer gpg help release repository source eclipse idea jetty cargo jboss tomcat tomcat6 tomcat7 exec versions war ear ejb android scm buildnumber nexus repository sonar license hibernate3 liquibase flyway gwt
- # ant
- ant:ant ant:clean
- # antrun
- antrun:run
- # archetype
- archetype:generate archetype:create-from-project archetype:crawl
- # assembly
- assembly:single assembly:assembly
- # dependency
- dependency:analyze dependency:analyze-dep-mgt dependency:analyze-only dependency:analyze-report dependency:analyze-duplicate dependency:build-classpath dependency:copy dependency:copy-dependencies dependency:display-ancestors dependency:get dependency:go-offline dependency:list dependency:list-repositories dependency:properties dependency:purge-local-repository dependency:resolve dependency:resolve-plugins dependency:sources dependency:tree dependency:unpack dependency:unpack-dependencies
- # enforcer
- enforcer:enforce enforcer:display-info
- # gpg
- gpg:sign gpg:sign-and-deploy-file
- # help
- help:active-profiles help:all-profiles help:describe help:effective-pom help:effective-settings help:evaluate help:expressions help:system
- # release
- release:clean release:prepare release:prepare-with-pom release:rollback release:perform release:stage release:branch release:update-versions
- # jgitflow
- jgitflow:feature-start jgitflow:feature-finish jgitflow:release-start jgitflow:release-finish jgitflow:hotfix-start jgitflow:hotfix-finish jgitflow:build-number
- # repository
- repository:bundle-create repository:bundle-pack
- # source
- source:aggregate source:jar source:jar-no-fork source:test-jar source:test-jar-no-fork
+ # deploy
+ deploy:deploy-file
+ # failsafe
+ failsafe:integration-test failsafe:verify
+ # install
+ install:install-file install:help
+ # site
+ site:site site:deploy site:run site:stage site:stage-deploy site:attach-descriptor site:jar site:effective-site
+ # surefire
+ surefire:test
- # eclipse
- eclipse:clean eclipse:eclipse
- # idea
- idea:clean idea:idea
+ # checkstyle
+ checkstyle:checkstyle checkstyle:check checkstyle:checkstyle-aggregate
+ # javadoc
+ javadoc:javadoc javadoc:test-javadoc javadoc:javadoc-no-fork javadoc:test-javadoc-no-fork javadoc:aggregate javadoc:test-aggregate javadoc:jar javadoc:test-jar javadoc:aggregate-jar javadoc:test-aggregate-jar javadoc:fix javadoc:test-fix javadoc:resource-bundle javadoc:test-resource-bundle
+ # jxr
+ jxr:jxr jxr:aggregate jxr:test-jxr jxr:test-aggregate
+ # pmd
+ pmd:pmd pmd:cpd pmd:check pmd:cpd-check
- # jetty
- jetty:run jetty:run-exploded
- # cargo
- cargo:start cargo:run cargo:stop cargo:deploy cargo:undeploy cargo:help
- # jboss
- jboss:start jboss:stop jboss:deploy jboss:undeploy jboss:redeploy
- # tomcat
- tomcat:start tomcat:stop tomcat:deploy tomcat:undeploy tomcat:redeploy
- # tomcat6
- tomcat6:run tomcat6:run-war tomcat6:run-war-only tomcat6:stop tomcat6:deploy tomcat6:undeploy
- # tomcat7
- tomcat7:run tomcat7:run-war tomcat7:run-war-only tomcat7:deploy
- # tomee
- tomee:run tomee:run-war tomee:run-war-only tomee:stop tomee:deploy tomee:undeploy
- # spring-boot
- spring-boot:run spring-boot:repackage
- # exec
- exec:exec exec:java
- # versions
- versions:display-dependency-updates versions:display-plugin-updates versions:display-property-updates versions:update-parent versions:update-properties versions:update-child-modules versions:lock-snapshots versions:unlock-snapshots versions:resolve-ranges versions:set versions:use-releases versions:use-next-releases versions:use-latest-releases versions:use-next-snapshots versions:use-latest-snapshots versions:use-next-versions versions:use-latest-versions versions:commit versions:revert
- # scm
- scm:add scm:bootstrap scm:branch scm:changelog scm:check-local-modification scm:checkin scm:checkout scm:diff scm:edit scm:export scm:list scm:remove scm:status scm:tag scm:unedit scm:update scm:update-subprojects scm:validate
- # buildnumber
- buildnumber:create buildnumber:create-timestamp buildnumber:help buildnumber:hgchangeset
+ # ant
+ ant:ant ant:clean
+ # antrun
+ antrun:run
+ # archetype
+ archetype:generate archetype:create-from-project archetype:crawl
+ # assembly
+ assembly:single assembly:assembly
+ # dependency
+ dependency:analyze dependency:analyze-dep-mgt dependency:analyze-only dependency:analyze-report dependency:analyze-duplicate dependency:build-classpath dependency:copy dependency:copy-dependencies dependency:display-ancestors dependency:get dependency:go-offline dependency:list dependency:list-repositories dependency:properties dependency:purge-local-repository dependency:resolve dependency:resolve-plugins dependency:sources dependency:tree dependency:unpack dependency:unpack-dependencies
+ # enforcer
+ enforcer:enforce enforcer:display-info
+ # gpg
+ gpg:sign gpg:sign-and-deploy-file
+ # help
+ help:active-profiles help:all-profiles help:describe help:effective-pom help:effective-settings help:evaluate help:expressions help:system
+ # release
+ release:clean release:prepare release:prepare-with-pom release:rollback release:perform release:stage release:branch release:update-versions
+ # jgitflow
+ jgitflow:feature-start jgitflow:feature-finish jgitflow:release-start jgitflow:release-finish jgitflow:hotfix-start jgitflow:hotfix-finish jgitflow:build-number
+ # repository
+ repository:bundle-create repository:bundle-pack
+ # source
+ source:aggregate source:jar source:jar-no-fork source:test-jar source:test-jar-no-fork
- # war
- war:war war:exploded war:inplace war:manifest
- # ear
- ear:ear ear:generate-application-xml
- # ejb
- ejb:ejb
- # android
- android:apk android:apklib android:deploy android:deploy-dependencies android:dex android:emulator-start android:emulator-stop android:emulator-stop-all android:generate-sources android:help android:instrument android:manifest-update android:pull android:push android:redeploy android:run android:undeploy android:unpack android:version-update android:zipalign android:devices
- # nexus
- nexus:staging-list nexus:staging-close nexus:staging-drop nexus:staging-release nexus:staging-build-promotion nexus:staging-profiles-list nexus:settings-download
- # repository
- repository:bundle-create repository:bundle-pack repository:help
+ # eclipse
+ eclipse:clean eclipse:eclipse
+ # idea
+ idea:clean idea:idea
- # sonar
- sonar:sonar
- # license
- license:format license:check
- # hibernate3
- hibernate3:hbm2ddl hibernate3:help
- # liquibase
- liquibase:changelogSync liquibase:changelogSyncSQL liquibase:clearCheckSums liquibase:dbDoc liquibase:diff liquibase:dropAll liquibase:help liquibase:migrate liquibase:listLocks liquibase:migrateSQL liquibase:releaseLocks liquibase:rollback liquibase:rollbackSQL liquibase:status liquibase:tag liquibase:update liquibase:updateSQL liquibase:updateTestingRollback
- # flyway
- flyway:clean flyway:history flyway:init flyway:migrate flyway:status flyway:validate
- # gwt
- gwt:browser gwt:clean gwt:compile gwt:compile-report gwt:css gwt:debug gwt:eclipse gwt:eclipseTest gwt:generateAsync gwt:help gwt:i18n gwt:mergewebxml gwt:resources gwt:run gwt:sdkInstall gwt:source-jar gwt:soyc gwt:test
- # asciidoctor
- asciidoctor:process-asciidoc asciidoctor:auto-refresh asciidoctor:http asciidoctor:zip
- # compiler
- compiler:compile compiler:testCompile
- # resources
- resources:resources resources:testResources resources:copy-resources
- # verifier
- verifier:verify
- # jar
- jar:jar jar:test-jar
- # rar
- rar:rar
- # acr
- acr:acr
- # shade
- shade:shade
- # changelog
- changelog:changelog changelog:dev-activity changelog:file-activity
- # changes
- changes:announcement-mail changes:announcement-generate changes:changes-check changes:changes-validate changes:changes-report changes:jira-report changes:trac-report changes:github-report
- # doap
- doap:generate
- # docck
- docck:check
- # jdeps
- jdeps:jdkinternals jdeps:test-jdkinternals
- # linkcheck
- linkcheck:linkcheck
- # project-info-reports
- project-info-reports:cim project-info-reports:dependencies project-info-reports:dependency-convergence project-info-reports:dependency-info project-info-reports:dependency-management project-info-reports:distribution-management project-info-reports:help project-info-reports:index project-info-reports:issue-tracking project-info-reports:license project-info-reports:mailing-list project-info-reports:modules project-info-reports:plugin-management project-info-reports:plugins project-info-reports:project-team project-info-reports:scm project-info-reports:summary
- # surefire-report
- surefire-report:failsafe-report-only surefire-report:report surefire-report:report-only
- # invoker
- invoker:install invoker:integration-test invoker:verify invoker:run
- # jarsigner
- jarsigner:sign jarsigner:verify
- # patch
- patch:apply
- # pdf
- pdf:pdf
- # plugin
- plugin:descriptor plugin:report plugin:updateRegistry plugin:addPluginArtifactMetadata plugin:helpmojo
- # remote-resources
- remote-resources:bundle remote-resources:process
- # scm-publish
- scm-publish:help scm-publish:publish-scm scm-publish:scmpublish
- # stage
- stage:copy
- # toolchain
- toolchain:toolchain
-
- # options
- "-Dmaven.test.skip=true" -DskipTests -DskipITs -Dmaven.surefire.debug -DenableCiProfile "-Dpmd.skip=true" "-Dcheckstyle.skip=true" "-Dtycho.mode=maven" "-Dmaven.test.failure.ignore=true" "-DgroupId=" "-DartifactId=" "-Dversion=" "-Dpackaging=jar" "-Dfile="
+ # jetty
+ jetty:run jetty:run-exploded
+ # cargo
+ cargo:start cargo:run cargo:stop cargo:deploy cargo:undeploy cargo:help
+ # jboss
+ jboss:start jboss:stop jboss:deploy jboss:undeploy jboss:redeploy
+ # tomcat
+ tomcat:start tomcat:stop tomcat:deploy tomcat:undeploy tomcat:redeploy
+ # tomcat6
+ tomcat6:run tomcat6:run-war tomcat6:run-war-only tomcat6:stop tomcat6:deploy tomcat6:undeploy
+ # tomcat7
+ tomcat7:run tomcat7:run-war tomcat7:run-war-only tomcat7:deploy
+ # tomee
+ tomee:run tomee:run-war tomee:run-war-only tomee:stop tomee:deploy tomee:undeploy
+ # spring-boot
+ spring-boot:run spring-boot:repackage
+ # exec
+ exec:exec exec:java
+ # versions
+ versions:display-dependency-updates versions:display-plugin-updates versions:display-property-updates versions:update-parent versions:update-properties versions:update-child-modules versions:lock-snapshots versions:unlock-snapshots versions:resolve-ranges versions:set versions:use-releases versions:use-next-releases versions:use-latest-releases versions:use-next-snapshots versions:use-latest-snapshots versions:use-next-versions versions:use-latest-versions versions:commit versions:revert
+ # scm
+ scm:add scm:bootstrap scm:branch scm:changelog scm:check-local-modification scm:checkin scm:checkout scm:diff scm:edit scm:export scm:list scm:remove scm:status scm:tag scm:unedit scm:update scm:update-subprojects scm:validate
+ # buildnumber
+ buildnumber:create buildnumber:create-timestamp buildnumber:help buildnumber:hgchangeset
- # arguments
- -am --also-make
- -amd --also-make-dependents-am
- -B --batch-mode
- -b --builder
- -C --strict-checksums
- -c --lax-checksums
- -cpu --check-plugin-updates
- -D --define
- -e --errors
- -emp --encrypt-master-password
- -ep --encrypt-password
- -f --file
- -fae --fail-at-end
- -ff --fail-fast
- -fn --fail-never
- -gs --global-settings
- -gt --global-toolchains
- -h --help
- -l --log-file
- -llr --legacy-local-repository
- -N --non-recursive
- -npr --no-plugin-registry
- -npu --no-plugin-updates
- -nsu --no-snapshot-updates
- -o --offline
- -P --activate-profiles
- -pl --projects
- -q --quiet
- -rf --resume-from
- -s --settings
- -t --toolchains
- -T --threads
- -U --update-snapshots
- -up --update-plugins
- -v --version
- -V --show-version
- -X --debug
+ # war
+ war:war war:exploded war:inplace war:manifest
+ # ear
+ ear:ear ear:generate-application-xml
+ # ejb
+ ejb:ejb
+ # android
+ android:apk android:apklib android:deploy android:deploy-dependencies android:dex android:emulator-start android:emulator-stop android:emulator-stop-all android:generate-sources android:help android:instrument android:manifest-update android:pull android:push android:redeploy android:run android:undeploy android:unpack android:version-update android:zipalign android:devices
+ # nexus
+ nexus:staging-list nexus:staging-close nexus:staging-drop nexus:staging-release nexus:staging-build-promotion nexus:staging-profiles-list nexus:settings-download
+ # repository
+ repository:bundle-create repository:bundle-pack repository:help
- cli:execute cli:execute-phase
- archetype:generate generate-sources
- cobertura:cobertura
- -Dtest=$(if [ -d ./src/test/java ] ; then find ./src/test/java -type f -name '*.java' | grep -v svn | sed 's?.*/\([^/]*\)\..*?-Dtest=\1?' ; fi)
- -Dit.test=$(if [ -d ./src/test/java ] ; then find ./src/test/java -type f -name '*.java' | grep -v svn | sed 's?.*/\([^/]*\)\..*?-Dit.test=\1?' ; fi)
- );
+ # sonar
+ sonar:sonar
+ # license
+ license:format license:check
+ # hibernate3
+ hibernate3:hbm2ddl hibernate3:help
+ # liquibase
+ liquibase:changelogSync liquibase:changelogSyncSQL liquibase:clearCheckSums liquibase:dbDoc liquibase:diff liquibase:dropAll liquibase:help liquibase:migrate liquibase:listLocks liquibase:migrateSQL liquibase:releaseLocks liquibase:rollback liquibase:rollbackSQL liquibase:status liquibase:tag liquibase:update liquibase:updateSQL liquibase:updateTestingRollback
+ # flyway
+ flyway:clean flyway:history flyway:init flyway:migrate flyway:status flyway:validate
+ # gwt
+ gwt:browser gwt:clean gwt:compile gwt:compile-report gwt:css gwt:debug gwt:eclipse gwt:eclipseTest gwt:generateAsync gwt:help gwt:i18n gwt:mergewebxml gwt:resources gwt:run gwt:sdkInstall gwt:source-jar gwt:soyc gwt:test
+ # asciidoctor
+ asciidoctor:process-asciidoc asciidoctor:auto-refresh asciidoctor:http asciidoctor:zip
+ # compiler
+ compiler:compile compiler:testCompile
+ # resources
+ resources:resources resources:testResources resources:copy-resources
+ # verifier
+ verifier:verify
+ # jar
+ jar:jar jar:test-jar
+ # rar
+ rar:rar
+ # acr
+ acr:acr
+ # shade
+ shade:shade
+ # changelog
+ changelog:changelog changelog:dev-activity changelog:file-activity
+ # changes
+ changes:announcement-mail changes:announcement-generate changes:changes-check changes:changes-validate changes:changes-report changes:jira-report changes:trac-report changes:github-report
+ # doap
+ doap:generate
+ # docck
+ docck:check
+ # jdeps
+ jdeps:jdkinternals jdeps:test-jdkinternals
+ # linkcheck
+ linkcheck:linkcheck
+ # project-info-reports
+ project-info-reports:cim project-info-reports:dependencies project-info-reports:dependency-convergence project-info-reports:dependency-info project-info-reports:dependency-management project-info-reports:distribution-management project-info-reports:help project-info-reports:index project-info-reports:issue-tracking project-info-reports:license project-info-reports:mailing-list project-info-reports:modules project-info-reports:plugin-management project-info-reports:plugins project-info-reports:project-team project-info-reports:scm project-info-reports:summary
+ # surefire-report
+ surefire-report:failsafe-report-only surefire-report:report surefire-report:report-only
+ # invoker
+ invoker:install invoker:integration-test invoker:verify invoker:run
+ # jarsigner
+ jarsigner:sign jarsigner:verify
+ # patch
+ patch:apply
+ # pdf
+ pdf:pdf
+ # plugin
+ plugin:descriptor plugin:report plugin:updateRegistry plugin:addPluginArtifactMetadata plugin:helpmojo
+ # remote-resources
+ remote-resources:bundle remote-resources:process
+ # scm-publish
+ scm-publish:help scm-publish:publish-scm scm-publish:scmpublish
+ # stage
+ stage:copy
+ # toolchain
+ toolchain:toolchain
+
+ # options
+ "-Dmaven.test.skip=true" -DskipTests -DskipITs -Dmaven.surefire.debug -DenableCiProfile "-Dpmd.skip=true" "-Dcheckstyle.skip=true" "-Dtycho.mode=maven" "-Dmaven.test.failure.ignore=true" "-DgroupId=" "-DartifactId=" "-Dversion=" "-Dpackaging=jar" "-Dfile="
+
+ # arguments
+ -am --also-make
+ -amd --also-make-dependents-am
+ -B --batch-mode
+ -b --builder
+ -C --strict-checksums
+ -c --lax-checksums
+ -cpu --check-plugin-updates
+ -D --define
+ -e --errors
+ -emp --encrypt-master-password
+ -ep --encrypt-password
+ -f --file
+ -fae --fail-at-end
+ -ff --fail-fast
+ -fn --fail-never
+ -gs --global-settings
+ -gt --global-toolchains
+ -h --help
+ -l --log-file
+ -llr --legacy-local-repository
+ -N --non-recursive
+ -npr --no-plugin-registry
+ -npu --no-plugin-updates
+ -nsu --no-snapshot-updates
+ -o --offline
+ -P --activate-profiles
+ -pl --projects
+ -q --quiet
+ -rf --resume-from
+ -s --settings
+ -t --toolchains
+ -T --threads
+ -U --update-snapshots
+ -up --update-plugins
+ -v --version
+ -V --show-version
+ -X --debug
+
+ cli:execute cli:execute-phase
+ archetype:generate generate-sources
+ cobertura:cobertura
+ -Dtest=$(if [ -d ./src/test/java ] ; then find ./src/test/java -type f -name '*.java' | grep -v svn | sed 's?.*/\([^/]*\)\..*?-Dtest=\1?' ; fi)
+ -Dit.test=$(if [ -d ./src/test/java ] ; then find ./src/test/java -type f -name '*.java' | grep -v svn | sed 's?.*/\([^/]*\)\..*?-Dit.test=\1?' ; fi)
+
+ $profiles
+ )
}
-compctl -K listMavenCompletions mvn
+compctl -K listMavenCompletions mvn mvnw
+compctl -K listMavenCompletions mvn-color
compctl -K listMavenCompletions mvn-or-mvnw
-
diff --git a/plugins/nvm/nvm.plugin.zsh b/plugins/nvm/nvm.plugin.zsh
index 9dde3a266..4bab8e9d7 100644
--- a/plugins/nvm/nvm.plugin.zsh
+++ b/plugins/nvm/nvm.plugin.zsh
@@ -1,5 +1,8 @@
# Set NVM_DIR if it isn't already defined
[[ -z "$NVM_DIR" ]] && export NVM_DIR="$HOME/.nvm"
-# Load nvm if it exists
-[[ -f "$NVM_DIR/nvm.sh" ]] && source "$NVM_DIR/nvm.sh"
+# Try to load nvm only if command not already available
+if ! type "nvm" &> /dev/null; then
+ # Load nvm if it exists
+ [[ -f "$NVM_DIR/nvm.sh" ]] && source "$NVM_DIR/nvm.sh"
+fi
diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh
index a1c73a184..7deed0ba6 100644
--- a/plugins/osx/osx.plugin.zsh
+++ b/plugins/osx/osx.plugin.zsh
@@ -51,6 +51,17 @@ EOF
end tell
end tell
EOF
+ elif [[ "$the_app" == 'Hyper' ]]; then
+ osascript >/dev/null <<EOF
+ tell application "System Events"
+ tell process "Hyper" to keystroke "t" using command down
+ end tell
+ delay 1
+ tell application "System Events"
+ keystroke "${command}"
+ key code 36 #(presses enter)
+ end tell
+EOF
else
echo "tab: unsupported terminal app: $the_app"
@@ -91,6 +102,19 @@ EOF
end tell
end tell
EOF
+
+ elif [[ "$the_app" == 'Hyper' ]]; then
+ osascript >/dev/null <<EOF
+ tell application "System Events"
+ tell process "Hyper"
+ tell menu item "Split Vertically" of menu "Shell" of menu bar 1
+ click
+ end tell
+ end tell
+ delay 1
+ keystroke "${command} \n"
+ end tell
+EOF
else
echo "$0: unsupported terminal app: $the_app" >&2
@@ -132,6 +156,19 @@ EOF
end tell
EOF
+ elif [[ "$the_app" == 'Hyper' ]]; then
+ osascript >/dev/null <<EOF
+ tell application "System Events"
+ tell process "Hyper"
+ tell menu item "Split Horizontally" of menu "Shell" of menu bar 1
+ click
+ end tell
+ end tell
+ delay 1
+ keystroke "${command} \n"
+ end tell
+EOF
+
else
echo "$0: unsupported terminal app: $the_app" >&2
false
diff --git a/plugins/osx/spotify b/plugins/osx/spotify
index 2ab98d3a0..b4215dbe7 100644
--- a/plugins/osx/spotify
+++ b/plugins/osx/spotify
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
function spotify() {
-# Copyright (c) 2012--2017 Harish Narayanan <mail@harishnarayanan.org>
+# Copyright (c) 2012--2018 Harish Narayanan <mail@harishnarayanan.org>
#
# Contains numerous helpful contributions from Jorge Colindres, Thomas
# Pritchard, iLan Epstein, Gabriele Bonetti, Sean Heller, Eric Martin
@@ -134,8 +134,13 @@ showStatus () {
if [ $# = 0 ]; then
showHelp;
else
+ if [ ! -d /Applications/Spotify.app ] && [ ! -d $HOME/Applications/Spotify.app ]; then
+ echo "The Spotify application must be installed."
+ exit 1
+ fi
+
if [ $(osascript -e 'application "Spotify" is running') = "false" ]; then
- osascript -e 'tell application "Spotify" to activate'
+ osascript -e 'tell application "Spotify" to activate' || exit 1
sleep 2
fi
fi
@@ -160,7 +165,7 @@ while [ $# -gt 0 ]; do
showAPIHelp;
exit 1;
fi
- SHPOTIFY_CREDENTIALS=$(printf "${CLIENT_ID}:${CLIENT_SECRET}" | base64 | tr -d "\n");
+ SHPOTIFY_CREDENTIALS=$(printf "${CLIENT_ID}:${CLIENT_SECRET}" | base64 | tr -d "\n"|tr -d '\r');
SPOTIFY_PLAY_URI="";
getAccessToken() {
diff --git a/plugins/otp/otp.plugin.zsh b/plugins/otp/otp.plugin.zsh
new file mode 100644
index 000000000..4bce34fd3
--- /dev/null
+++ b/plugins/otp/otp.plugin.zsh
@@ -0,0 +1,54 @@
+export OTP_HOME=~/.otp
+mkdir -p $OTP_HOME
+
+function ot () {
+ if ! command -v oathtool > /dev/null 2>&1; then
+ echo "Note: you need to install oathtool or oath-toolkit, depending on your OS or distribution."
+ return 1
+ fi
+
+ if ! command -v gpg > /dev/null 2>&1; then
+ echo "Note: you need to install gpg and create an ID using 'gpg --gen-key', unless you have one already."
+ return 1
+ fi
+
+ if [[ `uname` == 'Darwin' ]] then # MacOS X
+ export COPY_CMD='pbcopy'
+ elif command -v xsel > /dev/null 2>&1; then # Any Unix with xsel installed
+ export COPY_CMD='xsel --clipboard --input'
+ else
+ COPY_CMD='true'
+ fi
+
+ if [[ "x$1" == "x" ]]; then
+ echo "usage: otpw <profile.name>"
+ return 1
+ elif [ ! -f $OTP_HOME/$1.otp.asc ]; then
+ echo "missing profile $1, you might need to create it first using otp_add_device"
+ return 1
+ else
+ totpkey=$(gpg --decrypt $OTP_HOME/$1.otp.asc)
+ oathtool --totp --b $totpkey | tee /dev/stderr | `echo $COPY_CMD`
+ if [[ $COPY_CMD == 'true' ]] then
+ echo "Note: you might consider installing xsel for clipboard integration"
+ fi
+ fi
+}
+
+function otp_add_device () {
+ if [[ "x$1" == "x" ]] then
+ echo "usage: otp_add <profile.name>"
+ return 1
+ else
+ echo "Enter an email address attached to your GPG private key, then paste the secret configuration key followed by ^D"
+
+ rm -f $OTP_HOME/$1.otp.asc
+ gpg --armor --encrypt --output $OTP_HOME/$1.otp.asc /dev/stdin
+ fi
+}
+
+function otp_devices () {
+ reply=($(find $OTP_HOME -name \*.otp.asc | xargs basename -s .otp.asc))
+}
+
+compctl -K otp_devices ot
diff --git a/plugins/per-directory-history/per-directory-history.zsh b/plugins/per-directory-history/per-directory-history.zsh
index 53ad963e7..41de2f91d 100644
--- a/plugins/per-directory-history/per-directory-history.zsh
+++ b/plugins/per-directory-history/per-directory-history.zsh
@@ -26,7 +26,7 @@
#
# [1]: http://www.compbiome.com/2010/07/bash-per-directory-bash-history.html
# [2]: http://dieter.plaetinck.be/per_directory_bash
-# [3]: https://www.zsh.org/mla/users/1997/msg00226.html
+# [3]: http://www.zsh.org/mla/users/1997/msg00226.html
#
################################################################################
#
@@ -109,8 +109,13 @@ function _per-directory-history-change-directory() {
}
function _per-directory-history-addhistory() {
- print -Sr -- "${1%%$'\n'}"
- fc -p $_per_directory_history_directory
+ # respect hist_ignore_space
+ if [[ -o hist_ignore_space ]] && [[ "$1" == \ * ]]; then
+ true
+ else
+ print -Sr -- "${1%%$'\n'}"
+ fc -p $_per_directory_history_directory
+ fi
}
diff --git a/plugins/pip/pip.plugin.zsh b/plugins/pip/pip.plugin.zsh
index d7236b02a..5539187e1 100644
--- a/plugins/pip/pip.plugin.zsh
+++ b/plugins/pip/pip.plugin.zsh
@@ -10,7 +10,7 @@
# "zsh-pip-clear-cache".
ZSH_PIP_CACHE_FILE=~/.pip/zsh-cache
-ZSH_PIP_INDEXES=(https://pypi.python.org/simple/)
+ZSH_PIP_INDEXES=(https://pypi.org/simple/)
zsh-pip-clear-cache() {
rm $ZSH_PIP_CACHE_FILE
@@ -31,7 +31,7 @@ zsh-pip-cache-packages() {
tmp_cache=/tmp/zsh_tmp_cache
for index in $ZSH_PIP_INDEXES ; do
# well... I've already got two problems
- curl $index 2>/dev/null | \
+ curl -L $index 2>/dev/null | \
zsh-pip-clean-packages \
>> $tmp_cache
done
diff --git a/plugins/pyenv/pyenv.plugin.zsh b/plugins/pyenv/pyenv.plugin.zsh
index dbc7da472..4e92b8017 100644
--- a/plugins/pyenv/pyenv.plugin.zsh
+++ b/plugins/pyenv/pyenv.plugin.zsh
@@ -4,7 +4,7 @@
FOUND_PYENV=$+commands[pyenv]
if [[ $FOUND_PYENV -ne 1 ]]; then
- pyenvdirs=("$HOME/.pyenv" "/usr/local/pyenv" "/opt/pyenv")
+ pyenvdirs=("$HOME/.pyenv" "/usr/local/pyenv" "/opt/pyenv" "/usr/local/opt/pyenv")
for dir in $pyenvdirs; do
if [[ -d $dir/bin ]]; then
export PATH="$PATH:$dir/bin"
diff --git a/plugins/rake-fast/rake-fast.plugin.zsh b/plugins/rake-fast/rake-fast.plugin.zsh
index ca80d86e1..19dab154b 100644
--- a/plugins/rake-fast/rake-fast.plugin.zsh
+++ b/plugins/rake-fast/rake-fast.plugin.zsh
@@ -20,7 +20,7 @@ _tasks_changed () {
}
_rake_generate () {
- rake --silent --tasks | cut -d " " -f 2 > .rake_tasks
+ rake --silent --tasks | cut -d " " -f 2 | sed 's/\[.*\]//g' > .rake_tasks
}
_rake () {
diff --git a/plugins/react-native/README.md b/plugins/react-native/README.md
index d1fce0fc2..0cfaa36b4 100644
--- a/plugins/react-native/README.md
+++ b/plugins/react-native/README.md
@@ -11,28 +11,45 @@ plugins=(... react-native)
## Aliases
-| Alias | React Native command |
-| :------------ | :------------------------------------------------- |
-| **rn** | `react-native` |
-| **rns** | `react-native start` |
-| **rnlink** | `react-native link` |
-| _App testing_ |
-| **rnand** | `react-native run-android` |
-| **rnios** | `react-native run-ios` |
-| **rnios4s** | `react-native run-ios --simulator "iPhone 4s"` |
-| **rnios5** | `react-native run-ios --simulator "iPhone 5"` |
-| **rnios5s** | `react-native run-ios --simulator "iPhone 5s"` |
-| **rnios6** | `react-native run-ios --simulator "iPhone 6"` |
-| **rnios6s** | `react-native run-ios --simulator "iPhone 6s"` |
-| **rnios7** | `react-native run-ios --simulator "iPhone7"` |
-| **rnios7p** | `react-native run-ios --simulator "iPhone 7 Plus"` |
-| **rnios8** | `react-native run-ios --simulator "iPhone 8"` |
-| **rnios8p** | `react-native run-ios --simulator "iPhone 8 Plus"` |
-| **rniosse** | `react-native run-ios --simulator "iPhone SE"` |
-| **rniosx** | `react-native run-ios --simulator "iPhone X"` |
-| **rniosxs** | `react-native run-ios --simulator "iPhone XS"` |
-| **rniosxsm** | `react-native run-ios --simulator "iPhone XS Max"` |
-| **rniosxr** | `react-native run-ios --simulator "iPhone XR"` |
-| _Logging_ |
-| **rnland** | `react-native log-android` |
-| **rnlios** | `react-native log-ios` |
+| Alias | React Native command |
+| :------------ | :------------------------------------------------- |
+| **rn** | `react-native` |
+| **rns** | `react-native start` |
+| **rnlink** | `react-native link` |
+| _App testing_ |
+| **rnand** | `react-native run-android` |
+| **rnios** | `react-native run-ios` |
+| **rnios4s** | `react-native run-ios --simulator "iPhone 4s"` |
+| **rnios5** | `react-native run-ios --simulator "iPhone 5"` |
+| **rnios5s** | `react-native run-ios --simulator "iPhone 5s"` |
+| **rnios6** | `react-native run-ios --simulator "iPhone 6"` |
+| **rnios6s** | `react-native run-ios --simulator "iPhone 6s"` |
+| **rnios7** | `react-native run-ios --simulator "iPhone7"` |
+| **rnios7p** | `react-native run-ios --simulator "iPhone 7 Plus"` |
+| **rnios8** | `react-native run-ios --simulator "iPhone 8"` |
+| **rnios8p** | `react-native run-ios --simulator "iPhone 8 Plus"` |
+| **rniosse** | `react-native run-ios --simulator "iPhone SE"` |
+| **rniosx** | `react-native run-ios --simulator "iPhone X"` |
+| **rniosxs** | `react-native run-ios --simulator "iPhone XS"` |
+| **rniosxsm** | `react-native run-ios --simulator "iPhone XS Max"` |
+| **rniosxr** | `react-native run-ios --simulator "iPhone XR"` |
+| _iPads_ | |
+| **rnipad2** | `react-native run-ios --simulator "iPad 2"` |
+| **rnipadr** | `react-native run-ios --simulator "iPad Retina"` |
+| **rnipada** | 'react-native run-ios --simulator "iPad Air"' |
+| **rnipada2** | 'react-native run-ios --simulator "iPad Air 2"' |
+| **rnipad5** | 'react-native run-ios --simulator "iPad (5th generation)"' |
+| **rnipad9** | 'react-native run-ios --simulator "iPad Pro (9.7-inch)"' |
+| **rnipad12** | 'react-native run-ios --simulator "iPad Pro (12.9-inch)"' |
+| **rnipad122** | 'react-native run-ios --simulator "iPad Pro (12.9-inch) (2nd generation)"' |
+| **rnipad10** | 'react-native run-ios --simulator "iPad Pro (10.5-inch)"' |
+| **rnipad6** | 'react-native run-ios --simulator "iPad Pro (6th generation)"' |
+| **rnipad11** | 'react-native run-ios --simulator "iPad Pro (11-inch)"' |
+| **rnipad123** | 'react-native run-ios --simulator "iPad Pro (12.9-inch) (3rd generation)"' |
+| _Apple TVs_ | |
+| **rnatv** | `react-native run-ios --simulator "Apple TV"` |
+| **rnatv4k** | `react-native run-ios --simulator "Apple TV 4K"` |
+| **rnatv4k1080**| `react-native run-ios --simulator "Apple TV 4K (at 1080p)"` |
+| _Logging_ |
+| **rnland** | `react-native log-android` |
+| **rnlios** | `react-native log-ios` |
diff --git a/plugins/react-native/react-native.plugin.zsh b/plugins/react-native/react-native.plugin.zsh
index 220aa2dce..a4092a694 100644
--- a/plugins/react-native/react-native.plugin.zsh
+++ b/plugins/react-native/react-native.plugin.zsh
@@ -19,5 +19,22 @@ alias rniosxs='react-native run-ios --simulator "iPhone XS"'
alias rniosxsm='react-native run-ios --simulator "iPhone XS Max"'
alias rniosxr='react-native run-ios --simulator "iPhone XR"'
+alias rnipad2='react-native run-ios --simulator "iPad 2"'
+alias rnipadr='react-native run-ios --simulator "iPad Retina"'
+alias rnipada='react-native run-ios --simulator "iPad Air"'
+alias rnipada2='react-native run-ios --simulator "iPad Air 2"'
+alias rnipad5='react-native run-ios --simulator "iPad (5th generation)"'
+alias rnipad9='react-native run-ios --simulator "iPad Pro (9.7-inch)"'
+alias rnipad12='react-native run-ios --simulator "iPad Pro (12.9-inch)"'
+alias rnipad122='react-native run-ios --simulator "iPad Pro (12.9-inch) (2nd generation)"'
+alias rnipad10='react-native run-ios --simulator "iPad Pro (10.5-inch)"'
+alias rnipad6='react-native run-ios --simulator "iPad Pro (6th generation)"'
+alias rnipad11='react-native run-ios --simulator "iPad Pro (11-inch)"'
+alias rnipad123='react-native run-ios --simulator "iPad Pro (12.9-inch) (3rd generation)"'
+
+alias rnatv='react-native run-ios --simulator "Apple TV"'
+alias rnatv4k='react-native run-ios --simulator "Apple TV 4K"'
+alias rnatv4k1080='react-native run-ios --simulator "Apple TV 4K (at 1080p)"'
+
alias rnland='react-native log-android'
alias rnlios='react-native log-ios'
diff --git a/plugins/ripgrep/README.md b/plugins/ripgrep/README.md
new file mode 100644
index 000000000..794b105ee
--- /dev/null
+++ b/plugins/ripgrep/README.md
@@ -0,0 +1,13 @@
+# ripgrep
+
+This plugin adds completion for the text search tool [`ripgrep`](https://github.com/BurntSushi/ripgrep), also known as `rg`.
+
+To use it, add `ripgrep` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... ripgrep)
+```
+
+Completion is taken from the ripgrep release [`0.10.0`](https://github.com/BurntSushi/ripgrep/releases/tag/0.10.0).
+
+Updated on September 27th, 2018.
diff --git a/plugins/ripgrep/_ripgrep b/plugins/ripgrep/_ripgrep
new file mode 100644
index 000000000..53f135dde
--- /dev/null
+++ b/plugins/ripgrep/_ripgrep
@@ -0,0 +1,433 @@
+#compdef rg
+
+##
+# zsh completion function for ripgrep
+#
+# Originally based on code from the zsh-users project — see copyright notice
+# below.
+
+_rg() {
+ local curcontext=$curcontext no='!' descr ret=1
+ local -a context line state state_descr args tmp suf
+ local -A opt_args
+
+ # ripgrep has many options which negate the effect of a more common one — for
+ # example, `--no-column` to negate `--column`, and `--messages` to negate
+ # `--no-messages`. There are so many of these, and they're so infrequently
+ # used, that some users will probably find it irritating if they're completed
+ # indiscriminately, so let's not do that unless either the current prefix
+ # matches one of those negation options or the user has the `complete-all`
+ # style set. Note that this prefix check has to be updated manually to account
+ # for all of the potential negation options listed below!
+ if
+ # We also want to list all of these options during testing
+ [[ $_RG_COMPLETE_LIST_ARGS == (1|t*|y*) ]] ||
+ # (--[imnp]* => --ignore*, --messages, --no-*, --pcre2-unicode)
+ [[ $PREFIX$SUFFIX == --[imnp]* ]] ||
+ zstyle -t ":complete:$curcontext:*" complete-all
+ then
+ no=
+ fi
+
+ # We make heavy use of argument groups here to prevent the option specs from
+ # growing unwieldy. These aren't supported in zsh <5.4, though, so we'll strip
+ # them out below if necessary. This makes the exclusions inaccurate on those
+ # older versions, but oh well — it's not that big a deal
+ args=(
+ + '(exclusive)' # Misc. fully exclusive options
+ '(: * -)'{-h,--help}'[display help information]'
+ '(: * -)'{-V,--version}'[display version information]'
+
+ + '(buffered)' # buffering options
+ '--line-buffered[force line buffering]'
+ $no"--no-line-buffered[don't force line buffering]"
+ '--block-buffered[force block buffering]'
+ $no"--no-block-buffered[don't force block buffering]"
+
+ + '(case)' # Case-sensitivity options
+ {-i,--ignore-case}'[search case-insensitively]'
+ {-s,--case-sensitive}'[search case-sensitively]'
+ {-S,--smart-case}'[search case-insensitively if pattern is all lowercase]'
+
+ + '(context-a)' # Context (after) options
+ '(context-c)'{-A+,--after-context=}'[specify lines to show after each match]:number of lines'
+
+ + '(context-b)' # Context (before) options
+ '(context-c)'{-B+,--before-context=}'[specify lines to show before each match]:number of lines'
+
+ + '(context-c)' # Context (combined) options
+ '(context-a context-b)'{-C+,--context=}'[specify lines to show before and after each match]:number of lines'
+
+ + '(column)' # Column options
+ '--column[show column numbers for matches]'
+ $no"--no-column[don't show column numbers for matches]"
+
+ + '(count)' # Counting options
+ {-c,--count}'[only show count of matching lines for each file]'
+ '--count-matches[only show count of individual matches for each file]'
+
+ + '(encoding)' # Encoding options
+ {-E+,--encoding=}'[specify text encoding of files to search]: :_rg_encodings'
+ $no'--no-encoding[use default text encoding]'
+
+ + file # File-input options
+ '(1)*'{-f+,--file=}'[specify file containing patterns to search for]: :_files'
+
+ + '(file-match)' # Files with/without match options
+ '(stats)'{-l,--files-with-matches}'[only show names of files with matches]'
+ '(stats)--files-without-match[only show names of files without matches]'
+
+ + '(file-name)' # File-name options
+ {-H,--with-filename}'[show file name for matches]'
+ "--no-filename[don't show file name for matches]"
+
+ + '(file-system)' # File system options
+ "--one-file-system[don't descend into directories on other file systems]"
+ $no'--no-one-file-system[descend into directories on other file systems]'
+
+ + '(fixed)' # Fixed-string options
+ {-F,--fixed-strings}'[treat pattern as literal string instead of regular expression]'
+ $no"--no-fixed-strings[don't treat pattern as literal string]"
+
+ + '(follow)' # Symlink-following options
+ {-L,--follow}'[follow symlinks]'
+ $no"--no-follow[don't follow symlinks]"
+
+ + glob # File-glob options
+ '*'{-g+,--glob=}'[include/exclude files matching specified glob]:glob'
+ '*--iglob=[include/exclude files matching specified case-insensitive glob]:glob'
+
+ + '(heading)' # Heading options
+ '(pretty-vimgrep)--heading[show matches grouped by file name]'
+ "(pretty-vimgrep)--no-heading[don't show matches grouped by file name]"
+
+ + '(hidden)' # Hidden-file options
+ '--hidden[search hidden files and directories]'
+ $no"--no-hidden[don't search hidden files and directories]"
+
+ + '(ignore)' # Ignore-file options
+ "(--no-ignore-global --no-ignore-parent --no-ignore-vcs)--no-ignore[don't respect ignore files]"
+ $no'(--ignore-global --ignore-parent --ignore-vcs)--ignore[respect ignore files]'
+
+ + '(ignore-global)' # Global ignore-file options
+ "--no-ignore-global[don't respect global ignore files]"
+ $no'--ignore-global[respect global ignore files]'
+
+ + '(ignore-parent)' # Parent ignore-file options
+ "--no-ignore-parent[don't respect ignore files in parent directories]"
+ $no'--ignore-parent[respect ignore files in parent directories]'
+
+ + '(ignore-vcs)' # VCS ignore-file options
+ "--no-ignore-vcs[don't respect version control ignore files]"
+ $no'--ignore-vcs[respect version control ignore files]'
+
+ + '(json)' # JSON options
+ '--json[output results in JSON Lines format]'
+ $no"--no-json[don't output results in JSON Lines format]"
+
+ + '(line-number)' # Line-number options
+ {-n,--line-number}'[show line numbers for matches]'
+ {-N,--no-line-number}"[don't show line numbers for matches]"
+
+ + '(line-terminator)' # Line-terminator options
+ '--crlf[use CRLF as line terminator]'
+ $no"--no-crlf[don't use CRLF as line terminator]"
+ '(text)--null-data[use NUL as line terminator]'
+
+ + '(max-depth)' # Directory-depth options
+ '--max-depth=[specify max number of directories to descend]:number of directories'
+ '!--maxdepth=:number of directories'
+
+ + '(messages)' # Error-message options
+ '(--no-ignore-messages)--no-messages[suppress some error messages]'
+ $no"--messages[don't suppress error messages affected by --no-messages]"
+
+ + '(messages-ignore)' # Ignore-error message options
+ "--no-ignore-messages[don't show ignore-file parse error messages]"
+ $no'--ignore-messages[show ignore-file parse error messages]'
+
+ + '(mmap)' # mmap options
+ '--mmap[search using memory maps when possible]'
+ "--no-mmap[don't search using memory maps]"
+
+ + '(multiline)' # Multiline options
+ {-U,--multiline}'[permit matching across multiple lines]'
+ $no'(multiline-dotall)--no-multiline[restrict matches to at most one line each]'
+
+ + '(multiline-dotall)' # Multiline DOTALL options
+ '(--no-multiline)--multiline-dotall[allow "." to match newline (with -U)]'
+ $no"(--no-multiline)--no-multiline-dotall[don't allow \".\" to match newline (with -U)]"
+
+ + '(only)' # Only-match options
+ {-o,--only-matching}'[show only matching part of each line]'
+
+ + '(passthru)' # Pass-through options
+ '(--vimgrep)--passthru[show both matching and non-matching lines]'
+ '!(--vimgrep)--passthrough'
+
+ + '(pcre2)' # PCRE2 options
+ {-P,--pcre2}'[enable matching with PCRE2]'
+ $no'(pcre2-unicode)--no-pcre2[disable matching with PCRE2]'
+
+ + '(pcre2-unicode)' # PCRE2 Unicode options
+ $no'(--no-pcre2 --no-pcre2-unicode)--pcre2-unicode[enable PCRE2 Unicode mode (with -P)]'
+ '(--no-pcre2 --pcre2-unicode)--no-pcre2-unicode[disable PCRE2 Unicode mode (with -P)]'
+
+ + '(pre)' # Preprocessing options
+ '(-z --search-zip)--pre=[specify preprocessor utility]:preprocessor utility:_command_names -e'
+ $no'--no-pre[disable preprocessor utility]'
+
+ + pre-glob # Preprocessing glob options
+ '*--pre-glob[include/exclude files for preprocessing with --pre]'
+
+ + '(pretty-vimgrep)' # Pretty/vimgrep display options
+ '(heading)'{-p,--pretty}'[alias for --color=always --heading -n]'
+ '(heading passthru)--vimgrep[show results in vim-compatible format]'
+
+ + regexp # Explicit pattern options
+ '(1 file)*'{-e+,--regexp=}'[specify pattern]:pattern'
+
+ + '(replace)' # Replacement options
+ {-r+,--replace=}'[specify string used to replace matches]:replace string'
+
+ + '(sort)' # File-sorting options
+ '(threads)--sort=[sort results in ascending order (disables parallelism)]:sort method:((
+ none\:"no sorting"
+ path\:"sort by file path"
+ modified\:"sort by last modified time"
+ accessed\:"sort by last accessed time"
+ created\:"sort by creation time"
+ ))'
+ '(threads)--sortr=[sort results in descending order (disables parallelism)]:sort method:((
+ none\:"no sorting"
+ path\:"sort by file path"
+ modified\:"sort by last modified time"
+ accessed\:"sort by last accessed time"
+ created\:"sort by creation time"
+ ))'
+ '!(threads)--sort-files[sort results by file path (disables parallelism)]'
+
+ + '(stats)' # Statistics options
+ '(--files file-match)--stats[show search statistics]'
+ $no"--no-stats[don't show search statistics]"
+
+ + '(text)' # Binary-search options
+ {-a,--text}'[search binary files as if they were text]'
+ $no"(--null-data)--no-text[don't search binary files as if they were text]"
+
+ + '(threads)' # Thread-count options
+ '(sort)'{-j+,--threads=}'[specify approximate number of threads to use]:number of threads'
+
+ + '(trim)' # Trim options
+ '--trim[trim any ASCII whitespace prefix from each line]'
+ $no"--no-trim[don't trim ASCII whitespace prefix from each line]"
+
+ + type # Type options
+ '*'{-t+,--type=}'[only search files matching specified type]: :_rg_types'
+ '*--type-add=[add new glob for specified file type]: :->typespec'
+ '*--type-clear=[clear globs previously defined for specified file type]: :_rg_types'
+ # This should actually be exclusive with everything but other type options
+ '(: *)--type-list[show all supported file types and their associated globs]'
+ '*'{-T+,--type-not=}"[don't search files matching specified file type]: :_rg_types"
+
+ + '(word-line)' # Whole-word/line match options
+ {-w,--word-regexp}'[only show matches surrounded by word boundaries]'
+ {-x,--line-regexp}'[only show matches surrounded by line boundaries]'
+
+ + '(zip)' # Compression options
+ '(--pre)'{-z,--search-zip}'[search in compressed files]'
+ $no"--no-search-zip[don't search in compressed files]"
+
+ + misc # Other options — no need to separate these at the moment
+ '(-b --byte-offset)'{-b,--byte-offset}'[show 0-based byte offset for each matching line]'
+ '--color=[specify when to use colors in output]:when:((
+ never\:"never use colors"
+ auto\:"use colors or not based on stdout, TERM, etc."
+ always\:"always use colors"
+ ansi\:"always use ANSI colors (even on Windows)"
+ ))'
+ '*--colors=[specify color and style settings]: :->colorspec'
+ '--context-separator=[specify string used to separate non-continuous context lines in output]:separator'
+ '--debug[show debug messages]'
+ '--dfa-size-limit=[specify upper size limit of generated DFA]:DFA size (bytes)'
+ "(1 stats)--files[show each file that would be searched (but don't search)]"
+ '*--ignore-file=[specify additional ignore file]:ignore file:_files'
+ '(-v --invert-match)'{-v,--invert-match}'[invert matching]'
+ '(-M --max-columns)'{-M+,--max-columns=}'[specify max length of lines to print]:number of bytes'
+ '(-m --max-count)'{-m+,--max-count=}'[specify max number of matches per file]:number of matches'
+ '--max-filesize=[specify size above which files should be ignored]:file size (bytes)'
+ "--no-config[don't load configuration files]"
+ '(-0 --null)'{-0,--null}'[print NUL byte after file names]'
+ '--path-separator=[specify path separator to use when printing file names]:separator'
+ '(-q --quiet)'{-q,--quiet}'[suppress normal output]'
+ '--regex-size-limit=[specify upper size limit of compiled regex]:regex size (bytes)'
+ '*'{-u,--unrestricted}'[reduce level of "smart" searching]'
+
+ + operand # Operands
+ '(--files --type-list file regexp)1: :_guard "^-*" pattern'
+ '(--type-list)*: :_files'
+ )
+
+ # This is used with test_complete.sh to verify that there are no options
+ # listed in the help output that aren't also defined here
+ [[ $_RG_COMPLETE_LIST_ARGS == (1|t*|y*) ]] && {
+ print -rl - $args
+ return 0
+ }
+
+ # Strip out argument groups where unsupported (see above)
+ [[ $ZSH_VERSION == (4|5.<0-3>)(.*)# ]] &&
+ args=( ${(@)args:#(#i)(+|[a-z0-9][a-z0-9_-]#|\([a-z0-9][a-z0-9_-]#\))} )
+
+ _arguments -C -s -S : $args && ret=0
+
+ case $state in
+ colorspec)
+ if [[ ${IPREFIX#--*=}$PREFIX == [^:]# ]]; then
+ suf=( -qS: )
+ tmp=(
+ 'column:specify coloring for column numbers'
+ 'line:specify coloring for line numbers'
+ 'match:specify coloring for match text'
+ 'path:specify coloring for file names'
+ )
+ descr='color/style type'
+ elif [[ ${IPREFIX#--*=}$PREFIX == (column|line|match|path):[^:]# ]]; then
+ suf=( -qS: )
+ tmp=(
+ 'none:clear color/style for type'
+ 'bg:specify background color'
+ 'fg:specify foreground color'
+ 'style:specify text style'
+ )
+ descr='color/style attribute'
+ elif [[ ${IPREFIX#--*=}$PREFIX == [^:]##:(bg|fg):[^:]# ]]; then
+ tmp=( black blue green red cyan magenta yellow white )
+ descr='color name or r,g,b'
+ elif [[ ${IPREFIX#--*=}$PREFIX == [^:]##:style:[^:]# ]]; then
+ tmp=( {,no}bold {,no}intense {,no}underline )
+ descr='style name'
+ else
+ _message -e colorspec 'no more arguments'
+ fi
+
+ (( $#tmp )) && {
+ compset -P '*:'
+ _describe -t colorspec $descr tmp $suf && ret=0
+ }
+ ;;
+
+ typespec)
+ if compset -P '[^:]##:include:'; then
+ _sequence -s , _rg_types && ret=0
+ # @todo This bit in particular could be better, but it's a little
+ # complex, and attempting to solve it seems to run us up against a crash
+ # bug — zsh # 40362
+ elif compset -P '[^:]##:'; then
+ _message 'glob or include directive' && ret=1
+ elif [[ ! -prefix *:* ]]; then
+ _rg_types -qS : && ret=0
+ fi
+ ;;
+ esac
+
+ return ret
+}
+
+# Complete encodings
+_rg_encodings() {
+ local -a expl
+ local -aU _encodings
+
+ # This is impossible to read, but these encodings rarely if ever change, so it
+ # probably doesn't matter. They are derived from the list given here:
+ # https://encoding.spec.whatwg.org/#concept-encoding-get
+ _encodings=(
+ {{,us-}ascii,arabic,chinese,cyrillic,greek{,8},hebrew,korean}
+ logical visual mac {,cs}macintosh x-mac-{cyrillic,roman,ukrainian}
+ 866 ibm{819,866} csibm866
+ big5{,-hkscs} {cn-,cs}big5 x-x-big5
+ cp{819,866,125{0..8}} x-cp125{0..8}
+ csiso2022{jp,kr} csiso8859{6,8}{e,i}
+ csisolatin{{1..6},9} csisolatin{arabic,cyrillic,greek,hebrew}
+ ecma-{114,118} asmo-708 elot_928 sun_eu_greek
+ euc-{jp,kr} x-euc-jp cseuckr cseucpkdfmtjapanese
+ {,x-}gbk csiso58gb231280 gb18030 {,cs}gb2312 gb_2312{,-80} hz-gb-2312
+ iso-2022-{cn,cn-ext,jp,kr}
+ iso8859{,-}{{1..11},13,14,15}
+ iso-8859-{{1..11},{6,8}-{e,i},13,14,15,16} iso_8859-{{1..9},15}
+ iso_8859-{1,2,6,7}:1987 iso_8859-{3,4,5,8}:1988 iso_8859-9:1989
+ iso-ir-{58,100,101,109,110,126,127,138,144,148,149,157}
+ koi{,8,8-r,8-ru,8-u,8_r} cskoi8r
+ ks_c_5601-{1987,1989} ksc{,_}5691 csksc56011987
+ latin{1..6} l{{1..6},9}
+ shift{-,_}jis csshiftjis {,x-}sjis ms_kanji ms932
+ utf{,-}8 utf-16{,be,le} unicode-1-1-utf-8
+ windows-{31j,874,949,125{0..8}} dos-874 tis-620 ansi_x3.4-1968
+ x-user-defined auto
+ )
+
+ _wanted encodings expl encoding compadd -a "$@" - _encodings
+}
+
+# Complete file types
+_rg_types() {
+ local -a expl
+ local -aU _types
+
+ _types=( ${(@)${(f)"$( _call_program types rg --type-list )"}%%:*} )
+
+ _wanted types expl 'file type' compadd -a "$@" - _types
+}
+
+_rg "$@"
+
+
+# ------------------------------------------------------------------------------
+# Copyright (c) 2011 Github zsh-users - http://github.com/zsh-users
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# * Neither the name of the zsh-users nor the
+# names of its contributors may be used to endorse or promote products
+# derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY
+# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+# ------------------------------------------------------------------------------
+# Description
+# -----------
+#
+# Completion script for ripgrep
+#
+# ------------------------------------------------------------------------------
+# Authors
+# -------
+#
+# * arcizan <ghostrevery@gmail.com>
+# * MaskRay <i@maskray.me>
+#
+# ------------------------------------------------------------------------------
+
+# Local Variables:
+# mode: shell-script
+# coding: utf-8-unix
+# indent-tabs-mode: nil
+# sh-indentation: 2
+# sh-basic-offset: 2
+# End:
+# vim: ft=zsh sw=2 ts=2 et
diff --git a/plugins/ros/README.mkd b/plugins/ros/README.mkd
new file mode 100644
index 000000000..83573e499
--- /dev/null
+++ b/plugins/ros/README.mkd
@@ -0,0 +1,10 @@
+# Roswell Plugin
+
+This plugin adds completions and aliases for [Roswell](https://github.com/roswell/roswell/).
+
+To use it, add `ros` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... ros)
+```
+
diff --git a/plugins/ros/_ros b/plugins/ros/_ros
new file mode 100644
index 000000000..6a04d3c8f
--- /dev/null
+++ b/plugins/ros/_ros
@@ -0,0 +1,64 @@
+#compdef ros
+#autoload
+
+# roswell zsh completion, based on gem completion
+
+local -a _1st_arguments
+_1st_arguments=(
+'run: Run repl'
+'install:Install a given implementation or a system for roswell environment'
+'update:Update installed systems.'
+'build:Make executable from script.'
+'use:Change default implementation.'
+'init:a new ros script, optionally based on a template.'
+'fmt:Indent lisp source.'
+'list:Information'
+'template:[WIP] Manage templates'
+'delete:Delete installed implementations'
+'config:Get and set options'
+'version:Show the roswell version information'
+"help:Use \"ros help [command]\" for more information about a command."$'\n\t\t'"Use \"ros help [topic]\" for more information about the topic."
+)
+
+#local expl
+
+_arguments \
+ '(--version)'--version'[Print version information and quit]' \
+ '(-w --wrap)'{-w,--wrap}'[\[CODE\] Run roswell with a shell wrapper CODE]' \
+ '(-m --image)'{-m,--image}'[\[IMAGE\] continue from Lisp image IMAGE]' \
+ '(-M --module)'{-M,--module}'[\[NAME\] Execute ros script found in ROSWELLPATH. (pythons -m)]' \
+ '(-L --lisp)'{-L,--lisp}'[\[NAME\] Run roswell with a lisp impl NAME\[/VERSION\].]' \
+ '(-l --load)'{-l,--load}'[\[FILE\] load lisp FILE while building]' \
+ '(-S --source-registry)'{-S,--source-registry}'[\[X\] override source registry of asdf systems]' \
+ '(-s --system --load-system)'{-s,--system,--load-system}'[\[SYSTEM\] load asdf SYSTEM while building]' \
+ '(-p --package)'{-p,--package}'[\[PACKAGE\] change current package to \[PACKAGE\]]' \
+ '(-sp --system-package)'{-sp,--system-package}'[\[SP\] combination of -s \[SP\] and -p \[SP\]]' \
+ '(-e --eval)'{-e,--eval}'[\[FORM\] evaluate \[FORM\] while building]' \
+ '--require'--require'[\[MODULE\] require \[MODULE\] while building]' \
+ '(-q --quit)'{-q,--quit}'[quit lisp here]' \
+ '(-r --restart)'{-r,--restart}'[\[FUNC\] restart from build by calling (\[FUNC\])]' \
+ '(-E --entry)'{-E,--entry}'[\[FUNC\] restart from build by calling (\[FUNC\] argv)]' \
+ '(-i --init)'{-i,--init}'[\[FORM\] evaluate \[FORM\] after restart]' \
+ '(-ip --print)'{-ip,--print}'[\[FORM\] evaluate and princ \[FORM\] after restart]' \
+ '(-iw --write)'{-iw,--write}'[\[FORM\] evaluate and write \[FORM\] after restart]' \
+ '(-F --final)'{-F,--final}'[\[FORM\] evaluate \[FORM\] before dumping IMAGE]' \
+ '(\+R --no-rc)'{\+R,--no-rc}'[skip /etc/rosrc, ~/.roswell/init.lisp]' \
+ '(-A --asdf)'{-A,--asdf}'[use new asdf]' \
+ '(\+Q --no-quicklisp)'{\+Q,--no-quicklisp}'[do not use quicklisp]' \
+ '(-v --verbose)'{-v,--verbose}'[be quite noisy while building]' \
+ '--quiet'--quiet'[be quite quiet while building default]' \
+ '--test'--test'[for test purpose]' \
+ '*:: :->subcmds' && return 0
+
+
+if (( CURRENT == 1 )); then
+ _describe -t commands "ros subcommand" _1st_arguments
+ return
+fi
+
+# _files
+case "$words[1]" in
+ -l|--load)
+ _files
+ ;;
+esac
diff --git a/plugins/ssh-agent/ssh-agent.plugin.zsh b/plugins/ssh-agent/ssh-agent.plugin.zsh
index 0a204309e..a7a4ee33a 100644
--- a/plugins/ssh-agent/ssh-agent.plugin.zsh
+++ b/plugins/ssh-agent/ssh-agent.plugin.zsh
@@ -13,7 +13,7 @@ function _start_agent() {
function _add_identities() {
local id line sig
- local -a identities loaded not_loaded signatures
+ local -a identities loaded_sigs loaded_ids not_loaded
zstyle -a :omz:plugins:ssh-agent identities identities
# check for .ssh folder presence
@@ -31,19 +31,19 @@ function _add_identities() {
done
fi
- # get list of loaded identities' signatures
- for line in ${(f)"$(ssh-add -l)"}; do loaded+=${${(z)line}[2]}; done
-
- # get signatures of private keys
- for id in $identities; do
- signatures+="$(ssh-keygen -lf "$HOME/.ssh/$id" | awk '{print $2}') $id"
+ # get list of loaded identities' signatures and filenames
+ for line in ${(f)"$(ssh-add -l)"}; do
+ loaded_sigs+=${${(z)line}[2]}
+ loaded_ids+=${${(z)line}[3]}
done
# add identities if not already loaded
- for sig in $signatures; do
- id="$(cut -f2 <<< $sig)"
- sig="$(cut -f1 <<< $sig)"
- [[ ${loaded[(I)$sig]} -le 0 ]] && not_loaded+="$HOME/.ssh/$id"
+ for id in $identities; do
+ # check for filename match, otherwise try for signature match
+ if [[ ${loaded_ids[(I)$HOME/.ssh/$id]} -le 0 ]]; then
+ sig="$(ssh-keygen -lf "$HOME/.ssh/$id" | awk '{print $2}')"
+ [[ ${loaded_sigs[(I)$sig]} -le 0 ]] && not_loaded+="$HOME/.ssh/$id"
+ fi
done
[[ -n "$not_loaded" ]] && ssh-add ${^not_loaded}
diff --git a/plugins/suse/README.md b/plugins/suse/README.md
index 0e8a7f7ba..b9b069574 100644
--- a/plugins/suse/README.md
+++ b/plugins/suse/README.md
@@ -15,14 +15,14 @@ plugins=(... suse)
| Alias | Commands | Description |
| ---------------- | ----------------------------- | -------------------------------------------------------------- |
| z | `sudo zypper` | call zypper |
-| zh | `sudo zypper -h` | print help |
-| zhse | `sudo zypper -h se` | print help for the search command |
-| zlicenses | `sudo zypper licenses` | prints a report about licenses and EULAs of installed packages |
+| zh | `zypper -h` | print help |
+| zhse | `zypper -h se` | print help for the search command |
+| zlicenses | `zypper licenses` | prints a report about licenses and EULAs of installed packages |
| zps | `sudo zypper ps` | list process using deleted files |
| zshell | `sudo zypper shell` | open a zypper shell session |
| zsource-download | `sudo zypper source-download` | download source rpms for all installed packages |
-| ztos | `sudo zypper tos` | shows the ID string of the target operating system |
-| zvcmp | `sudo zypper vcmp` | tell whether version1 is older or newer than version2 |
+| ztos | `zypper tos` | shows the ID string of the target operating system |
+| zvcmp | `zypper vcmp` | tell whether version1 is older or newer than version2 |
## Packages commands
@@ -39,8 +39,8 @@ plugins=(... suse)
| Alias | Commands | Description |
| ------ | ------------------- | ---------------------- |
| zdup | `sudo zypper dup` | upgrade packages |
-| zlp | `sudo zypper lp` | list necessary patches |
-| zlu | `sudo zypper lu` | list updates |
+| zlp | `zypper lp` | list necessary patches |
+| zlu | `zypper lu` | list updates |
| zpchk | `sudo zypper pchk` | check for patches |
| zup | `sudo zypper up` | update packages |
| zpatch | `sudo zypper patch` | install patches |
@@ -49,16 +49,16 @@ plugins=(... suse)
| Alias | Commands | Description |
| ------------- | -------------------------- | ---------------------------------------------------- |
-| zif | `sudo zypper if` | display info about packages |
-| zpa | `sudo zypper pa` | list packages |
-| zpatch-info | `sudo zypper patch-info` | display info about patches |
-| zpattern-info | `sudo zypper pattern-info` | display info about patterns |
-| zproduct-info | `sudo zypper product-info` | display info about products |
-| zpch | `sudo zypper pch` | list all patches |
-| zpd | `sudo zypper pd` | list products |
-| zpt | `sudo zypper pt` | list patterns |
-| zse | `sudo zypper se` | search for packages |
-| zwp | `sudo zypper wp` | list all packages providing the specified capability |
+| zif | `zypper if` | display info about packages |
+| zpa | `zypper pa` | list packages |
+| zpatch-info | `zypper patch-info` | display info about patches |
+| zpattern-info | `zypper pattern-info` | display info about patterns |
+| zproduct-info | `zypper product-info` | display info about products |
+| zpch | `zypper pch` | list all patches |
+| zpd | `zypper pd` | list products |
+| zpt | `zypper pt` | list patterns |
+| zse | `zypper se` | search for packages |
+| zwp | `zypper wp` | list all packages providing the specified capability |
## Repositories commands
@@ -66,7 +66,7 @@ plugins=(... suse)
| ----- | ------------------- | ---------------------------------------- |
| zar | `sudo zypper ar` | add a repository |
| zcl | `sudo zypper clean` | clean cache |
-| zlr | `sudo zypper lr` | list repositories |
+| zlr | `zypper lr` | list repositories |
| zmr | `sudo zypper mr` | modify repositories |
| znr | `sudo zypper nr` | rename repositories (for the alias only) |
| zref | `sudo zypper ref` | refresh repositories |
@@ -79,12 +79,12 @@ plugins=(... suse)
| zms | `sudo zypper ms` | modify properties of specified services |
| zrefs | `sudo zypper refs` | refreshing a service mean executing the service's special task |
| zrs | `sudo zypper rs` | remove specified repository index service from the system |
-| zls | `sudo zypper ls` | list services defined on the system |
+| zls | `zypper ls` | list services defined on the system |
## Package Locks Management commands
| Alias | Commands | Description |
| ----- | ---------------- | ----------------------------------- |
| zal | `sudo zypper al` | add a package lock |
| zcl | `sudo zypper cl` | remove unused locks |
-| zll | `sudo zypper ll` | list currently active package locks |
+| zll | `zypper ll` | list currently active package locks |
| zrl | `sudo zypper rl` | remove specified package lock |
diff --git a/plugins/suse/suse.plugin.zsh b/plugins/suse/suse.plugin.zsh
index 60f7042eb..dcfeccb03 100644
--- a/plugins/suse/suse.plugin.zsh
+++ b/plugins/suse/suse.plugin.zsh
@@ -1,13 +1,13 @@
#Main commands
alias z='sudo zypper'
-alias zh='sudo zypper -h'
-alias zhse='sudo zypper -h se'
-alias zlicenses='sudo zypper licenses'
+alias zh='zypper -h'
+alias zhse='zypper -h se'
+alias zlicenses='zypper licenses'
alias zps='sudo zypper ps'
alias zshell='sudo zypper shell'
alias zsource-download='sudo zypper source-download'
-alias ztos='sudo zypper tos'
-alias zvcmp='sudo zypper vcmp'
+alias ztos='zypper tos'
+alias zvcmp='zypper vcmp'
#Packages commands
alias zin='sudo zypper in'
@@ -18,28 +18,28 @@ alias zve='sudo zypper ve'
#Updates commands
alias zdup='sudo zypper dup'
-alias zlp='sudo zypper lp'
-alias zlu='sudo zypper lu'
+alias zlp='zypper lp'
+alias zlu='zypper lu'
alias zpchk='sudo zypper pchk'
alias zup='sudo zypper up'
alias zpatch='sudo zypper patch'
#Request commands
-alias zif='sudo zypper if'
-alias zpa='sudo zypper pa'
-alias zpatch-info='sudo zypper patch-info'
-alias zpattern-info='sudo zypper pattern-info'
-alias zproduct-info='sudo zypper product-info'
-alias zpch='sudo zypper pch'
-alias zpd='sudo zypper pd'
-alias zpt='sudo zypper pt'
-alias zse='sudo zypper se'
-alias zwp='sudo zypper wp'
+alias zif='zypper if'
+alias zpa='zypper pa'
+alias zpatch-info='zypper patch-info'
+alias zpattern-info='zypper pattern-info'
+alias zproduct-info='zypper product-info'
+alias zpch='zypper pch'
+alias zpd='zypper pd'
+alias zpt='zypper pt'
+alias zse='zypper se'
+alias zwp='zypper wp'
#Repositories commands
alias zar='sudo zypper ar'
alias zcl='sudo zypper clean'
-alias zlr='sudo zypper lr'
+alias zlr='zypper lr'
alias zmr='sudo zypper mr'
alias znr='sudo zypper nr'
alias zref='sudo zypper ref'
@@ -50,10 +50,10 @@ alias zas='sudo zypper as'
alias zms='sudo zypper ms'
alias zrefs='sudo zypper refs'
alias zrs='sudo zypper rs'
-alias zls='sudo zypper ls'
+alias zls='zypper ls'
#Package Locks Management commands
alias zal='sudo zypper al'
alias zcl='sudo zypper cl'
-alias zll='sudo zypper ll'
+alias zll='zypper ll'
alias zrl='sudo zypper rl'
diff --git a/plugins/swiftpm/README.md b/plugins/swiftpm/README.md
index 07ca25651..291458511 100644
--- a/plugins/swiftpm/README.md
+++ b/plugins/swiftpm/README.md
@@ -2,7 +2,7 @@
## Description
-This plugin provides a few utilities that make you faster on your daily work with the [Swift Package Manager](https://github.com/apple/swift-package-manager).
+This plugin provides a few utilities that make you faster on your daily work with the [Swift Package Manager](https://github.com/apple/swift-package-manager), as well as autocompletion for Swift 5.0.
To start using it, add the `swiftpm` plugin to your `plugins` array in `~/.zshrc`:
diff --git a/plugins/swiftpm/_swift b/plugins/swiftpm/_swift
index bed6e13a7..1366b4d9c 100644
--- a/plugins/swiftpm/_swift
+++ b/plugins/swiftpm/_swift
@@ -72,16 +72,23 @@ _swift_build() {
"--build-path[Specify build/cache directory ]:Specify build/cache directory :_files"
"(--chdir -C)"{--chdir,-C}"[]: :_files"
"--package-path[Change working directory before any other operation]:Change working directory before any other operation:_files"
- "--sanitize[Turn on runtime checks for erroneous behavior]: :{_values '' 'address[enable Address sanitizer]' 'thread[enable Thread sanitizer]'}"
+ "--sanitize[Turn on runtime checks for erroneous behavior]: :{_values '' 'address[enable Address sanitizer]' 'thread[enable Thread sanitizer]' 'undefined[enable Undefined Behavior sanitizer]'}"
"--disable-prefetching[]"
"--skip-update[Skip updating dependencies from their remote during a resolution]"
"--disable-sandbox[Disable using the sandbox when executing subprocesses]"
+ "--disable-package-manifest-caching[Disable caching Package.swift manifests]"
"--version[]"
"--destination[]: :_files"
"(--verbose -v)"{--verbose,-v}"[Increase verbosity of informational output]"
"--no-static-swift-stdlib[Do not link Swift stdlib statically \[default\]]"
"--static-swift-stdlib[Link Swift stdlib statically]"
- "--enable-build-manifest-caching[Enable llbuild manifest caching \[Experimental\]]"
+ "--enable-llbuild-library[Enable building with the llbuild library]"
+ "--force-resolved-versions[]"
+ "--disable-automatic-resolution[Disable automatic resolution if Package.resolved file is out-of-date]"
+ "--enable-index-store[Enable indexing-while-building feature]"
+ "--disable-index-store[Disable indexing-while-building feature]"
+ "--enable-pubgrub-resolver[\[Experimental\] Enable the new Pubgrub dependency resolver]"
+ "--enable-parseable-module-interfaces[]"
"--build-tests[Build both source and test targets]"
"--product[Build the specified product]:Build the specified product: "
"--target[Build the specified target]:Build the specified target: "
@@ -108,17 +115,26 @@ _swift_run() {
"--build-path[Specify build/cache directory ]:Specify build/cache directory :_files"
"(--chdir -C)"{--chdir,-C}"[]: :_files"
"--package-path[Change working directory before any other operation]:Change working directory before any other operation:_files"
- "--sanitize[Turn on runtime checks for erroneous behavior]: :{_values '' 'address[enable Address sanitizer]' 'thread[enable Thread sanitizer]'}"
+ "--sanitize[Turn on runtime checks for erroneous behavior]: :{_values '' 'address[enable Address sanitizer]' 'thread[enable Thread sanitizer]' 'undefined[enable Undefined Behavior sanitizer]'}"
"--disable-prefetching[]"
"--skip-update[Skip updating dependencies from their remote during a resolution]"
"--disable-sandbox[Disable using the sandbox when executing subprocesses]"
+ "--disable-package-manifest-caching[Disable caching Package.swift manifests]"
"--version[]"
"--destination[]: :_files"
"(--verbose -v)"{--verbose,-v}"[Increase verbosity of informational output]"
"--no-static-swift-stdlib[Do not link Swift stdlib statically \[default\]]"
"--static-swift-stdlib[Link Swift stdlib statically]"
- "--enable-build-manifest-caching[Enable llbuild manifest caching \[Experimental\]]"
+ "--enable-llbuild-library[Enable building with the llbuild library]"
+ "--force-resolved-versions[]"
+ "--disable-automatic-resolution[Disable automatic resolution if Package.resolved file is out-of-date]"
+ "--enable-index-store[Enable indexing-while-building feature]"
+ "--disable-index-store[Disable indexing-while-building feature]"
+ "--enable-pubgrub-resolver[\[Experimental\] Enable the new Pubgrub dependency resolver]"
+ "--enable-parseable-module-interfaces[]"
"--skip-build[Skip building the executable product]"
+ "--build-tests[Build both source and test targets]"
+ "--repl[Launch Swift REPL for the package]"
)
_arguments $arguments && return
}
@@ -140,16 +156,23 @@ _swift_package() {
"--build-path[Specify build/cache directory ]:Specify build/cache directory :_files"
"(--chdir -C)"{--chdir,-C}"[]: :_files"
"--package-path[Change working directory before any other operation]:Change working directory before any other operation:_files"
- "--sanitize[Turn on runtime checks for erroneous behavior]: :{_values '' 'address[enable Address sanitizer]' 'thread[enable Thread sanitizer]'}"
+ "--sanitize[Turn on runtime checks for erroneous behavior]: :{_values '' 'address[enable Address sanitizer]' 'thread[enable Thread sanitizer]' 'undefined[enable Undefined Behavior sanitizer]'}"
"--disable-prefetching[]"
"--skip-update[Skip updating dependencies from their remote during a resolution]"
"--disable-sandbox[Disable using the sandbox when executing subprocesses]"
+ "--disable-package-manifest-caching[Disable caching Package.swift manifests]"
"--version[]"
"--destination[]: :_files"
"(--verbose -v)"{--verbose,-v}"[Increase verbosity of informational output]"
"--no-static-swift-stdlib[Do not link Swift stdlib statically \[default\]]"
"--static-swift-stdlib[Link Swift stdlib statically]"
- "--enable-build-manifest-caching[Enable llbuild manifest caching \[Experimental\]]"
+ "--enable-llbuild-library[Enable building with the llbuild library]"
+ "--force-resolved-versions[]"
+ "--disable-automatic-resolution[Disable automatic resolution if Package.resolved file is out-of-date]"
+ "--enable-index-store[Enable indexing-while-building feature]"
+ "--disable-index-store[Disable indexing-while-building feature]"
+ "--enable-pubgrub-resolver[\[Experimental\] Enable the new Pubgrub dependency resolver]"
+ "--enable-parseable-module-interfaces[]"
'(-): :->command'
'(-)*:: :->arg'
)
@@ -158,91 +181,124 @@ _swift_package() {
(command)
local modes
modes=(
- 'edit:Put a package in editable mode'
- 'clean:Delete build artifacts'
- 'init:Initialize a new package'
- 'dump-package:Print parsed Package.swift as JSON'
+ 'update:Update package dependencies'
'describe:Describe the current package'
+ 'resolve:Resolve package dependencies'
+ 'tools-version:Manipulate tools version of the current package'
'unedit:Remove a package from editable mode'
- 'update:Update package dependencies'
+ 'show-dependencies:Print the resolved dependency graph'
+ 'fetch:'
+ 'dump-package:Print parsed Package.swift as JSON'
+ 'edit:Put a package in editable mode'
+ 'config:Manipulate configuration of the package'
'completion-tool:Completion tool (for shell completions)'
- 'tools-version:Manipulate tools version of the current package'
- 'reset:Reset the complete cache/build directory'
- 'resolve:Resolve package dependencies'
+ 'clean:Delete build artifacts'
'generate-xcodeproj:Generates an Xcode project'
- 'fetch:'
- 'show-dependencies:Print the resolved dependency graph'
+ 'reset:Reset the complete cache/build directory'
+ 'init:Initialize a new package'
)
_describe "mode" modes
;;
(arg)
case ${words[1]} in
- (edit)
- _swift_package_edit
- ;;
- (clean)
- _swift_package_clean
- ;;
- (init)
- _swift_package_init
- ;;
- (dump-package)
- _swift_package_dump-package
+ (update)
+ _swift_package_update
;;
(describe)
_swift_package_describe
;;
+ (resolve)
+ _swift_package_resolve
+ ;;
+ (tools-version)
+ _swift_package_tools-version
+ ;;
(unedit)
_swift_package_unedit
;;
- (update)
- _swift_package_update
+ (show-dependencies)
+ _swift_package_show-dependencies
;;
- (completion-tool)
- _swift_package_completion-tool
+ (fetch)
+ _swift_package_fetch
;;
- (tools-version)
- _swift_package_tools-version
+ (dump-package)
+ _swift_package_dump-package
;;
- (reset)
- _swift_package_reset
+ (edit)
+ _swift_package_edit
;;
- (resolve)
- _swift_package_resolve
+ (config)
+ _swift_package_config
+ ;;
+ (completion-tool)
+ _swift_package_completion-tool
+ ;;
+ (clean)
+ _swift_package_clean
;;
(generate-xcodeproj)
_swift_package_generate-xcodeproj
;;
- (fetch)
- _swift_package_fetch
+ (reset)
+ _swift_package_reset
;;
- (show-dependencies)
- _swift_package_show-dependencies
+ (init)
+ _swift_package_init
;;
esac
;;
esac
}
-_swift_package_edit() {
+_swift_package_update() {
arguments=(
- ":The name of the package to edit:_swift_dependency"
- "--revision[The revision to edit]:The revision to edit: "
- "--branch[The branch to create]:The branch to create: "
- "--path[Create or use the checkout at this path]:Create or use the checkout at this path:_files"
)
_arguments $arguments && return
}
-_swift_package_clean() {
+_swift_package_describe() {
arguments=(
+ "--type[json|text]: :{_values '' 'text[describe using text format]' 'json[describe using JSON format]'}"
)
_arguments $arguments && return
}
-_swift_package_init() {
+_swift_package_resolve() {
+ arguments=(
+ ":The name of the package to resolve:_swift_dependency"
+ "--version[The version to resolve at]:The version to resolve at: "
+ "--branch[The branch to resolve at]:The branch to resolve at: "
+ "--revision[The revision to resolve at]:The revision to resolve at: "
+ )
+ _arguments $arguments && return
+}
+
+_swift_package_tools-version() {
+ arguments=(
+ "--set[Set tools version of package to the given value]:Set tools version of package to the given value: "
+ "--set-current[Set tools version of package to the current tools version in use]"
+ )
+ _arguments $arguments && return
+}
+
+_swift_package_unedit() {
+ arguments=(
+ ":The name of the package to unedit:_swift_dependency"
+ "--force[Unedit the package even if it has uncommited and unpushed changes.]"
+ )
+ _arguments $arguments && return
+}
+
+_swift_package_show-dependencies() {
+ arguments=(
+ "--format[text|dot|json|flatlist]: :{_values '' 'text[list dependencies using text format]' 'dot[list dependencies using dot format]' 'json[list dependencies using JSON format]'}"
+ )
+ _arguments $arguments && return
+}
+
+_swift_package_fetch() {
arguments=(
- "--type[empty|library|executable|system-module]: :{_values '' 'empty[generates an empty project]' 'library[generates project for a dynamic library]' 'executable[generates a project for a cli executable]' 'system-module[generates a project for a system module]'}"
)
_arguments $arguments && return
}
@@ -253,54 +309,80 @@ _swift_package_dump-package() {
_arguments $arguments && return
}
-_swift_package_describe() {
+_swift_package_edit() {
arguments=(
- "--type[json|text]: :{_values '' 'text[describe using text format]' 'json[describe using JSON format]'}"
+ ":The name of the package to edit:_swift_dependency"
+ "--revision[The revision to edit]:The revision to edit: "
+ "--branch[The branch to create]:The branch to create: "
+ "--path[Create or use the checkout at this path]:Create or use the checkout at this path:_files"
)
_arguments $arguments && return
}
-_swift_package_unedit() {
+_swift_package_config() {
arguments=(
- ":The name of the package to unedit:_swift_dependency"
- "--force[Unedit the package even if it has uncommited and unpushed changes.]"
+ '(-): :->command'
+ '(-)*:: :->arg'
)
_arguments $arguments && return
+ case $state in
+ (command)
+ local modes
+ modes=(
+ 'unset-mirror:Remove an existing mirror'
+ 'set-mirror:Set a mirror for a dependency'
+ 'get-mirror:Print mirror configuration for the given package dependency'
+ )
+ _describe "mode" modes
+ ;;
+ (arg)
+ case ${words[1]} in
+ (unset-mirror)
+ _swift_package_config_unset-mirror
+ ;;
+ (set-mirror)
+ _swift_package_config_set-mirror
+ ;;
+ (get-mirror)
+ _swift_package_config_get-mirror
+ ;;
+ esac
+ ;;
+ esac
}
-_swift_package_update() {
+_swift_package_config_unset-mirror() {
arguments=(
+ "--package-url[The package dependency url]:The package dependency url: "
+ "--mirror-url[The mirror url]:The mirror url: "
)
_arguments $arguments && return
}
-_swift_package_completion-tool() {
+_swift_package_config_set-mirror() {
arguments=(
- ": :{_values '' 'generate-bash-script[generate Bash completion script]' 'generate-zsh-script[generate Bash completion script]' 'list-dependencies[list all dependencies' names]' 'list-executables[list all executables' names]'}"
+ "--package-url[The package dependency url]:The package dependency url: "
+ "--mirror-url[The mirror url]:The mirror url: "
)
_arguments $arguments && return
}
-_swift_package_tools-version() {
+_swift_package_config_get-mirror() {
arguments=(
- "--set[Set tools version of package to the given value]:Set tools version of package to the given value: "
- "--set-current[Set tools version of package to the current tools version in use]"
+ "--package-url[The package dependency url]:The package dependency url: "
)
_arguments $arguments && return
}
-_swift_package_reset() {
+_swift_package_completion-tool() {
arguments=(
+ ": :{_values '' 'generate-bash-script[generate Bash completion script]' 'generate-zsh-script[generate Bash completion script]' 'list-dependencies[list all dependencies' names]' 'list-executables[list all executables' names]'}"
)
_arguments $arguments && return
}
-_swift_package_resolve() {
+_swift_package_clean() {
arguments=(
- ":The name of the package to resolve:_swift_dependency"
- "--version[The version to resolve at]:The version to resolve at: "
- "--branch[The branch to resolve at]:The branch to resolve at: "
- "--revision[The revision to resolve at]:The revision to resolve at: "
)
_arguments $arguments && return
}
@@ -312,19 +394,21 @@ _swift_package_generate-xcodeproj() {
"--output[Path where the Xcode project should be generated]:Path where the Xcode project should be generated:_files"
"--legacy-scheme-generator[Use the legacy scheme generator]"
"--watch[Watch for changes to the Package manifest to regenerate the Xcode project]"
+ "--skip-extra-files[Do not add file references for extra files to the generated Xcode project]"
)
_arguments $arguments && return
}
-_swift_package_fetch() {
+_swift_package_reset() {
arguments=(
)
_arguments $arguments && return
}
-_swift_package_show-dependencies() {
+_swift_package_init() {
arguments=(
- "--format[text|dot|json|flatlist]: :{_values '' 'text[list dependencies using text format]' 'dot[list dependencies using dot format]' 'json[list dependencies using JSON format]'}"
+ "--type[empty|library|executable|system-module]: :{_values '' 'empty[generates an empty project]' 'library[generates project for a dynamic library]' 'executable[generates a project for a cli executable]' 'system-module[generates a project for a system module]'}"
+ "--name[Provide custom package name]:Provide custom package name: "
)
_arguments $arguments && return
}
@@ -346,23 +430,32 @@ _swift_test() {
"--build-path[Specify build/cache directory ]:Specify build/cache directory :_files"
"(--chdir -C)"{--chdir,-C}"[]: :_files"
"--package-path[Change working directory before any other operation]:Change working directory before any other operation:_files"
- "--sanitize[Turn on runtime checks for erroneous behavior]: :{_values '' 'address[enable Address sanitizer]' 'thread[enable Thread sanitizer]'}"
+ "--sanitize[Turn on runtime checks for erroneous behavior]: :{_values '' 'address[enable Address sanitizer]' 'thread[enable Thread sanitizer]' 'undefined[enable Undefined Behavior sanitizer]'}"
"--disable-prefetching[]"
"--skip-update[Skip updating dependencies from their remote during a resolution]"
"--disable-sandbox[Disable using the sandbox when executing subprocesses]"
+ "--disable-package-manifest-caching[Disable caching Package.swift manifests]"
"--version[]"
"--destination[]: :_files"
"(--verbose -v)"{--verbose,-v}"[Increase verbosity of informational output]"
"--no-static-swift-stdlib[Do not link Swift stdlib statically \[default\]]"
"--static-swift-stdlib[Link Swift stdlib statically]"
- "--enable-build-manifest-caching[Enable llbuild manifest caching \[Experimental\]]"
+ "--enable-llbuild-library[Enable building with the llbuild library]"
+ "--force-resolved-versions[]"
+ "--disable-automatic-resolution[Disable automatic resolution if Package.resolved file is out-of-date]"
+ "--enable-index-store[Enable indexing-while-building feature]"
+ "--disable-index-store[Disable indexing-while-building feature]"
+ "--enable-pubgrub-resolver[\[Experimental\] Enable the new Pubgrub dependency resolver]"
+ "--enable-parseable-module-interfaces[]"
"--skip-build[Skip building the test target]"
"(--list-tests -l)"{--list-tests,-l}"[Lists test methods in specifier format]"
"--generate-linuxmain[Generate LinuxMain.swift entries for the package]"
"--parallel[Run the tests in parallel.]"
+ "--num-workers[Number of tests to execute in parallel.]:Number of tests to execute in parallel.: "
"(--specifier -s)"{--specifier,-s}"[]: : "
"--xunit-output[]: :_files"
"--filter[Run test cases matching regular expression, Format: <test-target>.<test-case> or <test-target>.<test-case>/<test>]:Run test cases matching regular expression, Format: <test-target>.<test-case> or <test-target>.<test-case>/<test>: "
+ "--enable-code-coverage[Test with code coverage enabled]"
)
_arguments $arguments && return
}
diff --git a/plugins/timer/README.md b/plugins/timer/README.md
new file mode 100644
index 000000000..321307e59
--- /dev/null
+++ b/plugins/timer/README.md
@@ -0,0 +1,17 @@
+This plugin allows to display command's execution time in a very nonintrusive way.
+
+Timer can be tuned by these two variables:
+* `TIMER_PRECISION` allows to control number of decimal places (default `1`)
+* `TIMER_FORMAT` allows to adjust display format (default `'/%d'`)
+
+Sample session:
+
+ me@here:~$ sleep 1 /1.0s
+ me@here:~$ sleep 73 /1m13.0s
+ me@here:~$ TIMER_FORMAT='[%d]'; TIMER_PRECISION=2 [0.00s]
+ me@here:~$ head -c50 < /dev/urandom | hexdump
+ 0000000 b2 16 20 f0 29 1f 61 2d 8a 29 20 8c 8c 39 5a ab
+ 0000010 21 47 0e f9 ee a4 76 46 71 9e 4f 6b a4 c4 51 cb
+ 0000020 f9 1f 7e b9 6f 2c ae dd cf 40 6d 64 a8 fb d3 db
+ 0000030 09 37
+ 0000032 [0.02s]
diff --git a/plugins/timer/timer.plugin.zsh b/plugins/timer/timer.plugin.zsh
new file mode 100644
index 000000000..231134e7d
--- /dev/null
+++ b/plugins/timer/timer.plugin.zsh
@@ -0,0 +1,29 @@
+__timer_current_time() {
+ perl -MTime::HiRes=time -e'print time'
+}
+
+__timer_format_duration() {
+ local mins=$(printf '%.0f' $(($1 / 60)))
+ local secs=$(printf "%.${TIMER_PRECISION:-1}f" $(($1 - 60 * mins)))
+ local duration_str=$(echo "${mins}m${secs}s")
+ local format="${TIMER_FORMAT:-/%d}"
+ echo "${format//\%d/${duration_str#0m}}"
+}
+
+__timer_save_time_preexec() {
+ __timer_cmd_start_time=$(__timer_current_time)
+}
+
+__timer_display_timer_precmd() {
+ if [ -n "${__timer_cmd_start_time}" ]; then
+ local cmd_end_time=$(__timer_current_time)
+ local tdiff=$((cmd_end_time - __timer_cmd_start_time))
+ unset __timer_cmd_start_time
+ local tdiffstr=$(__timer_format_duration ${tdiff})
+ local cols=$((COLUMNS - ${#tdiffstr} - 1))
+ echo -e "\033[1A\033[${cols}C ${tdiffstr}"
+ fi
+}
+
+preexec_functions+=(__timer_save_time_preexec)
+precmd_functions+=(__timer_display_timer_precmd)
diff --git a/plugins/tmuxinator/_tmuxinator b/plugins/tmuxinator/_tmuxinator
index 37032f8d8..9ae25ac38 100644
--- a/plugins/tmuxinator/_tmuxinator
+++ b/plugins/tmuxinator/_tmuxinator
@@ -1,3 +1,6 @@
+#compdef tmuxinator mux
+#autoload
+
_tmuxinator() {
local commands projects
commands=(${(f)"$(tmuxinator commands zsh)"})
@@ -17,5 +20,4 @@ _tmuxinator() {
return
}
-compdef _tmuxinator tmuxinator mux
-alias mux="tmuxinator"
+compdef _tmuxinator tmuxinator
diff --git a/plugins/transfer/transfer.plugin.zsh b/plugins/transfer/transfer.plugin.zsh
index 7a7cd85ec..db744b0cd 100644
--- a/plugins/transfer/transfer.plugin.zsh
+++ b/plugins/transfer/transfer.plugin.zsh
@@ -61,7 +61,9 @@ transfer() {
# cat output link
cat $tmpfile
+ # add newline
+ echo
# cleanup
rm -f $tmpfile
-} \ No newline at end of file
+}
diff --git a/plugins/vault/README.md b/plugins/vault/README.md
index 5cdbb16f0..69051d2b2 100644
--- a/plugins/vault/README.md
+++ b/plugins/vault/README.md
@@ -1,18 +1,15 @@
-## Vault (https://www.vaultproject.io) autocomplete plugin
+# Vault plugin
-- Adds autocomplete options for all vault commands.
+Note: this plugin is deprecated. Use the [official autocompletion](https://www.vaultproject.io/docs/commands/index.html#autocompletion) instead.
-####Show help for all commands
-![General Help](https://i.imgur.com/yv5Db1r.png "Help for all commands")
+-------
+Adds autocomplete options for all [vault](https://www.vaultproject.io) commands.
-####Create new Vault token
-![Create token](https://i.imgur.com/xMegNgh.png "Create token")
-
-
-####Enable audit backends
-![Audit backends](https://i.imgur.com/fKLeiSF.png "Audit backends")
-
+To use it, add `vault` to the plugins array in your zshrc file:
+```zsh
+plugins=(... vault)
+```
Crafted with <3 by Valentin Bud ([@valentinbud](https://twitter.com/valentinbud))
diff --git a/plugins/vi-mode/vi-mode.plugin.zsh b/plugins/vi-mode/vi-mode.plugin.zsh
index 93964594b..c1cdd2851 100644
--- a/plugins/vi-mode/vi-mode.plugin.zsh
+++ b/plugins/vi-mode/vi-mode.plugin.zsh
@@ -28,8 +28,9 @@ bindkey '^?' backward-delete-char
bindkey '^h' backward-delete-char
bindkey '^w' backward-kill-word
-# allow ctrl-r to perform backward search in history
+# allow ctrl-r and ctrl-s to search the history
bindkey '^r' history-incremental-search-backward
+bindkey '^s' history-incremental-search-forward
# allow ctrl-a and ctrl-e to move to beginning/end of line
bindkey '^a' beginning-of-line
diff --git a/plugins/web-search/README.md b/plugins/web-search/README.md
index d790d944d..d04042506 100644
--- a/plugins/web-search/README.md
+++ b/plugins/web-search/README.md
@@ -37,6 +37,8 @@ Available search contexts are:
| `ecosia` | `https://www.ecosia.org/search?q=` |
| `goodreads` | `https://www.goodreads.com/search?q=` |
| `qwant` | `https://www.qwant.com/?q=` |
+| `givero` | `https://www.givero.com/search?q=` |
+| `stackoverflow` | `https://stackoverflow.com/search?q=` |
Also there are aliases for bang-searching DuckDuckGo:
diff --git a/plugins/web-search/web-search.plugin.zsh b/plugins/web-search/web-search.plugin.zsh
index 863384223..5b76eeae2 100644
--- a/plugins/web-search/web-search.plugin.zsh
+++ b/plugins/web-search/web-search.plugin.zsh
@@ -17,6 +17,8 @@ function web_search() {
ecosia "https://www.ecosia.org/search?q="
goodreads "https://www.goodreads.com/search?q="
qwant "https://www.qwant.com/?q="
+ givero "https://www.givero.com/search?q="
+ stackoverflow "https://stackoverflow.com/search?q="
)
# check whether the search engine is supported
@@ -51,6 +53,8 @@ alias baidu='web_search baidu'
alias ecosia='web_search ecosia'
alias goodreads='web_search goodreads'
alias qwant='web_search qwant'
+alias givero='web_search givero'
+alias stackoverflow='web_search stackoverflow'
#add your own !bang searches here
alias wiki='web_search duckduckgo \!w'
diff --git a/plugins/wp-cli/wp-cli.plugin.zsh b/plugins/wp-cli/wp-cli.plugin.zsh
index 45fac0761..97bed406e 100644
--- a/plugins/wp-cli/wp-cli.plugin.zsh
+++ b/plugins/wp-cli/wp-cli.plugin.zsh
@@ -109,7 +109,7 @@ alias wptm='wp theme mod'
alias wptp='wp theme path'
alias wpts='wp theme search'
alias wptst='wp theme status'
-alias wptu='wp theme updatet'
+alias wptu='wp theme update'
# Transient
diff --git a/plugins/z/z.sh b/plugins/z/z.sh
index 4fc75dc6a..5fe6d5266 100644
--- a/plugins/z/z.sh
+++ b/plugins/z/z.sh
@@ -222,10 +222,16 @@ if type compctl >/dev/null 2>&1; then
if [ "$_Z_NO_RESOLVE_SYMLINKS" ]; then
_z_precmd() {
(_z --add "${PWD:a}" &)
+ # Reference $RANDOM to refresh its value inside the subshell
+ # Otherwise, multiple runs get the same value
+ : $RANDOM
}
else
_z_precmd() {
(_z --add "${PWD:A}" &)
+ # Reference $RANDOM to refresh its value inside the subshell
+ # Otherwise, multiple runs get the same value
+ : $RANDOM
}
fi
[[ -n "${precmd_functions[(r)_z_precmd]}" ]] || {
diff --git a/templates/zshrc.zsh-template b/templates/zshrc.zsh-template
index abd2c8812..bc892ff38 100644
--- a/templates/zshrc.zsh-template
+++ b/templates/zshrc.zsh-template
@@ -83,9 +83,6 @@ source $ZSH/oh-my-zsh.sh
# Compilation flags
# export ARCHFLAGS="-arch x86_64"
-# ssh
-# export SSH_KEY_PATH="~/.ssh/rsa_id"
-
# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme
index 0edb773aa..3c30a9e11 100644
--- a/themes/agnoster.zsh-theme
+++ b/themes/agnoster.zsh-theme
@@ -224,11 +224,25 @@ prompt_status() {
[[ -n "$symbols" ]] && prompt_segment black default "$symbols"
}
+#AWS Profile:
+# - display current AWS_PROFILE name
+# - displays yellow on red if profile name contains 'production' or
+# ends in '-prod'
+# - displays black on green otherwise
+prompt_aws() {
+ [[ -z "$AWS_PROFILE" ]] && return
+ case "$AWS_PROFILE" in
+ *-prod|*production*) prompt_segment red yellow "AWS: $AWS_PROFILE" ;;
+ *) prompt_segment green black "AWS: $AWS_PROFILE" ;;
+ esac
+}
+
## Main prompt
build_prompt() {
RETVAL=$?
prompt_status
prompt_virtualenv
+ prompt_aws
prompt_context
prompt_dir
prompt_git
diff --git a/themes/bira.zsh-theme b/themes/bira.zsh-theme
index 675483996..0a20b233e 100644
--- a/themes/bira.zsh-theme
+++ b/themes/bira.zsh-theme
@@ -20,11 +20,14 @@ else
fi
fi
local git_branch='$(git_prompt_info)%{$reset_color%}'
+local venv_prompt='$(virtualenv_prompt_info)%{$reset_color%}'
-PROMPT="╭─${user_host} ${current_dir} ${rvm_ruby} ${git_branch}
+PROMPT="╭─${venv_prompt} ${user_host} ${current_dir} ${rvm_ruby} ${git_branch}
╰─%B${user_symbol}%b "
RPS1="%B${return_code}%b"
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹"
ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}"
+ZSH_THEME_VIRTUAL_ENV_PROMPT_PREFIX="%{$fg[green]%}‹"
+ZSH_THEME_VIRTUAL_ENV_PROMPT_SUFFIX="› %{$reset_color%}"
diff --git a/themes/dst.zsh-theme b/themes/dst.zsh-theme
index 3e2539d57..6b2f8767d 100644
--- a/themes/dst.zsh-theme
+++ b/themes/dst.zsh-theme
@@ -11,6 +11,6 @@ function prompt_char {
PROMPT='%(?, ,%{$fg[red]%}FAIL%{$reset_color%}
)
%{$fg[magenta]%}%n%{$reset_color%}@%{$fg[yellow]%}%m%{$reset_color%}: %{$fg_bold[blue]%}%~%{$reset_color%}$(git_prompt_info)
-%_ $(prompt_char) '
+$(prompt_char) '
RPROMPT='%{$fg[green]%}[%*]%{$reset_color%}'
diff --git a/themes/gallifrey.zsh-theme b/themes/gallifrey.zsh-theme
index 252566f06..768547064 100644
--- a/themes/gallifrey.zsh-theme
+++ b/themes/gallifrey.zsh-theme
@@ -1,8 +1,11 @@
-# ZSH Theme - Preview: https://flic.kr/p/ZFvivf
-local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
+# ZSH Theme - Preview: https://github.com/robbyrussell/oh-my-zsh/wiki/Themes#gallifrey
+return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
+host_color="%(!.%{$fg[red]%}.%{$fg[green]%})"
-PROMPT='%{$fg[green]%}%m%{$reset_color%} %2~ $(git_prompt_info)%{$reset_color%}%B»%b '
+PROMPT="${host_color}%m%{$reset_color%} %2~ \$(git_prompt_info)%{$reset_color%}%B»%b "
RPS1="${return_code}"
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹"
ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}"
+
+unset return_code host_color
diff --git a/themes/gentoo.zsh-theme b/themes/gentoo.zsh-theme
index ee205d248..5f2427c7a 100644
--- a/themes/gentoo.zsh-theme
+++ b/themes/gentoo.zsh-theme
@@ -2,7 +2,7 @@ function prompt_char {
if [ $UID -eq 0 ]; then echo "#"; else echo $; fi
}
-PROMPT='%(!.%{$fg_bold[red]%}.%{$fg_bold[green]%}%n@)%m %{$fg_bold[blue]%}%(!.%1~.%~) $(git_prompt_info)%_$(prompt_char)%{$reset_color%} '
+PROMPT='%(!.%{$fg_bold[red]%}.%{$fg_bold[green]%}%n@)%m %{$fg_bold[blue]%}%(!.%1~.%~) $(git_prompt_info)$(prompt_char)%{$reset_color%} '
ZSH_THEME_GIT_PROMPT_PREFIX="("
ZSH_THEME_GIT_PROMPT_SUFFIX=") "
diff --git a/themes/pygmalion-virtualenv.zsh-theme b/themes/pygmalion-virtualenv.zsh-theme
new file mode 100644
index 000000000..ea28e125a
--- /dev/null
+++ b/themes/pygmalion-virtualenv.zsh-theme
@@ -0,0 +1,50 @@
+# Yay! High voltage and arrows!
+
+
+function _virtualenv_prompt_info {
+ if [[ -n "$(whence virtualenv_prompt_info)" ]]; then
+ if [ -n "$(whence pyenv_prompt_info)" ]; then
+ if [ "$1" = "inline" ]; then
+ ZSH_THEME_VIRTUAL_ENV_PROMPT_PREFIX=%{$fg[blue]%}"::%{$fg[red]%}"
+ ZSH_THEME_VIRTUAL_ENV_PROMPT_SUFFIX=""
+ virtualenv_prompt_info
+ fi
+ [ "$(pyenv_prompt_info)" = "${PYENV_PROMPT_DEFAULT_VERSION}" ] && virtualenv_prompt_info
+ else
+ virtualenv_prompt_info
+ fi
+ fi
+}
+
+prompt_setup_pygmalion(){
+ ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}"
+ ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
+ ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%}⚡%{$reset_color%}"
+ ZSH_THEME_GIT_PROMPT_CLEAN=""
+
+ base_prompt='$(_virtualenv_prompt_info)%{$fg[magenta]%}%n%{$reset_color%}%{$fg[cyan]%}@%{$reset_color%}%{$fg[yellow]%}%m%{$reset_color%}%{$fg[red]%}:%{$reset_color%}%{$fg[cyan]%}%0~%{$reset_color%}%{$fg[red]%}|%{$reset_color%}'
+ post_prompt='%{$fg[cyan]%}⇒%{$reset_color%} '
+
+ base_prompt_nocolor=$(echo "$base_prompt" | perl -pe "s/%\{[^}]+\}//g")
+ post_prompt_nocolor=$(echo "$post_prompt" | perl -pe "s/%\{[^}]+\}//g")
+
+ precmd_functions+=(prompt_pygmalion_precmd)
+}
+
+prompt_pygmalion_precmd(){
+ local gitinfo=$(git_prompt_info)
+ local gitinfo_nocolor=$(echo "$gitinfo" | perl -pe "s/%\{[^}]+\}//g")
+ local exp_nocolor="$(print -P \"$base_prompt_nocolor$gitinfo_nocolor$post_prompt_nocolor\")"
+ local prompt_length=${#exp_nocolor}
+
+ local nl=""
+
+ if [[ $prompt_length -gt 40 ]]; then
+ nl=$'\n%{\r%}';
+ fi
+ PROMPT="$base_prompt$gitinfo$nl$post_prompt"
+}
+
+prompt_setup_pygmalion
+
+
diff --git a/themes/refined.zsh-theme b/themes/refined.zsh-theme
index 0e5681cc7..2a4188c9d 100644
--- a/themes/refined.zsh-theme
+++ b/themes/refined.zsh-theme
@@ -72,6 +72,7 @@ preexec() {
precmd() {
vcs_info # Get version control info before we start outputting stuff
print -P "\n$(repo_information) %F{yellow}$(cmd_exec_time)%f"
+ unset cmd_timestamp #Reset cmd exec time.
}
# Define prompts
diff --git a/themes/tjkirch.zsh-theme b/themes/tjkirch.zsh-theme
index 446cde724..c51609860 100644
--- a/themes/tjkirch.zsh-theme
+++ b/themes/tjkirch.zsh-theme
@@ -10,6 +10,6 @@ function prompt_char {
PROMPT='%(?, ,%{$fg[red]%}FAIL: $?%{$reset_color%}
)
%{$fg[magenta]%}%n%{$reset_color%}@%{$fg[yellow]%}%m%{$reset_color%}: %{$fg_bold[blue]%}%~%{$reset_color%}$(git_prompt_info)
-%_$(prompt_char) '
+$(prompt_char) '
RPROMPT='%{$fg[green]%}[%*]%{$reset_color%}'
diff --git a/themes/tjkirch_mod.zsh-theme b/themes/tjkirch_mod.zsh-theme
index 1b206a7e1..2dd060ea1 100644
--- a/themes/tjkirch_mod.zsh-theme
+++ b/themes/tjkirch_mod.zsh-theme
@@ -8,6 +8,6 @@ function prompt_char {
}
PROMPT='%(?,,%{$fg[red]%}FAIL: $?%{$reset_color%}
-)%{$fg[magenta]%}%n%{$reset_color%}@%{$fg[yellow]%}%m%{$reset_color%}: %{$fg_bold[blue]%}%~%{$reset_color%}$(git_prompt_info) %_$(prompt_char) '
+)%{$fg[magenta]%}%n%{$reset_color%}@%{$fg[yellow]%}%m%{$reset_color%}: %{$fg_bold[blue]%}%~%{$reset_color%}$(git_prompt_info) $(prompt_char) '
RPROMPT='%{$fg[green]%}[%*]%{$reset_color%}'
diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh
index 05b31e8d4..c8dedcf77 100644
--- a/tools/check_for_upgrade.sh
+++ b/tools/check_for_upgrade.sh
@@ -34,7 +34,9 @@ if mkdir "$ZSH/log/update.lock" 2>/dev/null; then
. ${ZSH_CACHE_DIR}/.zsh-update
if [[ -z "$LAST_EPOCH" ]]; then
- _update_zsh_update && return 0
+ _update_zsh_update
+ rmdir $ZSH/log/update.lock # TODO: fix later
+ return 0
fi
epoch_diff=$(($(_current_epoch) - $LAST_EPOCH))
diff --git a/tools/install.sh b/tools/install.sh
index 2fb87cdaf..e2b33f640 100755
--- a/tools/install.sh
+++ b/tools/install.sh
@@ -105,7 +105,7 @@ main() {
echo ''
echo 'p.s. Follow us at https://twitter.com/ohmyzsh.'
echo ''
- echo 'p.p.s. Get stickers and t-shirts at https://shop.planetargon.com.'
+ echo 'p.p.s. Get stickers, shirts, and coffee mugs at https://shop.planetargon.com/collections/oh-my-zsh.'
echo ''
printf "${NORMAL}"
env zsh -l
diff --git a/tools/upgrade.sh b/tools/upgrade.sh
index 25b2de27a..d234c7f88 100644
--- a/tools/upgrade.sh
+++ b/tools/upgrade.sh
@@ -33,7 +33,7 @@ then
printf '%s\n' ' /____/ '
printf "${BLUE}%s\n" "Hooray! Oh My Zsh has been updated and/or is at the current version."
printf "${BLUE}${BOLD}%s${NORMAL}\n" "To keep up on the latest news and updates, follow us on twitter: https://twitter.com/ohmyzsh"
- printf "${BLUE}${BOLD}%s${NORMAL}\n" "Get your Oh My Zsh swag at: https://shop.planetargon.com/"
+ printf "${BLUE}${BOLD}%s${NORMAL}\n" "Get your Oh My Zsh swag at: https://shop.planetargon.com/collections/oh-my-zsh"
else
printf "${RED}%s${NORMAL}\n" 'There was an error updating. Try again later?'
fi