summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorTuowen Zhao <ztuowen@gmail.com>2026-01-04 22:47:54 -0800
committerTuowen Zhao <ztuowen@gmail.com>2026-01-04 22:47:54 -0800
commit2aa4cb7a52b28722816ecfd55f3b06293332c55c (patch)
treef02a9f3d59d109c70caf932a24e43368994e0e8c /plugins
parent7e951c254e779ff0620537cf43ca69dd878387b4 (diff)
parentd23d3ea69fdb839088e6e5589557cce77b34aaf8 (diff)
downloadzsh-2aa4cb7a52b28722816ecfd55f3b06293332c55c.tar.gz
zsh-2aa4cb7a52b28722816ecfd55f3b06293332c55c.tar.bz2
zsh-2aa4cb7a52b28722816ecfd55f3b06293332c55c.zip
Merge remote-tracking branch 'github/master'HEADmaster
Diffstat (limited to 'plugins')
-rw-r--r--plugins/1password/1password.plugin.zsh12
-rw-r--r--plugins/1password/opswd2
-rw-r--r--plugins/adb/README.md8
-rw-r--r--plugins/adb/_adb67
-rw-r--r--plugins/ag/README.md13
-rw-r--r--plugins/ag/_ag66
-rw-r--r--plugins/alias-finder/README.md39
-rw-r--r--plugins/alias-finder/alias-finder.plugin.zsh14
-rw-r--r--plugins/aliases/README.md4
-rw-r--r--plugins/ansible/README.md5
-rw-r--r--plugins/archlinux/archlinux.plugin.zsh17
-rw-r--r--plugins/arduino-cli/README.md9
-rw-r--r--plugins/arduino-cli/arduino-cli.plugin.zsh14
-rw-r--r--plugins/asdf/README.md54
-rw-r--r--plugins/asdf/asdf.plugin.zsh39
-rw-r--r--plugins/autojump/autojump.plugin.zsh30
-rw-r--r--plugins/aws/README.md7
-rw-r--r--plugins/aws/aws.plugin.zsh55
-rw-r--r--plugins/battery/README.md13
-rw-r--r--plugins/battery/battery.plugin.zsh10
-rw-r--r--plugins/bazel/README.md19
-rw-r--r--plugins/bazel/bazel.plugin.zsh9
-rw-r--r--plugins/bedtools/_bedtools2
-rw-r--r--plugins/bgnotify/README.md1
-rw-r--r--plugins/bgnotify/bgnotify.plugin.zsh48
-rw-r--r--plugins/branch/README.md2
-rw-r--r--plugins/branch/branch.plugin.zsh2
-rw-r--r--plugins/brew/README.md48
-rw-r--r--plugins/brew/brew.plugin.zsh33
-rw-r--r--plugins/buf/README.md9
-rw-r--r--plugins/buf/buf.plugin.zsh14
-rw-r--r--plugins/bun/bun.plugin.zsh2
-rw-r--r--plugins/bundler/_bundler2
-rw-r--r--plugins/catimg/README.md5
-rw-r--r--plugins/catimg/catimg.plugin.zsh8
-rw-r--r--plugins/catimg/catimg.sh14
-rw-r--r--plugins/chezmoi/README.md11
-rw-r--r--plugins/chezmoi/chezmoi.plugin.zsh14
-rw-r--r--plugins/chruby/chruby.plugin.zsh38
-rw-r--r--plugins/chucknorris/README.md9
-rw-r--r--plugins/cloudfoundry/README.md2
-rw-r--r--plugins/coffee/README.md2
-rw-r--r--plugins/colorize/colorize.plugin.zsh6
-rw-r--r--plugins/command-not-found/README.md1
-rw-r--r--plugins/command-not-found/command-not-found.plugin.zsh4
-rw-r--r--plugins/common-aliases/README.md14
-rw-r--r--plugins/compleat/compleat.plugin.zsh4
-rw-r--r--plugins/conda-env/README.md44
-rw-r--r--plugins/conda-env/conda-env.plugin.zsh9
-rw-r--r--plugins/conda/README.md37
-rw-r--r--plugins/conda/conda.plugin.zsh23
-rw-r--r--plugins/copybuffer/copybuffer.plugin.zsh4
-rw-r--r--plugins/copyfile/copyfile.plugin.zsh14
-rw-r--r--plugins/dash/README.md2
-rw-r--r--plugins/dash/dash.plugin.zsh2
-rw-r--r--plugins/dbt/README.md6
-rw-r--r--plugins/debian/debian.plugin.zsh6
-rw-r--r--plugins/dircycle/README.md22
-rw-r--r--plugins/dircycle/dircycle.plugin.zsh45
-rw-r--r--plugins/direnv/direnv.plugin.zsh7
-rw-r--r--plugins/dirhistory/README.md43
-rw-r--r--plugins/dirhistory/dirhistory.plugin.zsh17
-rw-r--r--plugins/dnf/_dnf5570
-rw-r--r--plugins/docker-compose/README.md2
-rw-r--r--plugins/docker-compose/_docker-compose2
-rw-r--r--plugins/docker-compose/docker-compose.plugin.zsh7
-rw-r--r--plugins/docker-machine/README.md19
-rw-r--r--plugins/docker-machine/_docker-machine359
-rw-r--r--plugins/docker-machine/docker-machine.plugin.zsh33
-rw-r--r--plugins/docker/README.md8
-rw-r--r--plugins/docker/docker.plugin.zsh8
-rw-r--r--plugins/dotnet/README.md5
-rw-r--r--plugins/dotnet/dotnet.plugin.zsh5
-rw-r--r--plugins/emacs/README.md2
-rw-r--r--plugins/emacs/emacs.plugin.zsh4
-rw-r--r--plugins/ember-cli/README.md2
-rw-r--r--plugins/emoji/emoji.plugin.zsh18
-rw-r--r--plugins/emoji/update_emoji.py4
-rw-r--r--plugins/emotty/emotty.plugin.zsh2
-rw-r--r--plugins/encode64/README.md2
-rw-r--r--plugins/encode64/encode64.plugin.zsh2
-rw-r--r--plugins/extract/README.md96
-rw-r--r--plugins/extract/_extract52
-rw-r--r--plugins/extract/extract.plugin.zsh18
-rw-r--r--plugins/eza/README.md144
-rw-r--r--plugins/eza/eza.plugin.zsh76
-rw-r--r--plugins/fancy-ctrl-z/README.md20
-rw-r--r--plugins/fastfile/README.md4
-rw-r--r--plugins/fastfile/fastfile.plugin.zsh4
-rw-r--r--plugins/fd/README.md9
-rw-r--r--plugins/fd/_fd273
-rw-r--r--plugins/fig/README.md9
-rw-r--r--plugins/fig/fig.plugin.zsh13
-rw-r--r--plugins/flutter/flutter.plugin.zsh2
-rw-r--r--plugins/foot/README.md35
-rw-r--r--plugins/foot/foot.plugin.zsh10
-rw-r--r--plugins/forklift/forklift.plugin.zsh10
-rw-r--r--plugins/fzf/fzf.plugin.zsh41
-rw-r--r--plugins/gatsby/README.md2
-rw-r--r--plugins/gcloud/gcloud.plugin.zsh2
-rw-r--r--plugins/gem/completions/_gem (renamed from plugins/gem/_gem)0
-rw-r--r--plugins/gem/gem.plugin.zsh27
-rw-r--r--plugins/git-auto-fetch/README.md2
-rw-r--r--plugins/git-commit/README.md15
-rw-r--r--plugins/git-commit/git-commit.plugin.zsh47
-rw-r--r--plugins/git-prompt/README.md4
-rw-r--r--plugins/git-prompt/gitstatus.py6
-rw-r--r--plugins/git/README.md67
-rw-r--r--plugins/git/git.plugin.zsh113
-rw-r--r--plugins/gitfast/MANUAL.adoc40
-rw-r--r--plugins/gitfast/README.md6
-rw-r--r--plugins/gitfast/_git18
-rw-r--r--plugins/gitfast/git-completion.bash223
-rw-r--r--plugins/gitfast/git-prompt.sh31
-rw-r--r--plugins/gitfast/gitfast.plugin.zsh2
-rwxr-xr-xplugins/gitfast/update8
-rw-r--r--plugins/gnu-utils/gnu-utils.plugin.zsh4
-rw-r--r--plugins/golang/README.md1
-rw-r--r--plugins/golang/golang.plugin.zsh1
-rw-r--r--plugins/gpg-agent/README.md7
-rw-r--r--plugins/gradle/LICENSE19
-rw-r--r--plugins/gradle/_gradle425
-rw-r--r--plugins/grails/grails.plugin.zsh14
-rw-r--r--plugins/grc/grc.plugin.zsh1
-rw-r--r--plugins/helm/README.md13
-rw-r--r--plugins/helm/helm.plugin.zsh1
-rw-r--r--plugins/heroku-alias/README.md217
-rw-r--r--plugins/heroku-alias/heroku-alias.plugin.zsh (renamed from plugins/heroku-alias/heroku.alias.sh)0
-rw-r--r--plugins/history-substring-search/README.md103
-rw-r--r--plugins/history-substring-search/dependencies/OMZ-README.md15
-rw-r--r--plugins/history-substring-search/history-substring-search.plugin.zsh1
-rw-r--r--plugins/history-substring-search/history-substring-search.zsh236
-rwxr-xr-xplugins/history-substring-search/update-from-upstream.zsh129
-rw-r--r--plugins/hitchhiker/fortunes/hitchhiker2
-rw-r--r--plugins/httpie/_httpie2
-rw-r--r--plugins/ionic/ionic.plugin.zsh12
-rw-r--r--plugins/ipfs/_ipfs2
-rw-r--r--plugins/isodate/README.md4
-rw-r--r--plugins/iterm2/README.md2
-rw-r--r--plugins/iterm2/iterm2.plugin.zsh2
-rw-r--r--plugins/iterm2/iterm2_shell_integration.zsh4
-rw-r--r--plugins/jira/README.md66
-rw-r--r--plugins/jira/_jira2
-rw-r--r--plugins/jira/jira.plugin.zsh64
-rw-r--r--plugins/jj/README.md107
-rw-r--r--plugins/jj/jj.plugin.zsh70
-rw-r--r--plugins/jsontools/README.md13
-rw-r--r--plugins/juju/juju.plugin.zsh2
-rw-r--r--plugins/jump/jump.plugin.zsh4
-rw-r--r--plugins/k9s/README.md9
-rw-r--r--plugins/k9s/k9s.plugin.zsh14
-rw-r--r--plugins/kamal/README.md16
-rw-r--r--plugins/kamal/_kamal691
-rw-r--r--plugins/kamal/kamal.plugin.zsh25
-rw-r--r--plugins/keychain/keychain.plugin.zsh12
-rw-r--r--plugins/kitty/README.md23
-rw-r--r--plugins/kitty/kitty.plugin.zsh16
-rw-r--r--plugins/kn/kn.plugin.zsh2
-rw-r--r--plugins/kompose/README.md12
-rw-r--r--plugins/kompose/kompose.plugin.zsh3
-rw-r--r--plugins/kube-ps1/README.md4
-rw-r--r--plugins/kube-ps1/kube-ps1.plugin.zsh27
-rw-r--r--plugins/kubectl/README.md240
-rw-r--r--plugins/kubectl/kubectl.plugin.zsh46
-rw-r--r--plugins/kubectx/README.md44
-rw-r--r--plugins/kubectx/kubectx.plugin.zsh6
-rw-r--r--plugins/laravel/README.md7
-rw-r--r--plugins/laravel/laravel.plugin.zsh7
-rw-r--r--plugins/last-working-dir/last-working-dir.plugin.zsh17
-rw-r--r--plugins/localstack/README.md24
-rw-r--r--plugins/localstack/localstack.plugin.zsh37
-rw-r--r--plugins/localstack/sqs-send-result.pngbin0 -> 70661 bytes
-rw-r--r--plugins/lpass/_lpass2
-rw-r--r--plugins/macos/README.md13
-rw-r--r--plugins/macos/macos.plugin.zsh52
-rw-r--r--plugins/macports/README.md2
-rw-r--r--plugins/macports/_port8
-rw-r--r--plugins/magic-enter/magic-enter.plugin.zsh6
-rw-r--r--plugins/marked2/README.md2
-rw-r--r--plugins/marktext/README.md2
-rw-r--r--plugins/minikube/minikube.plugin.zsh22
-rw-r--r--plugins/mise/README.md32
-rw-r--r--plugins/mise/mise.plugin.zsh27
-rw-r--r--plugins/mix/README.md1
-rw-r--r--plugins/mix/_mix16
-rw-r--r--plugins/mongo-atlas/README.md2
-rw-r--r--plugins/mvn/README.md2
-rw-r--r--plugins/mvn/mvn.plugin.zsh10
-rw-r--r--plugins/n98-magerun/n98-magerun.plugin.zsh2
-rw-r--r--plugins/nestjs/README.md52
-rw-r--r--plugins/nestjs/nestjs.plugin.zsh41
-rw-r--r--plugins/ngrok/README.md20
-rw-r--r--plugins/ngrok/ngrok.plugin.zsh14
-rw-r--r--plugins/nmap/nmap.plugin.zsh2
-rw-r--r--plugins/nomad/_nomad4
-rw-r--r--plugins/npm/npm.plugin.zsh2
-rw-r--r--plugins/nvm/README.md12
-rw-r--r--plugins/nvm/_nvm34
-rw-r--r--plugins/nvm/nvm.plugin.zsh105
-rw-r--r--plugins/opentofu/README.md61
-rw-r--r--plugins/opentofu/opentofu.plugin.zsh46
-rw-r--r--plugins/otp/README.md2
-rw-r--r--plugins/pass/_pass7
-rw-r--r--plugins/per-directory-history/README.md4
-rw-r--r--plugins/per-directory-history/per-directory-history.zsh2
-rw-r--r--plugins/perl/README.md40
-rw-r--r--plugins/perl/perl.plugin.zsh9
-rw-r--r--plugins/pip/README.md28
-rw-r--r--plugins/pipenv/README.md4
-rw-r--r--plugins/pipenv/pipenv.plugin.zsh6
-rw-r--r--plugins/pm2/_pm2392
-rw-r--r--plugins/poetry-env/README.md2
-rw-r--r--plugins/poetry-env/poetry-env.plugin.zsh38
-rw-r--r--plugins/poetry/README.md33
-rw-r--r--plugins/poetry/poetry.plugin.zsh28
-rw-r--r--plugins/procs/README.md9
-rw-r--r--plugins/procs/procs.plugin.zsh21
-rw-r--r--plugins/pulumi/README.md41
-rw-r--r--plugins/pulumi/pulumi.plugin.zsh28
-rw-r--r--plugins/pyenv/README.md12
-rw-r--r--plugins/pyenv/pyenv.plugin.zsh14
-rw-r--r--plugins/python/README.md47
-rw-r--r--plugins/python/python.plugin.zsh55
-rw-r--r--plugins/rails/_rails952
-rw-r--r--plugins/rake-fast/rake-fast.plugin.zsh13
-rw-r--r--plugins/rand-quote/rand-quote.plugin.zsh2
-rw-r--r--plugins/rbfu/README.md18
-rw-r--r--plugins/rbfu/rbfu.plugin.zsh49
-rw-r--r--plugins/rbw/rbw.plugin.zsh17
-rw-r--r--plugins/rclone/README.md9
-rw-r--r--plugins/rclone/rclone.plugin.zsh14
-rw-r--r--plugins/react-native/README.md4
-rw-r--r--plugins/react-native/react-native.plugin.zsh4
-rw-r--r--plugins/repo/_repo2
-rw-r--r--plugins/ripgrep/README.md9
-rw-r--r--plugins/ripgrep/_ripgrep640
-rw-r--r--plugins/ros/_ros2
-rw-r--r--plugins/rsync/README.md26
-rw-r--r--plugins/rtx/README.md30
-rw-r--r--plugins/rtx/rtx.plugin.zsh18
-rw-r--r--plugins/rust/rust.plugin.zsh2
-rw-r--r--plugins/safe-paste/safe-paste.plugin.zsh3
-rw-r--r--plugins/sbt/sbt.plugin.zsh2
-rwxr-xr-xplugins/scd/scd2
-rw-r--r--plugins/screen/screen.plugin.zsh6
-rw-r--r--plugins/scw/README.md10
-rw-r--r--plugins/scw/_scw333
-rw-r--r--plugins/scw/scw.plugin.zsh14
-rwxr-xr-xplugins/shell-proxy/ssh-proxy.py3
-rw-r--r--plugins/shrink-path/shrink-path.plugin.zsh25
-rw-r--r--plugins/singlechar/singlechar.plugin.zsh2
-rw-r--r--plugins/spackenv/README.md17
-rw-r--r--plugins/spackenv/spackenv.plugin.zsh5
-rw-r--r--plugins/spring/README.md14
-rw-r--r--plugins/ssh-agent/README.md2
-rw-r--r--plugins/ssh-agent/ssh-agent.plugin.zsh14
-rw-r--r--plugins/ssh/README.md16
-rw-r--r--plugins/ssh/ssh.plugin.zsh53
-rw-r--r--plugins/starship/starship.plugin.zsh6
-rw-r--r--plugins/stripe/README.md9
-rw-r--r--plugins/stripe/stripe.plugin.zsh13
-rw-r--r--plugins/sublime/sublime.plugin.zsh4
-rw-r--r--plugins/suse/README.md8
-rw-r--r--plugins/swiftpm/README.md4
-rw-r--r--plugins/swiftpm/_swift256
-rw-r--r--plugins/symfony6/README.md9
-rw-r--r--plugins/symfony6/symfony6.plugin.zsh82
-rw-r--r--plugins/systemadmin/README.md5
-rw-r--r--plugins/systemadmin/systemadmin.plugin.zsh1
-rw-r--r--plugins/tailscale/README.md11
-rw-r--r--plugins/tailscale/tailscale.plugin.zsh25
-rw-r--r--plugins/task/README.md9
-rw-r--r--plugins/task/task.plugin.zsh14
-rw-r--r--plugins/terraform/README.md36
-rw-r--r--plugins/terraform/_terraform778
-rw-r--r--plugins/terraform/terraform.plugin.zsh18
-rw-r--r--plugins/thor/README.md2
-rw-r--r--plugins/timer/timer.plugin.zsh5
-rw-r--r--plugins/timoni/README.md9
-rw-r--r--plugins/timoni/timoni.plugin.zsh14
-rw-r--r--plugins/tldr/README.md18
-rw-r--r--plugins/tldr/tldr.plugin.zsh19
-rw-r--r--plugins/tmux/README.md42
-rw-r--r--plugins/tmux/tmux.plugin.zsh103
-rw-r--r--plugins/toolbox/README.md13
-rw-r--r--plugins/toolbox/toolbox.plugin.zsh10
-rw-r--r--plugins/tt/README.MD26
-rw-r--r--plugins/tt/tt.plugin.zsh21
-rw-r--r--plugins/ubuntu/README.md17
-rw-r--r--plugins/ubuntu/ubuntu.plugin.zsh15
-rw-r--r--plugins/ufw/README.md2
-rw-r--r--plugins/universalarchive/README.md86
-rw-r--r--plugins/uv/README.md36
-rw-r--r--plugins/uv/uv.plugin.zsh47
-rw-r--r--plugins/vagrant-prompt/README.md50
-rw-r--r--plugins/vagrant-prompt/vagrant-prompt.plugin.zsh45
-rw-r--r--plugins/vault/README.md8
-rw-r--r--plugins/vault/_vault400
-rw-r--r--plugins/vault/vault.plugin.zsh7
-rw-r--r--plugins/vi-mode/README.md25
-rw-r--r--plugins/vi-mode/vi-mode.plugin.zsh14
-rw-r--r--plugins/vim-interaction/README.md18
-rw-r--r--plugins/vim-interaction/vim-interaction.plugin.zsh2
-rw-r--r--plugins/virtualenv/virtualenv.plugin.zsh2
-rw-r--r--plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh3
-rw-r--r--plugins/volta/volta.plugin.zsh2
-rw-r--r--plugins/vscode/README.md34
-rw-r--r--plugins/vscode/vscode.plugin.zsh6
-rw-r--r--plugins/wd/README.md49
-rw-r--r--plugins/wd/_wd.sh10
-rw-r--r--plugins/wd/wd.plugin.zsh9
-rwxr-xr-x[-rw-r--r--]plugins/wd/wd.sh257
-rw-r--r--plugins/web-search/README.md27
-rw-r--r--plugins/web-search/web-search.plugin.zsh34
-rw-r--r--plugins/xcode/README.md2
-rw-r--r--plugins/yarn/README.md96
-rw-r--r--plugins/yarn/_yarn8
-rw-r--r--plugins/yarn/yarn.plugin.zsh34
-rw-r--r--plugins/yii2/README.md4
-rw-r--r--plugins/z/LICENSE2
-rw-r--r--plugins/z/MANUAL.md63
-rw-r--r--plugins/z/img/demo.gifbin0 -> 1271520 bytes
-rw-r--r--plugins/z/z.plugin.zsh62
-rw-r--r--plugins/zoxide/README.md3
-rw-r--r--plugins/zoxide/zoxide.plugin.zsh2
-rw-r--r--plugins/zsh-interactive-cd/README.md8
-rw-r--r--plugins/zsh-navigation-tools/README.md2
-rw-r--r--plugins/zsh-navigation-tools/doc/n-preview2
328 files changed, 7789 insertions, 5414 deletions
diff --git a/plugins/1password/1password.plugin.zsh b/plugins/1password/1password.plugin.zsh
index 941523ca8..e8f91f8fe 100644
--- a/plugins/1password/1password.plugin.zsh
+++ b/plugins/1password/1password.plugin.zsh
@@ -1,9 +1,15 @@
# Do nothing if op is not installed
(( ${+commands[op]} )) || return
-# Load op completion
-eval "$(op completion zsh)"
-compdef _op op
+# If the completion file doesn't exist yet, we need to autoload it and
+# bind it to `op`. Otherwise, compinit will have already done that.
+if [[ ! -f "$ZSH_CACHE_DIR/completions/_op" ]]; then
+ typeset -g -A _comps
+ autoload -Uz _op
+ _comps[op]=_op
+fi
+
+op completion zsh >| "$ZSH_CACHE_DIR/completions/_op" &|
# Load opswd function
autoload -Uz opswd
diff --git a/plugins/1password/opswd b/plugins/1password/opswd
index 0f667d2ff..753de9f99 100644
--- a/plugins/1password/opswd
+++ b/plugins/1password/opswd
@@ -27,7 +27,7 @@ function opswd() {
local password
# Copy the password to the clipboard
- if ! password=$(op item get "$service" --fields password 2>/dev/null); then
+ if ! password=$(op item get "$service" --reveal --fields password 2>/dev/null); then
echo "error: could not obtain password for $service"
return 1
fi
diff --git a/plugins/adb/README.md b/plugins/adb/README.md
deleted file mode 100644
index 83dcc7288..000000000
--- a/plugins/adb/README.md
+++ /dev/null
@@ -1,8 +0,0 @@
-# adb autocomplete plugin
-
-* Adds autocomplete options for all adb commands.
-* Add autocomplete for `adb -s`
-
-## Requirements
-
-In order to make this work, you will need to have the Android adb tools set up in your path.
diff --git a/plugins/adb/_adb b/plugins/adb/_adb
deleted file mode 100644
index 78c457746..000000000
--- a/plugins/adb/_adb
+++ /dev/null
@@ -1,67 +0,0 @@
-#compdef adb
-#autoload
-
-# in order to make this work, you will need to have the android adb tools
-
-# adb zsh completion, based on homebrew completion
-
-local -a _1st_arguments
-_1st_arguments=(
-'bugreport:return all information from the device that should be included in a bug report.'
-'connect:connect to a device via TCP/IP Port 5555 is default.'
-'devices:list all connected devices'
-'disconnect:disconnect from a TCP/IP device. Port 5555 is default.'
-'emu:run emulator console command'
-'forward:forward socket connections'
-'get-devpath:print the device path'
-'get-serialno:print the serial number of the device'
-'get-state:print the current state of the device: offline | bootloader | device'
-'help:show the help message'
-'install:push this package file to the device and install it'
-'jdwp:list PIDs of processes hosting a JDWP transport'
-'keygen:generate adb public/private key'
-'kill-server:kill the server if it is running'
-'logcat:view device log'
-'pull:copy file/dir from device'
-'push:copy file/dir to device'
-'reboot:reboots the device, optionally into the bootloader or recovery program'
-'reboot-bootloader:reboots the device into the bootloader'
-'remount:remounts the partitions on the device read-write'
-'root:restarts the adbd daemon with root permissions'
-'sideload:push a ZIP to device and install it'
-'shell:run remote shell interactively'
-'sync:copy host->device only if changed (-l means list but dont copy)'
-'start-server:ensure that there is a server running'
-'tcpip:restart host adb in tcpip mode'
-'uninstall:remove this app package from the device'
-'usb:restart the adbd daemon listing on USB'
-'version:show version num'
-'wait-for-device:block until device is online'
-)
-
-local expl
-local -a pkgs installed_pkgs
-
-_arguments \
- '-s[devices]:specify device:->specify_device' \
- '*:: :->subcmds' && return 0
-
-case "$state" in
- specify_device)
- _values -C 'devices' ${$(adb devices -l|awk 'NR>1&& $1 \
- {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
-
-if (( CURRENT == 1 )); then
- _describe -t commands "adb subcommand" _1st_arguments
- return
-fi
-
-_files
diff --git a/plugins/ag/README.md b/plugins/ag/README.md
deleted file mode 100644
index 1983aaa41..000000000
--- a/plugins/ag/README.md
+++ /dev/null
@@ -1,13 +0,0 @@
-# The Silver Searcher
-
-This plugin provides completion support for [`ag`](https://github.com/ggreer/the_silver_searcher).
-
-To use it, add ag to the plugins array in your zshrc file.
-
-```zsh
-plugins=(... ag)
-```
-
-## INSTALLATION NOTES
-
-Besides oh-my-zsh, `ag` needs to be installed by following these steps: https://github.com/ggreer/the_silver_searcher#installing.
diff --git a/plugins/ag/_ag b/plugins/ag/_ag
deleted file mode 100644
index 25b0c27a7..000000000
--- a/plugins/ag/_ag
+++ /dev/null
@@ -1,66 +0,0 @@
-#compdef ag
-#autoload
-
-typeset -A opt_args
-
-# Took the liberty of not listing every option… specially aliases and -D
-_ag () {
- local -a _1st_arguments
- _1st_arguments=(
- '--ackmate:Print results in AckMate-parseable format'
- {'-A','--after'}':[LINES] Print lines after match (Default: 2)'
- {'-B','--before'}':[LINES] Print lines before match (Default: 2)'
- '--break:Print newlines between matches in different files'
- '--nobreak:Do not print newlines between matches in different files'
- {'-c','--count'}':Only print the number of matches in each file'
- '--color:Print color codes in results (Default: On)'
- '--nocolor:Do not print color codes in results'
- '--color-line-number:Color codes for line numbers (Default: 1;33)'
- '--color-match:Color codes for result match numbers (Default: 30;43)'
- '--color-path:Color codes for path names (Default: 1;32)'
- '--column:Print column numbers in results'
- {'-H','--heading'}':Print file names (On unless searching a single file)'
- '--noheading:Do not print file names (On unless searching a single file)'
- '--line-numbers:Print line numbers even for streams'
- {'-C','--context'}':[LINES] Print lines before and after matches (Default: 2)'
- '-g:[PATTERN] Print filenames matching PATTERN'
- {'-l','--files-with-matches'}':Only print filenames that contain matches'
- {'-L','--files-without-matches'}':Only print filenames that do not contain matches'
- '--no-numbers:Do not print line numbers'
- {'-o','--only-matching'}':Prints only the matching part of the lines'
- '--print-long-lines:Print matches on very long lines (Default: 2k characters)'
- '--passthrough:When searching a stream, print all lines even if they do not match'
- '--silent:Suppress all log messages, including errors'
- '--stats:Print stats (files scanned, time taken, etc.)'
- '--vimgrep:Print results like vim :vimgrep /pattern/g would'
- {'-0','--null'}':Separate filenames with null (for "xargs -0")'
-
- {'-a','--all-types'}':Search all files (does not include hidden files / .gitignore)'
- '--depth:[NUM] Search up to NUM directories deep (Default: 25)'
- {'-f','--follow'}':Follow symlinks'
- {'-G','--file-search-regex'}':[PATTERN] Limit search to filenames matching PATTERN'
- '--hidden:Search hidden files (obeys .*ignore files)'
- {'-i','--ignore-case'}':Match case insensitively'
- '--ignore:[PATTERN] Ignore files/directories matching PATTERN'
- {'-m','--max-count'}':[NUM] Skip the rest of a file after NUM matches (Default: 10k)'
- {'-p','--path-to-agignore'}':[PATH] Use .agignore file at PATH'
- {'-Q','--literal'}':Do not parse PATTERN as a regular expression'
- {'-s','--case-sensitive'}':Match case'
- {'-S','--smart-case'}':Insensitive match unless PATTERN has uppercase (Default: On)'
- '--search-binary:Search binary files for matches'
- {'-t','--all-text'}':Search all text files (Hidden files not included)'
- {'-u','--unrestricted'}':Search all files (ignore .agignore and _all_)'
- {'-U','--skip-vcs-ignores'}':Ignore VCS files (stil obey .agignore)'
- {'-v','--invert-match'}':Invert match'
- {'-w','--word-regexp'}':Only match whole words'
- {'-z','--search-zip'}':Search contents of compressed (e.g., gzip) files'
-
- '--list-file-types:list of supported file types'
- )
-
- if [[ $words[-1] =~ "^-" ]]; then
- _describe -t commands "ag options" _1st_arguments && ret=0
- else
- _files && ret=0
- fi
-}
diff --git a/plugins/alias-finder/README.md b/plugins/alias-finder/README.md
index 6c87c723a..b24f8d4ac 100644
--- a/plugins/alias-finder/README.md
+++ b/plugins/alias-finder/README.md
@@ -2,7 +2,7 @@
This plugin searches the defined aliases and outputs any that match the command inputted. This makes learning new aliases easier.
-## Usage
+## Setup
To use it, add `alias-finder` to the `plugins` array of your zshrc file:
```
@@ -11,6 +11,8 @@ plugins=(... alias-finder)
To enable it for every single command, set zstyle in your `~/.zshrc`.
+If the user has installed `rg`([ripgrep](https://github.com/BurntSushi/ripgrep)), it will be used because it's faster. Otherwise, it will use the `grep` command.
+
```zsh
# ~/.zshrc
@@ -22,6 +24,41 @@ zstyle ':omz:plugins:alias-finder' cheaper yes # disabled by default
As you can see, options are also available with zstyle.
+## Usage
+
+When you execute a command alias finder will look at your defined aliases and suggest shorter aliases you could have used, for example:
+
+Running the un-aliased `git status` command:
+```sh
+╭─tim@fox ~/repo/gitopolis ‹main›
+╰─$ git status
+
+gst='git status' # <=== shorter suggestion from alias-finder
+
+On branch main
+Your branch is up-to-date with 'origin/main'.
+nothing to commit, working tree clean
+```
+
+Running a shorter `git st` alias from `.gitconfig` that it suggested :
+```sh
+╭─tim@fox ~/repo/gitopolis ‹main›
+╰─$ git st
+gs='git st' # <=== shorter suggestion from alias-finder
+## main...origin/main
+```
+
+Running the shortest `gs` shell alias that it found:
+```sh
+╭─tim@fox ~/repo/gitopolis ‹main›
+╰─$ gs
+ # <=== no suggestions alias-finder because this is the shortest
+## main...origin/main
+```
+
+![image](https://github.com/ohmyzsh/ohmyzsh/assets/19378/39642750-fb10-4f1a-b7f9-f36789eeb01b)
+
+
### Options
> In order to clarify, let's say `alias a=abc` has source 'abc' and destination 'a'.
diff --git a/plugins/alias-finder/alias-finder.plugin.zsh b/plugins/alias-finder/alias-finder.plugin.zsh
index 5fdfbc835..6f24c7089 100644
--- a/plugins/alias-finder/alias-finder.plugin.zsh
+++ b/plugins/alias-finder/alias-finder.plugin.zsh
@@ -36,14 +36,22 @@ alias-finder() {
# make filter to find only shorter results than current cmd
if [[ $cheaper == true ]]; then
cmdLen=$(echo -n "$cmd" | wc -c)
- filter="^'{0,1}.{0,$((cmdLen - 1))}="
+ if [[ $cmdLen -le 1 ]]; then
+ return
+ fi
+
+ filter="^'?.{1,$((cmdLen - 1))}'?=" # some aliases is surrounded by single quotes
fi
- alias | grep -E "$filter" | grep -E "=$finder"
+ if (( $+commands[rg] )); then
+ alias | rg "$filter" | rg "=$finder"
+ else
+ alias | grep -E "$filter" | grep -E "=$finder"
+ fi
if [[ $exact == true ]]; then
break # because exact case is only one
- elif [[ $longer = true ]]; then
+ elif [[ $longer == true ]]; then
break # because above grep command already found every longer aliases during first cycle
fi
diff --git a/plugins/aliases/README.md b/plugins/aliases/README.md
index 14f9c5c53..5a7e7dfc6 100644
--- a/plugins/aliases/README.md
+++ b/plugins/aliases/README.md
@@ -1,7 +1,5 @@
# Aliases cheatsheet
-**Maintainer:** [@hqingyi](https://github.com/hqingyi)
-
With lots of 3rd-party amazing aliases installed, this plugin helps list the shortcuts
that are currently available based on the plugins you have enabled.
@@ -13,6 +11,8 @@ plugins=(aliases)
Requirements: Python needs to be installed.
+**Maintainer:** [@hqingyi](https://github.com/hqingyi)
+
## Usage
- `als`: show all aliases by group
diff --git a/plugins/ansible/README.md b/plugins/ansible/README.md
index e0e6a19bb..6a06962ee 100644
--- a/plugins/ansible/README.md
+++ b/plugins/ansible/README.md
@@ -1,7 +1,5 @@
# ansible plugin
-## Introduction
-
The `ansible plugin` adds several aliases for useful [ansible](https://docs.ansible.com/ansible/latest/index.html) commands and [aliases](#aliases).
To use it, add `ansible` to the plugins array of your zshrc file:
@@ -21,7 +19,6 @@ plugins=(... ansible)
| `acon` | command `ansible-console` |
| `ainv` | command `ansible-inventory` |
| `aplaybook` | command `ansible-playbook` |
-| `ainv` | command `ansible-inventory` |
| `adoc` | command `ansible-doc` |
| `agal` | command `ansible-galaxy` |
| `apull` | command `ansible-pull` |
@@ -29,6 +26,6 @@ plugins=(... ansible)
## Maintainer
-### [Deepankumar](https://github.com/deepan10)
+### [Deepankumar](https://github.com/deepan10)
[https://github.com/deepan10/oh-my-zsh/tree/features/ansible-plugin](https://github.com/deepan10/oh-my-zsh/tree/features/ansible-plugin)
diff --git a/plugins/archlinux/archlinux.plugin.zsh b/plugins/archlinux/archlinux.plugin.zsh
index fca6548c0..7abd7c2f6 100644
--- a/plugins/archlinux/archlinux.plugin.zsh
+++ b/plugins/archlinux/archlinux.plugin.zsh
@@ -178,26 +178,27 @@ fi
# Check Arch Linux PGP Keyring before System Upgrade to prevent failure.
function upgrade() {
+ sudo pacman -Sy
echo ":: Checking Arch Linux PGP Keyring..."
- local installedver="$(sudo pacman -Qi archlinux-keyring | grep -Po '(?<=Version : ).*')"
- local currentver="$(sudo pacman -Si archlinux-keyring | grep -Po '(?<=Version : ).*')"
+ local installedver="$(LANG= sudo pacman -Qi archlinux-keyring | grep -Po '(?<=Version : ).*')"
+ local currentver="$(LANG= sudo pacman -Si archlinux-keyring | grep -Po '(?<=Version : ).*')"
if [ $installedver != $currentver ]; then
echo " Arch Linux PGP Keyring is out of date."
echo " Updating before full system upgrade."
- sudo pacman -Sy --needed --noconfirm archlinux-keyring
+ sudo pacman -S --needed --noconfirm archlinux-keyring
else
echo " Arch Linux PGP Keyring is up to date."
echo " Proceeding with full system upgrade."
fi
if (( $+commands[yay] )); then
- yay -Syu
+ yay -Su
elif (( $+commands[trizen] )); then
- trizen -Syu
+ trizen -Su
elif (( $+commands[pacaur] )); then
- pacaur -Syu
+ pacaur -Su
elif (( $+commands[aura] )); then
- sudo aura -Syu
+ sudo aura -Su
else
- sudo pacman -Syu
+ sudo pacman -Su
fi
}
diff --git a/plugins/arduino-cli/README.md b/plugins/arduino-cli/README.md
new file mode 100644
index 000000000..821d72bbf
--- /dev/null
+++ b/plugins/arduino-cli/README.md
@@ -0,0 +1,9 @@
+# Arduino CLI plugin
+
+This plugin adds completion for the [arduino-cli](https://github.com/arduino/arduino-cli) tool.
+
+To use it, add `arduino-cli` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... arduino-cli)
+```
diff --git a/plugins/arduino-cli/arduino-cli.plugin.zsh b/plugins/arduino-cli/arduino-cli.plugin.zsh
new file mode 100644
index 000000000..e4fdcf9fe
--- /dev/null
+++ b/plugins/arduino-cli/arduino-cli.plugin.zsh
@@ -0,0 +1,14 @@
+if (( ! $+commands[arduino-cli] )); then
+ return
+fi
+
+# If the completion file doesn't exist yet, we need to autoload it and
+# bind it to `arduino-cli`. Otherwise, compinit will have already done that.
+if [[ ! -f "$ZSH_CACHE_DIR/completions/_arduino-cli" ]]; then
+ typeset -g -A _comps
+ autoload -Uz _arduino-cli
+ _comps[arduino-cli]=_arduino-cli
+fi
+
+# Generate and load arduino-cli completion
+arduino-cli completion zsh >! "$ZSH_CACHE_DIR/completions/_arduino-cli" &|
diff --git a/plugins/asdf/README.md b/plugins/asdf/README.md
index f047860e2..69db6930a 100644
--- a/plugins/asdf/README.md
+++ b/plugins/asdf/README.md
@@ -1,30 +1,48 @@
-## asdf
-
-**Maintainer:** [@RobLoach](https://github.com/RobLoach)
+# asdf
Adds integration with [asdf](https://github.com/asdf-vm/asdf), the extendable version manager, with support for Ruby, Node.js, Elixir, Erlang and more.
-### Installation
+## Installation
-1. [Download asdf](https://asdf-vm.com/guide/getting-started.html#_2-download-asdf) by running the following:
+1. [Install](https://asdf-vm.com/guide/getting-started.html#_1-install-asdf) asdf and ensure that's it's discoverable on `$PATH`;
+2. Enable it by adding it to your `plugins` definition in `~/.zshrc`:
- ```
- git clone https://github.com/asdf-vm/asdf.git ~/.asdf
- ```
+```sh
+plugins=(asdf)
+```
-2. [Enable asdf](https://asdf-vm.com/guide/getting-started.html#_3-install-asdf) by adding it to your `plugins` definition in `~/.zshrc`.
+## Usage
- ```
- plugins=(asdf)
- ```
+Refer to the [asdf plugin documentation](https://asdf-vm.com/guide/getting-started.html#_4-install-a-plugin) for information on how to add a plugin and install the many runtime versions for it.
-### Usage
+Example for installing the nodejs plugin and the many runtimes for it:
-See the [asdf documentation](https://asdf-vm.com/guide/getting-started.html#_4-install-a-plugin) for information on how to use asdf:
+```sh
+# Add plugin to asdf
+asdf plugin add nodejs
-```
-asdf plugin add nodejs https://github.com/asdf-vm/asdf-nodejs.git
+# Install the latest available version
asdf install nodejs latest
-asdf global nodejs latest
-asdf local nodejs latest
+
+# Uninstall the latest version
+asdf uninstall nodejs latest
+
+# Install a specific version
+asdf install nodejs 16.5.0
+
+# Set the latest version in .tool-versions of the `current directory`
+asdf set nodejs latest
+
+# Set a specific version in the `parent directory`
+asdf set -p nodejs 16.5.0 # -p is shorthand for --parent
+
+# Set a global version under `$HOME`
+asdf set -u nodejs 16.5.0 # -u is shorthand for --home
```
+
+For more commands, run `asdf help` or refer to the
+[asdf CLI documentation](https://asdf-vm.com/manage/commands.html#all-commands).
+
+## Maintainer
+
+- [@RobLoach](https://github.com/RobLoach)
diff --git a/plugins/asdf/asdf.plugin.zsh b/plugins/asdf/asdf.plugin.zsh
index 7635d20c3..913949888 100644
--- a/plugins/asdf/asdf.plugin.zsh
+++ b/plugins/asdf/asdf.plugin.zsh
@@ -1,30 +1,15 @@
-# Find where asdf should be installed
-ASDF_DIR="${ASDF_DIR:-$HOME/.asdf}"
-ASDF_COMPLETIONS="$ASDF_DIR/completions"
+(( ! $+commands[asdf] )) && return
-if [[ ! -f "$ASDF_DIR/asdf.sh" || ! -f "$ASDF_COMPLETIONS/_asdf" ]]; then
- # If not found, check for archlinux/AUR package (/opt/asdf-vm/)
- if [[ -f "/opt/asdf-vm/asdf.sh" ]]; then
- ASDF_DIR="/opt/asdf-vm"
- ASDF_COMPLETIONS="$ASDF_DIR"
- # If not found, check for Homebrew package
- elif (( $+commands[brew] )); then
- _ASDF_PREFIX="$(brew --prefix asdf)"
- ASDF_DIR="${_ASDF_PREFIX}/libexec"
- ASDF_COMPLETIONS="${_ASDF_PREFIX}/share/zsh/site-functions"
- unset _ASDF_PREFIX
- else
- return
- fi
-fi
+export ASDF_DATA_DIR="${ASDF_DATA_DIR:-$HOME/.asdf}"
+
+# Add shims to the front of the path, removing if already present.
+path=("$ASDF_DATA_DIR/shims" ${path:#$ASDF_DATA_DIR/shims})
-# Load command
-if [[ -f "$ASDF_DIR/asdf.sh" ]]; then
- source "$ASDF_DIR/asdf.sh"
- # Load completions
- if [[ -f "$ASDF_COMPLETIONS/_asdf" ]]; then
- fpath+=("$ASDF_COMPLETIONS")
- autoload -Uz _asdf
- compdef _asdf asdf # compdef is already loaded before loading plugins
- fi
+# If the completion file doesn't exist yet, we need to autoload it and
+# bind it to `asdf`. Otherwise, compinit will have already done that.
+if [[ ! -f "$ZSH_CACHE_DIR/completions/_asdf" ]]; then
+ typeset -g -A _comps
+ autoload -Uz _asdf
+ _comps[asdf]=_asdf
fi
+asdf completion zsh >| "$ZSH_CACHE_DIR/completions/_asdf" &|
diff --git a/plugins/autojump/autojump.plugin.zsh b/plugins/autojump/autojump.plugin.zsh
index 1b868ee8d..a0668a415 100644
--- a/plugins/autojump/autojump.plugin.zsh
+++ b/plugins/autojump/autojump.plugin.zsh
@@ -1,18 +1,22 @@
declare -a autojump_paths
autojump_paths=(
- $HOME/.autojump/etc/profile.d/autojump.zsh # manual installation
- $HOME/.autojump/share/autojump/autojump.zsh # manual installation
- $HOME/.nix-profile/etc/profile.d/autojump.sh # NixOS installation
- /run/current-system/sw/share/autojump/autojump.zsh # NixOS installation
- /usr/share/autojump/autojump.zsh # Debian and Ubuntu package
- /etc/profile.d/autojump.zsh # manual installation
- /etc/profile.d/autojump.sh # Gentoo installation
- /usr/local/share/autojump/autojump.zsh # FreeBSD installation
- /usr/pkg/share/autojump/autojump.zsh # NetBSD installation
- /opt/local/etc/profile.d/autojump.sh # macOS with MacPorts
- /usr/local/etc/profile.d/autojump.sh # macOS with Homebrew (default)
- /opt/homebrew/etc/profile.d/autojump.sh # macOS with Homebrew (default on M1 macs)
- /etc/profiles/per-user/$USER/etc/profile.d/autojump.sh # macOS Nix, Home Manager and flakes
+ $HOME/.autojump/etc/profile.d/autojump.zsh # manual installation
+ $HOME/.autojump/share/autojump/autojump.zsh # manual installation
+ $HOME/.nix-profile/etc/profile.d/autojump.sh # NixOS installation
+ /run/current-system/sw/share/autojump/autojump.zsh # NixOS installation
+ /etc/profiles/per-user/$USER/share/autojump/autojump.zsh # Home Manager, NixOS with user-scoped packages
+ /usr/share/autojump/autojump.zsh # Debian and Ubuntu package
+ $PREFIX/share/autojump/autojump.zsh # Termux package
+ /etc/profile.d/autojump.zsh # manual installation
+ /etc/profile.d/autojump.sh # Gentoo installation
+ /usr/local/share/autojump/autojump.zsh # FreeBSD installation
+ /usr/pkg/share/autojump/autojump.zsh # NetBSD installation
+ /opt/local/etc/profile.d/autojump.sh # macOS with MacPorts
+ /usr/local/etc/profile.d/autojump.sh # macOS with Homebrew (default)
+ /opt/homebrew/etc/profile.d/autojump.sh # macOS with Homebrew (default on M1 macs)
+ /opt/pkg/share/autojump/autojump.zsh # macOS with pkgsrc
+ /etc/profiles/per-user/$USER/etc/profile.d/autojump.sh # macOS Nix, Home Manager and flakes
+ /nix/var/nix/gcroots/current-system/sw/share/zsh/site-functions/autojump.zsh # macOS Nix, nix-darwin
)
for file in $autojump_paths; do
diff --git a/plugins/aws/README.md b/plugins/aws/README.md
index 9e1e055b8..0d0773f63 100644
--- a/plugins/aws/README.md
+++ b/plugins/aws/README.md
@@ -16,6 +16,8 @@ plugins=(... aws)
It also sets `$AWS_EB_PROFILE` to `<profile>` for the Elastic Beanstalk CLI. It sets `$AWS_PROFILE_REGION` for display in `aws_prompt_info`.
Run `asp` without arguments to clear the profile.
* `asp [<profile>] login`: If AWS SSO has been configured in your aws profile, it will run the `aws sso login` command following profile selection.
+* `asp [<profile>] login [<sso_session>]`: In addition to `asp [<profile>] login`, if SSO session has been configured in your aws profile, it will run the `aws sso login --sso-session <sso_session>` command following profile selection.
+* `asp [<profile>] logout`: If AWS SSO has been configured in your aws profile, it will run the `aws sso logout` command following profile selection.
* `asr [<region>]`: sets `$AWS_REGION` and `$AWS_DEFAULT_REGION` (legacy) to `<region>`.
Run `asr` without arguments to clear the profile.
@@ -45,6 +47,11 @@ plugins=(... aws)
Some themes might overwrite the value of RPROMPT instead of appending to it, so they'll need to be fixed to
see the AWS profile/region prompt.
+* Set `AWS_PROFILE_STATE_ENABLED=true` in your zshrc file if you want the aws profile to persist between shell sessions.
+ This option might slow down your shell startup time.
+ By default the state file path is `/tmp/.aws_current_profile`. This means that the state won't survive a reboot or otherwise GC.
+ You can control the state file path using the `AWS_STATE_FILE` environment variable.
+
## Theme
The plugin creates an `aws_prompt_info` function that you can use in your theme, which displays
diff --git a/plugins/aws/aws.plugin.zsh b/plugins/aws/aws.plugin.zsh
index c946515be..0c43031df 100644
--- a/plugins/aws/aws.plugin.zsh
+++ b/plugins/aws/aws.plugin.zsh
@@ -6,10 +6,26 @@ function agr() {
echo $AWS_REGION
}
+# Update state file if enabled
+function _aws_update_state() {
+ if [[ "$AWS_PROFILE_STATE_ENABLED" == true ]]; then
+ test -d $(dirname ${AWS_STATE_FILE}) || exit 1
+ echo "${AWS_PROFILE} ${AWS_REGION}" > "${AWS_STATE_FILE}"
+ fi
+}
+
+function _aws_clear_state() {
+ if [[ "$AWS_PROFILE_STATE_ENABLED" == true ]]; then
+ test -d $(dirname ${AWS_STATE_FILE}) || exit 1
+ echo -n > "${AWS_STATE_FILE}"
+ fi
+}
+
# AWS profile selection
function asp() {
if [[ -z "$1" ]]; then
unset AWS_DEFAULT_PROFILE AWS_PROFILE AWS_EB_PROFILE AWS_PROFILE_REGION
+ _aws_clear_state
echo AWS profile cleared.
return
fi
@@ -28,8 +44,16 @@ function asp() {
export AWS_PROFILE_REGION=$(aws configure get region)
+ _aws_update_state
+
if [[ "$2" == "login" ]]; then
- aws sso login
+ if [[ -n "$3" ]]; then
+ aws sso login --sso-session $3
+ else
+ aws sso login
+ fi
+ elif [[ "$2" == "logout" ]]; then
+ aws sso logout
fi
}
@@ -37,6 +61,7 @@ function asp() {
function asr() {
if [[ -z "$1" ]]; then
unset AWS_DEFAULT_REGION AWS_REGION
+ _aws_update_state
echo AWS region cleared.
return
fi
@@ -50,6 +75,7 @@ function asr() {
export AWS_REGION=$1
export AWS_DEFAULT_REGION=$1
+ _aws_update_state
}
# AWS profile switch
@@ -196,8 +222,17 @@ function aws_change_access_key() {
}
function aws_regions() {
+ local region
+ if [[ $AWS_DEFAULT_REGION ]];then
+ region="$AWS_DEFAULT_REGION"
+ elif [[ $AWS_REGION ]];then
+ region="$AWS_REGION"
+ else
+ region="us-west-1"
+ fi
+
if [[ $AWS_DEFAULT_PROFILE || $AWS_PROFILE ]];then
- aws ec2 describe-regions |grep RegionName | awk -F ':' '{gsub(/"/, "", $2);gsub(/,/, "", $2);gsub(/ /, "", $2); print $2}'
+ aws ec2 describe-regions --region $region |grep RegionName | awk -F ':' '{gsub(/"/, "", $2);gsub(/,/, "", $2);gsub(/ /, "", $2); print $2}'
else
echo "You must specify a AWS profile."
fi
@@ -240,6 +275,22 @@ if [[ "$SHOW_AWS_PROMPT" != false && "$RPROMPT" != *'$(aws_prompt_info)'* ]]; th
RPROMPT='$(aws_prompt_info)'"$RPROMPT"
fi
+if [[ "$AWS_PROFILE_STATE_ENABLED" == true ]]; then
+ AWS_STATE_FILE="${AWS_STATE_FILE:-/tmp/.aws_current_profile}"
+ test -s "${AWS_STATE_FILE}" || return
+
+ aws_state=($(cat $AWS_STATE_FILE))
+
+ export AWS_DEFAULT_PROFILE="${aws_state[1]}"
+ export AWS_PROFILE="$AWS_DEFAULT_PROFILE"
+ export AWS_EB_PROFILE="$AWS_DEFAULT_PROFILE"
+
+ test -z "${aws_state[2]}" && AWS_REGION=$(aws configure get region)
+
+ export AWS_REGION=${AWS_REGION:-$aws_state[2]}
+ export AWS_DEFAULT_REGION="$AWS_REGION"
+fi
+
# Load awscli completions
# AWS CLI v2 comes with its own autocompletion. Check if that is there, otherwise fall back
diff --git a/plugins/battery/README.md b/plugins/battery/README.md
index 18e5bd882..07e4e0b16 100644
--- a/plugins/battery/README.md
+++ b/plugins/battery/README.md
@@ -12,6 +12,19 @@ Then, add the `battery_pct_prompt` function to your custom theme. For example:
RPROMPT='$(battery_pct_prompt) ...'
```
+Also, you set the `BATTERY_CHARGING` variable to your favor.
+For example:
+
+```zsh
+BATTERY_CHARGING="⚡️"
+```
+
+You can see the power of your charger using the following setting (MacOS only)
+
+```zsh
+BATTERY_SHOW_WATTS=true
+```
+
## Requirements
- On Linux, you must have the `acpi` or `acpitool` commands installed on your operating system.
diff --git a/plugins/battery/battery.plugin.zsh b/plugins/battery/battery.plugin.zsh
index 1d3d529a3..c7618f6b3 100644
--- a/plugins/battery/battery.plugin.zsh
+++ b/plugins/battery/battery.plugin.zsh
@@ -17,8 +17,13 @@
# Modified to add support for OpenBSD #
###########################################
+: ${BATTERY_SHOW_WATTS:=false}
+
if [[ "$OSTYPE" = darwin* ]]; then
+ function get_charger_power() {
+ echo "$(ioreg -rc AppleSmartBattery | grep -o '"Watts"=[0-9]\+' | head -1 | grep -o '[0-9]\+')W "
+ }
function battery_is_charging() {
ioreg -rc AppleSmartBattery | command grep -q '^.*"ExternalConnected"\ =\ Yes'
}
@@ -58,7 +63,10 @@ if [[ "$OSTYPE" = darwin* ]]; then
fi
echo "%{$fg[$color]%}[${battery_pct}%%]%{$reset_color%}"
else
- echo "∞"
+ if [[ "${BATTERY_SHOW_WATTS}" = "true" ]] ; then
+ watts=$(get_charger_power)
+ fi
+ echo "${watts}${BATTERY_CHARGING-⚡️}"
fi
}
diff --git a/plugins/bazel/README.md b/plugins/bazel/README.md
index fc375d219..b0c34a15f 100644
--- a/plugins/bazel/README.md
+++ b/plugins/bazel/README.md
@@ -1,7 +1,7 @@
# Bazel plugin
-This plugin adds completion for [bazel](https://bazel.build), an open-source build and
-test tool that scalably supports multi-language and multi-platform projects.
+This plugin adds completion and aliases for [bazel](https://bazel.build), an open-source build and test tool
+that scalably supports multi-language and multi-platform projects.
To use it, add `bazel` to the plugins array in your zshrc file:
@@ -12,3 +12,18 @@ plugins=(... bazel)
The plugin has a copy of [the completion script from the git repository][1].
[1]: https://github.com/bazelbuild/bazel/blob/master/scripts/zsh_completion/_bazel
+
+## Aliases
+
+| Alias | Command | Description |
+| ----- | ------------- | ------------------------- |
+| bzb | `bazel build` | The `bazel build` command |
+| bzt | `bazel test` | The `bazel test` command |
+| bzr | `bazel run` | The `bazel run` command |
+| bzq | `bazel query` | The `bazel query` command |
+
+## Functions
+
+| Function | Description |
+| -------- | -------------------------------- |
+| sri-hash | Generate SRI hash used by bzlmod |
diff --git a/plugins/bazel/bazel.plugin.zsh b/plugins/bazel/bazel.plugin.zsh
new file mode 100644
index 000000000..818d5652b
--- /dev/null
+++ b/plugins/bazel/bazel.plugin.zsh
@@ -0,0 +1,9 @@
+# Aliases for bazel
+alias bzb='bazel build'
+alias bzt='bazel test'
+alias bzr='bazel run'
+alias bzq='bazel query'
+
+sri-hash() {
+ openssl dgst -sha256 -binary $1 | openssl base64 -A | sed 's/^/sha256-/'
+}
diff --git a/plugins/bedtools/_bedtools b/plugins/bedtools/_bedtools
index ef6c4179a..15e3dc2ff 100644
--- a/plugins/bedtools/_bedtools
+++ b/plugins/bedtools/_bedtools
@@ -47,7 +47,7 @@ case $state in
"random[Generate random intervals in a genome.]" \
"reldist[Calculate the distribution of relative distances b/w two files.]" \
"sample[Sample random records from file using reservoir sampling.]" \
- "shuffle[Randomly redistrubute intervals in a genome.]" \
+ "shuffle[Randomly redistribute intervals in a genome.]" \
"slop[Adjust the size of intervals.]" \
"sort[Order the intervals in a file.]" \
"subtract[Remove intervals based on overlaps b/w two files.]" \
diff --git a/plugins/bgnotify/README.md b/plugins/bgnotify/README.md
index 33d529f15..1389def86 100644
--- a/plugins/bgnotify/README.md
+++ b/plugins/bgnotify/README.md
@@ -38,6 +38,7 @@ One can configure a few things:
- `bgnotify_bell` enabled or disables the terminal bell (default true)
- `bgnotify_threshold` sets the notification threshold time (default 6 seconds)
- `function bgnotify_formatted` lets you change the notification. You can for instance customize the message and pass in an icon.
+- `bgnotify_extraargs` appends extra args to notifier (e.g. `-e` for notify-send to create a transient notification)
Use these by adding a function definition before the your call to source. Example:
diff --git a/plugins/bgnotify/bgnotify.plugin.zsh b/plugins/bgnotify/bgnotify.plugin.zsh
index 3c0766191..4c1613eed 100644
--- a/plugins/bgnotify/bgnotify.plugin.zsh
+++ b/plugins/bgnotify/bgnotify.plugin.zsh
@@ -21,13 +21,12 @@ function bgnotify_end {
local elapsed=$(( EPOCHSECONDS - bgnotify_timestamp ))
# check time elapsed
- [[ $bgnotify_timestamp -gt 0 ]] || return
- [[ $elapsed -ge $bgnotify_threshold ]] || return
+ [[ $bgnotify_timestamp -gt 0 ]] || return 0
+ [[ $elapsed -ge $bgnotify_threshold ]] || return 0
# check if Terminal app is not active
- [[ $(bgnotify_appid) != "$bgnotify_termid" ]] || return
+ [[ $(bgnotify_appid) != "$bgnotify_termid" ]] || return 0
- [[ $bgnotify_bell = true ]] && printf '\a' # beep sound
bgnotify_formatted "$exit_status" "$bgnotify_lastcmd" "$elapsed"
} always {
bgnotify_timestamp=0
@@ -52,6 +51,7 @@ function bgnotify_formatted {
(( $3 < 60 )) || elapsed="$((( $3 % 3600) / 60 ))m $elapsed"
(( $3 < 3600 )) || elapsed="$(( $3 / 3600 ))h $elapsed"
+ [[ $bgnotify_bell = true ]] && printf '\a' # beep sound
if [[ $exit_status -eq 0 ]]; then
bgnotify "#win (took $elapsed)" "$cmd"
else
@@ -60,11 +60,12 @@ function bgnotify_formatted {
}
function bgnotify_appid {
- if (( ${+commands[osascript]} )); then
- # output is "app ID, window ID" (com.googlecode.iterm2, 116)
- osascript -e 'tell application (path to frontmost application as text) to get the {id, id of front window}' 2>/dev/null
- elif [[ -n $WAYLAND_DISPLAY ]] && (( ${+commands[swaymsg]} )); then # wayland+sway
- local app_id=$(find_sway_appid)
+ if (( ${+commands[lsappinfo]} )); then
+ lsappinfo info -only bundleid "$(lsappinfo front)" | awk -F= '{print $2}' | tr -d '"' 2>/dev/null
+ elif (( ${+commands[osascript]} )); then
+ osascript -e "tell application id \"$(bgnotify_programid)\" to get the {id, frontmost, id of front window, visible of front window}" 2>/dev/null
+ elif [[ -n $WAYLAND_DISPLAY ]] && ([[ -n $SWAYSOCK ]] || [[ -n $I3SOCK ]]) && (( ${+commands[swaymsg]} )); then # wayland+sway
+ local app_id=$(bgnotify_find_sway_appid)
[[ -n "$app_id" ]] && echo "$app_id" || echo $EPOCHSECONDS
elif [[ -z $WAYLAND_DISPLAY ]] && [[ -n $DISPLAY ]] && (( ${+commands[xprop]} )); then
xprop -root _NET_ACTIVE_WINDOW 2>/dev/null | cut -d' ' -f5
@@ -74,7 +75,7 @@ function bgnotify_appid {
}
-function find_sway_appid {
+function bgnotify_find_sway_appid {
# output is "app_id,container_id", for example "Alacritty,1694"
# see example swaymsg output: https://github.com/ohmyzsh/ohmyzsh/files/13463939/output.json
if (( ${+commands[jq]} )); then
@@ -105,15 +106,12 @@ function find_sway_appid {
fi
}
-function find_term_id {
- local term_id="${bgnotify_termid%%,*}" # remove window id
- if [[ -z "$term_id" ]]; then
- case "$TERM_PROGRAM" in
- iTerm.app) term_id='com.googlecode.iterm2' ;;
- Apple_Terminal) term_id='com.apple.terminal' ;;
- esac
- fi
- echo "$term_id"
+function bgnotify_programid {
+ case "$TERM_PROGRAM" in
+ iTerm.app) echo 'com.googlecode.iterm2' ;;
+ Apple_Terminal) echo 'com.apple.terminal' ;;
+ ghostty) echo 'com.mitchellh.ghostty' ;;
+ esac
}
function bgnotify {
@@ -121,16 +119,16 @@ function bgnotify {
local message="$2"
local icon="$3"
if (( ${+commands[terminal-notifier]} )); then # macOS
- local term_id=$(find_term_id)
- terminal-notifier -message "$message" -title "$title" ${=icon:+-appIcon "$icon"} ${=term_id:+-activate "$term_id" -sender "$term_id"} &>/dev/null
+ local term_id=$(bgnotify_programid)
+ terminal-notifier -message "$message" -title "$title" ${=icon:+-appIcon "$icon"} ${=term_id:+-activate "$term_id"} ${=bgnotify_extraargs:-} &>/dev/null
elif (( ${+commands[growlnotify]} )); then # macOS growl
- growlnotify -m "$title" "$message"
+ growlnotify -m "$title" "$message" ${=bgnotify_extraargs:-}
elif (( ${+commands[notify-send]} )); then
- notify-send "$title" "$message" ${=icon:+--icon "$icon"}
+ notify-send "$title" "$message" ${=icon:+--icon "$icon"} ${=bgnotify_extraargs:-}
elif (( ${+commands[kdialog]} )); then # KDE
- kdialog --title "$title" --passivepopup "$message" 5
+ kdialog --title "$title" --passivepopup "$message" 5 ${=bgnotify_extraargs:-}
elif (( ${+commands[notifu]} )); then # cygwin
- notifu /m "$message" /p "$title" ${=icon:+/i "$icon"}
+ notifu /m "$message" /p "$title" ${=icon:+/i "$icon"} ${=bgnotify_extraargs:-}
fi
}
diff --git a/plugins/branch/README.md b/plugins/branch/README.md
index a15dd22df..2b6d12d29 100644
--- a/plugins/branch/README.md
+++ b/plugins/branch/README.md
@@ -39,7 +39,7 @@ index 2fd5f2cd..9d89a464 100644
PROMPT="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ )"
-PROMPT+=' %{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info)'
+PROMPT+=' %{$fg[cyan]%}%c%{$reset_color%} $(branch_prompt_info)'
-
+
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}git:(%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
```
diff --git a/plugins/branch/branch.plugin.zsh b/plugins/branch/branch.plugin.zsh
index dd5871fdc..c24f9098e 100644
--- a/plugins/branch/branch.plugin.zsh
+++ b/plugins/branch/branch.plugin.zsh
@@ -8,7 +8,7 @@ function branch_prompt_info() {
while [[ "$dir" != '/' ]]; do
# Found .git directory
if [[ -d "${dir}/.git" ]]; then
- branch="${"$(<"${dir}/.git/HEAD")"##*/}"
+ branch="${"$(<"${dir}/.git/HEAD")"##ref: refs/heads/}"
echo '±' "${branch:gs/%/%%}"
return
fi
diff --git a/plugins/brew/README.md b/plugins/brew/README.md
index 299393b28..89c902ee4 100644
--- a/plugins/brew/README.md
+++ b/plugins/brew/README.md
@@ -19,19 +19,41 @@ the `brew` binary before sourcing `oh-my-zsh.sh` and it'll set up the environmen
## Aliases
-| Alias | Command | Description |
-| -------- | --------------------------------------- | ------------------------------------------------------------------- |
-| `bcubc` | `brew upgrade --cask && brew cleanup` | Update outdated casks, then run cleanup. |
-| `bcubo` | `brew update && brew outdated --cask` | Update Homebrew data, then list outdated casks. |
-| `brewp` | `brew pin` | Pin a specified formula so that it's not upgraded. |
-| `brews` | `brew list -1` | List installed formulae or the installed files for a given formula. |
-| `brewsp` | `brew list --pinned` | List pinned formulae, or show the version of a given formula. |
-| `bubc` | `brew upgrade && brew cleanup` | Upgrade outdated formulae and casks, then run cleanup. |
-| `bugbc` | `brew upgrade --greedy && brew cleanup` | Upgrade outdated formulae and casks (greedy), then run cleanup. |
-| `bubo` | `brew update && brew outdated` | Update Homebrew data, then list outdated formulae and casks. |
-| `bubu` | `bubo && bubc` | Do the last two operations above. |
-| `bfu` | `brew upgrade --formula` | Upgrade only formulas (not casks). |
-| `buz` | `brew uninstall --zap` | Remove all files associated with a cask. |
+| Alias | Command | Description |
+| -------- | --------------------------------------- | --------------------------------------------------------------------- |
+| `ba` | `brew autoremove` | Uninstall unnecessary formulae. |
+| `bcfg` | `brew config` | Show Homebrew and system configuration info useful for debugging. |
+| `bci` | `brew info --cask` | Display information about the given cask. |
+| `bcin` | `brew install --cask` | Install the given cask. |
+| `bcl` | `brew list --cask` | List installed casks. |
+| `bcn` | `brew cleanup` | Run cleanup. |
+| `bco` | `brew outdated --cask` | Report all outdated casks. |
+| `bcrin` | `brew reinstall --cask` | Reinstall the given cask. |
+| `bcubc` | `brew upgrade --cask && brew cleanup` | Upgrade outdated casks, then run cleanup. |
+| `bcubo` | `brew update && brew outdated --cask` | Update Homebrew data, then list outdated casks. |
+| `bcup` | `brew upgrade --cask` | Upgrade all outdated casks. |
+| `bdr` | `brew doctor` | Check your system for potential problems. |
+| `bfu` | `brew upgrade --formula` | Upgrade only formulae (not casks). |
+| `bi` | `brew install` | Install a formula. |
+| `bl` | `brew list` | List all installed formulae. |
+| `bo` | `brew outdated` | List installed formulae that have an updated version available. |
+| `brewp` | `brew pin` | Pin a specified formula so that it's not upgraded. |
+| `brews` | `brew list -1` | List installed formulae or the installed files for a given formula. |
+| `brewsp` | `brew list --pinned` | List pinned formulae, or show the version of a given formula. |
+| `bs` | `brew search` | Perform a substring search of cask tokens and formula names for text. |
+| `bsl` | `brew services list` | List all running services. |
+| `bsoff` | `brew services stop` | Stop the service and unregister it from launching at login (or boot). |
+| `bsoffa` | `bsoff --all` | Stop all started services. |
+| `bson` | `brew services start` | Start the service and register it to launch at login (or boot). |
+| `bsona` | `bson --all` | Start all stopped services. |
+| `bsr` | `brew services run` | Run the service without registering to launch at login (or boot). |
+| `bsra` | `bsr --all` | Run all stopped services. |
+| `bu` | `brew update` | Update brew and all installed formulae. |
+| `bubo` | `brew update && brew outdated` | Update Homebrew data, then list outdated formulae and casks. |
+| `bubu` | `bubo && bup` | Do the last two operations above. |
+| `bugbc` | `brew upgrade --greedy && brew cleanup` | Upgrade outdated formulae and casks (greedy), then run cleanup. |
+| `bup` | `brew upgrade` | Upgrade outdated, unpinned brews. |
+| `buz` | `brew uninstall --zap` | Remove all files associated with a cask. |
## Completion
diff --git a/plugins/brew/brew.plugin.zsh b/plugins/brew/brew.plugin.zsh
index 447036376..432a36076 100644
--- a/plugins/brew/brew.plugin.zsh
+++ b/plugins/brew/brew.plugin.zsh
@@ -24,7 +24,7 @@ if (( ! $+commands[brew] )); then
fi
if [[ -z "$HOMEBREW_PREFIX" ]]; then
- # Maintain compatability with potential custom user profiles, where we had
+ # Maintain compatibility with potential custom user profiles, where we had
# previously relied on always sourcing shellenv. OMZ plugins should not rely
# on this to be defined due to out of order processing.
export HOMEBREW_PREFIX="$(brew --prefix)"
@@ -34,17 +34,38 @@ if [[ -d "$HOMEBREW_PREFIX/share/zsh/site-functions" ]]; then
fpath+=("$HOMEBREW_PREFIX/share/zsh/site-functions")
fi
+alias ba='brew autoremove'
+alias bcfg='brew config'
+alias bci='brew info --cask'
+alias bcin='brew install --cask'
+alias bcl='brew list --cask'
+alias bcn='brew cleanup'
+alias bco='brew outdated --cask'
+alias bcrin='brew reinstall --cask'
alias bcubc='brew upgrade --cask && brew cleanup'
alias bcubo='brew update && brew outdated --cask'
-alias bcubc='brew upgrade --cask && brew cleanup'
+alias bcup='brew upgrade --cask'
+alias bdr='brew doctor'
+alias bfu='brew upgrade --formula'
+alias bi='brew install'
+alias bl='brew list'
+alias bo='brew outdated'
alias brewp='brew pin'
alias brewsp='brew list --pinned'
-alias bubc='brew upgrade && brew cleanup'
-alias bugbc='brew upgrade --greedy && brew cleanup'
+alias bs='brew search'
+alias bsl='brew services list'
+alias bsoff='brew services stop'
+alias bsoffa='bsoff --all'
+alias bson='brew services start'
+alias bsona='bson --all'
+alias bsr='brew services run'
+alias bsra='bsr --all'
+alias bu='brew update'
alias bubo='brew update && brew outdated'
-alias bubu='bubo && bubc'
+alias bubu='bubo && bup'
alias bubug='bubo && bugbc'
-alias bfu='brew upgrade --formula'
+alias bugbc='brew upgrade --greedy && brew cleanup'
+alias bup='brew upgrade'
alias buz='brew uninstall --zap'
function brews() {
diff --git a/plugins/buf/README.md b/plugins/buf/README.md
new file mode 100644
index 000000000..946cf38dd
--- /dev/null
+++ b/plugins/buf/README.md
@@ -0,0 +1,9 @@
+# Buf plugin
+
+This plugin adds completion for [Buf CLI](https://github.com/bufbuild/buf), a tool working with Protocol Buffers.
+
+To use it, add `buf` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... buf)
+``` \ No newline at end of file
diff --git a/plugins/buf/buf.plugin.zsh b/plugins/buf/buf.plugin.zsh
new file mode 100644
index 000000000..0b251ac37
--- /dev/null
+++ b/plugins/buf/buf.plugin.zsh
@@ -0,0 +1,14 @@
+# Autocompletion for the Buf CLI (buf).
+if (( !$+commands[buf] )); then
+ return
+fi
+# If the completion file doesn't exist yet, we need to autoload it and
+# bind it to `buf`. Otherwise, compinit will have already done that.
+if [[ ! -f "$ZSH_CACHE_DIR/completions/_buf" ]]; then
+ typeset -g -A _comps
+ autoload -Uz _buf
+ _comps[buf]=_buf
+fi
+
+# Generate and load buf completion
+buf completion zsh >! "$ZSH_CACHE_DIR/completions/_buf" &| \ No newline at end of file
diff --git a/plugins/bun/bun.plugin.zsh b/plugins/bun/bun.plugin.zsh
index 9924faa84..576dbbfeb 100644
--- a/plugins/bun/bun.plugin.zsh
+++ b/plugins/bun/bun.plugin.zsh
@@ -11,4 +11,4 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_bun" ]]; then
_comps[bun]=_bun
fi
-bun completions >| "$ZSH_CACHE_DIR/completions/_bun" &|
+SHELL=zsh bun completions >| "$ZSH_CACHE_DIR/completions/_bun" &|
diff --git a/plugins/bundler/_bundler b/plugins/bundler/_bundler
index 51678dd7c..6613cc68a 100644
--- a/plugins/bundler/_bundler
+++ b/plugins/bundler/_bundler
@@ -1,4 +1,4 @@
-#compdef bundle
+#compdef bundle bundler
local curcontext="$curcontext" state line _gems _opts ret=1
diff --git a/plugins/catimg/README.md b/plugins/catimg/README.md
index 8f2688050..4cfda0e25 100644
--- a/plugins/catimg/README.md
+++ b/plugins/catimg/README.md
@@ -1,6 +1,7 @@
# catimg
-Plugin for displaying images on the terminal using the the `catimg.sh` script provided by [posva](https://github.com/posva/catimg)
+Plugin for displaying images on the terminal using the `catimg.sh` script provided by
+[posva](https://github.com/posva/catimg)
To use it, add `catimg` to the plugins array in your zshrc file:
@@ -10,7 +11,7 @@ plugins=(... catimg)
## Requirements
-- `convert` (ImageMagick)
+- `magick convert` (ImageMagick)
## Functions
diff --git a/plugins/catimg/catimg.plugin.zsh b/plugins/catimg/catimg.plugin.zsh
index f4ff6f856..ad10d8574 100644
--- a/plugins/catimg/catimg.plugin.zsh
+++ b/plugins/catimg/catimg.plugin.zsh
@@ -9,9 +9,11 @@
function catimg() {
- if [[ -x `which convert` ]]; then
- zsh $ZSH/plugins/catimg/catimg.sh $@
+ if (( $+commands[magick] )); then
+ CONVERT_CMD="magick" zsh $ZSH/plugins/catimg/catimg.sh $@
+ elif (( $+commands[convert] )); then
+ CONVERT_CMD="convert" zsh $ZSH/plugins/catimg/catimg.sh $@
else
- echo "catimg need convert (ImageMagick) to work)"
+ echo "catimg need magick/convert (ImageMagick) to work)"
fi
}
diff --git a/plugins/catimg/catimg.sh b/plugins/catimg/catimg.sh
index f58392428..7946ad16e 100644
--- a/plugins/catimg/catimg.sh
+++ b/plugins/catimg/catimg.sh
@@ -7,6 +7,10 @@
# GitHub: https://github.com/posva/catimg #
################################################################################
+# this should come from outside, either `magick` or `convert`
+# from imagemagick v7 and ahead `convert` is deprecated
+: ${CONVERT_CMD:=convert}
+
function help() {
echo "Usage catimg [-h] [-w width] [-c char] img"
echo "By default char is \" \" and w is the terminal width"
@@ -43,23 +47,23 @@ if [ ! "$WIDTH" ]; then
else
COLS=$(expr $WIDTH "/" $(echo -n "$CHAR" | wc -c))
fi
-WIDTH=$(convert "$IMG" -print "%w\n" /dev/null)
+WIDTH=$($CONVERT_CMD "$IMG" -print "%w\n" /dev/null)
if [ "$WIDTH" -gt "$COLS" ]; then
WIDTH=$COLS
fi
REMAP=""
-if convert "$IMG" -resize $COLS\> +dither -remap $COLOR_FILE /dev/null ; then
+if $CONVERT_CMD "$IMG" -resize $COLS\> +dither -remap $COLOR_FILE /dev/null ; then
REMAP="-remap $COLOR_FILE"
else
echo "The version of convert is too old, don't expect good results :(" >&2
- #convert "$IMG" -colors 256 PNG8:tmp.png
- #IMG="tmp.png"
+ # $CONVERT_CMD "$IMG" -colors 256 PNG8:tmp.png
+ # IMG="tmp.png"
fi
# Display the image
I=0
-convert "$IMG" -resize $COLS\> +dither `echo $REMAP` txt:- 2>/dev/null |
+$CONVERT_CMD "$IMG" -resize $COLS\> +dither `echo $REMAP` txt:- 2>/dev/null |
sed -e 's/.*none.*/NO NO NO/g' -e '1d;s/^.*(\(.*\)[,)].*$/\1/g;y/,/ /' |
while read R G B f; do
if [ ! "$R" = "NO" ]; then
diff --git a/plugins/chezmoi/README.md b/plugins/chezmoi/README.md
new file mode 100644
index 000000000..32aee73b2
--- /dev/null
+++ b/plugins/chezmoi/README.md
@@ -0,0 +1,11 @@
+# chezmoi Plugin
+
+## Introduction
+
+This `chezmoi` plugin sets up completion for [chezmoi](https://chezmoi.io).
+
+To use it, add `chezmoi` to the plugins array of your zshrc file:
+
+```bash
+plugins=(... chezmoi)
+```
diff --git a/plugins/chezmoi/chezmoi.plugin.zsh b/plugins/chezmoi/chezmoi.plugin.zsh
new file mode 100644
index 000000000..80e19fea1
--- /dev/null
+++ b/plugins/chezmoi/chezmoi.plugin.zsh
@@ -0,0 +1,14 @@
+# COMPLETION FUNCTION
+if (( ! $+commands[chezmoi] )); then
+ return
+fi
+
+# If the completion file doesn't exist yet, we need to autoload it and
+# bind it to `chezmoi`. Otherwise, compinit will have already done that.
+if [[ ! -f "$ZSH_CACHE_DIR/completions/_chezmoi" ]]; then
+ typeset -g -A _comps
+ autoload -Uz _chezmoi
+ _comps[chezmoi]=_chezmoi
+fi
+
+chezmoi completion zsh >| "$ZSH_CACHE_DIR/completions/_chezmoi" &|
diff --git a/plugins/chruby/chruby.plugin.zsh b/plugins/chruby/chruby.plugin.zsh
index d7a28d4e2..1bcc6c6d9 100644
--- a/plugins/chruby/chruby.plugin.zsh
+++ b/plugins/chruby/chruby.plugin.zsh
@@ -2,7 +2,7 @@
_source-from-omz-settings() {
local _chruby_path _chruby_auto
-
+
zstyle -s :omz:plugins:chruby path _chruby_path || return 1
zstyle -s :omz:plugins:chruby auto _chruby_auto || return 1
@@ -15,6 +15,13 @@ _source-from-omz-settings() {
fi
}
+_source-from-default-location() {
+ [[ -r /usr/local/share/chruby/chruby.sh ]] || return 1
+
+ source /usr/local/share/chruby/chruby.sh
+ source /usr/local/share/chruby/auto.sh
+}
+
_source-from-homebrew() {
(( $+commands[brew] )) || return 1
@@ -22,8 +29,10 @@ _source-from-homebrew() {
# check default brew prefix
if [[ -h /usr/local/opt/chruby ]];then
_brew_prefix="/usr/local/opt/chruby"
+ elif [[ -h /opt/homebrew/opt/chruby ]]; then
+ _brew_prefix="/opt/homebrew/opt/chruby"
else
- # ok , it is not default prefix
+ # 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 chruby)
fi
@@ -34,27 +43,14 @@ _source-from-homebrew() {
source $_brew_prefix/share/chruby/auto.sh
}
-_load-chruby-dirs() {
- local dir
- for dir in "$HOME/.rubies" "$PREFIX/opt/rubies"; do
- if [[ -d "$dir" ]]; then
- RUBIES+=("$dir")
- fi
- done
-}
-
# Load chruby
-if _source-from-omz-settings; then
- _load-chruby-dirs
-elif [[ -r "/usr/local/share/chruby/chruby.sh" ]] ; then
- source /usr/local/share/chruby/chruby.sh
- source /usr/local/share/chruby/auto.sh
- _load-chruby-dirs
-elif _source-from-homebrew; then
- _load-chruby-dirs
-fi
+_source-from-omz-settings || \
+ _source-from-default-location || \
+ _source-from-homebrew
-unfunction _source-from-homebrew _source-from-omz-settings _load-chruby-dirs
+unfunction _source-from-homebrew \
+ _source-from-default-location \
+ _source-from-omz-settings
## chruby utility functions and aliases
diff --git a/plugins/chucknorris/README.md b/plugins/chucknorris/README.md
index b51875de9..655e7cf11 100644
--- a/plugins/chucknorris/README.md
+++ b/plugins/chucknorris/README.md
@@ -1,6 +1,6 @@
# chucknorris
-Chuck Norris fortunes plugin for Oh My Zsh. Perfectly suitable as MOTD.
+Fortunes plugin for Chuck Norris for Oh My Zsh. Perfectly suitable as MOTD.
To use it add `chucknorris` to the plugins array in you zshrc file.
@@ -36,3 +36,10 @@ Last login: Fri Jan 30 23:12:26 on ttys001
- `cowsay` if using `chuck_cow`
Available via homebrew, apt, ...
+
+> [!NOTE]
+> In addition to installing `fortune`, it may be necessary to run:
+>
+> `strfile $ZSH/plugins/chucknorris/fortunes/chucknorris\n`
+>
+> (include the "\n" literally) to write the fortune data to the proper directory.
diff --git a/plugins/cloudfoundry/README.md b/plugins/cloudfoundry/README.md
index 89dd9d1ce..567a9056b 100644
--- a/plugins/cloudfoundry/README.md
+++ b/plugins/cloudfoundry/README.md
@@ -50,7 +50,7 @@ Alternatively, seek out the [online documentation][3]. And don't forget, there a
## Contributors
-Contributed to `oh_my_zsh` by [benwilcock][2].
+Contributed to `oh_my_zsh` by [benwilcock][2].
[1]: https://docs.cloudfoundry.org/cf-cli/install-go-cli.html
[2]: https://github.com/benwilcock
diff --git a/plugins/coffee/README.md b/plugins/coffee/README.md
index 2baade844..c2ab192b6 100644
--- a/plugins/coffee/README.md
+++ b/plugins/coffee/README.md
@@ -24,7 +24,7 @@ Also provides the following aliases:
* **cfc:** Copies the compiled JS to your clipboard. Very useful when you want
to run the code in a JS console.
-* **cfp:** Compiles from your currently copied clipboard. Useful when you want
+* **cfp:** Compiles from your currently copied clipboard. Useful when you want
to compile large/multi-line snippets
* **cfpc:** Paste coffeescript from clipboard, compile to JS, then copy the
diff --git a/plugins/colorize/colorize.plugin.zsh b/plugins/colorize/colorize.plugin.zsh
index 12841e0ee..c49acd864 100644
--- a/plugins/colorize/colorize.plugin.zsh
+++ b/plugins/colorize/colorize.plugin.zsh
@@ -42,12 +42,12 @@ colorize_cat() {
ZSH_COLORIZE_STYLE="emacs"
fi
- # Use stdin if no arguments have been passed.
- if [ $# -eq 0 ]; then
+ # Use stdin if stdin is not attached to a terminal.
+ if [ ! -t 0 ]; then
if [[ "$ZSH_COLORIZE_TOOL" == "pygmentize" ]]; then
pygmentize -O style="$ZSH_COLORIZE_STYLE" -g
else
- chroma --style="$ZSH_COLORIZE_STYLE" --formatter="${ZSH_COLORIZE_CHROMA_FORMATTER:-terminal}"
+ chroma --style="$ZSH_COLORIZE_STYLE" --formatter="${ZSH_COLORIZE_CHROMA_FORMATTER:-terminal}" "$@"
fi
return $?
fi
diff --git a/plugins/command-not-found/README.md b/plugins/command-not-found/README.md
index 5a373c537..88761bb88 100644
--- a/plugins/command-not-found/README.md
+++ b/plugins/command-not-found/README.md
@@ -30,5 +30,6 @@ It works out of the box with the command-not-found packages for:
- [NixOS](https://github.com/NixOS/nixpkgs/tree/master/nixos/modules/programs/command-not-found)
- [Termux](https://github.com/termux/command-not-found)
- [SUSE](https://www.unix.com/man-page/suse/1/command-not-found/)
+- [Gentoo](https://github.com/AndrewAmmerlaan/command-not-found-gentoo/tree/main)
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 c741e18a2..85d778004 100644
--- a/plugins/command-not-found/command-not-found.plugin.zsh
+++ b/plugins/command-not-found/command-not-found.plugin.zsh
@@ -4,6 +4,10 @@ for file (
# Arch Linux. Must have pkgfile installed: https://wiki.archlinux.org/index.php/Pkgfile#Command_not_found
/usr/share/doc/pkgfile/command-not-found.zsh
# Homebrew: https://github.com/Homebrew/homebrew-command-not-found
+ /opt/homebrew/Library/Homebrew/command-not-found/handler.sh
+ /usr/local/Homebrew/Library/Homebrew/command-not-found/handler.sh
+ /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/command-not-found/handler.sh
+ # Old homebrew implementation
/opt/homebrew/Library/Taps/homebrew/homebrew-command-not-found/handler.sh
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-command-not-found/handler.sh
/home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-command-not-found/handler.sh
diff --git a/plugins/common-aliases/README.md b/plugins/common-aliases/README.md
index 1417c3056..79e3d0d0f 100644
--- a/plugins/common-aliases/README.md
+++ b/plugins/common-aliases/README.md
@@ -114,13 +114,13 @@ that file will be open with `acroread`.
### Listing files inside a packed file
-| Alias | Command | Description |
-| ------ | ---------- | --------------------------------- |
-| zip | `unzip -l` | Lists files inside a .zip file |
-| rar | `unrar l` | Lists files inside a .rar file |
-| tar | `tar tf` | Lists files inside a .tar file |
-| tar.gz | `echo` | Lists files inside a .tar.gz file |
-| ace | `unace l` | Lists files inside a .ace file |
+| Alias | Command | Description |
+| ------ | ------------ | --------------------------------- |
+| zip | `unzip -l` | Lists files inside a .zip file |
+| rar | `unrar l` | Lists files inside a .rar file |
+| tar | `tar tf` | Lists files inside a .tar file |
+| tar.gz | `tar -ztf` | Lists files inside a .tar.gz file |
+| ace | `unace l` | Lists files inside a .ace file |
### Some other features
diff --git a/plugins/compleat/compleat.plugin.zsh b/plugins/compleat/compleat.plugin.zsh
index 38f1b396a..7fbd2b953 100644
--- a/plugins/compleat/compleat.plugin.zsh
+++ b/plugins/compleat/compleat.plugin.zsh
@@ -7,7 +7,7 @@
if (( ${+commands[compleat]} )); then
local prefix="${commands[compleat]:h:h}"
- local setup="${prefix}/share/compleat-1.0/compleat_setup"
+ local setup="${prefix}/share/compleat-1.0/compleat_setup"
if [[ -f "$setup" ]]; then
if ! bashcompinit >/dev/null 2>&1; then
@@ -15,6 +15,6 @@ if (( ${+commands[compleat]} )); then
bashcompinit -i
fi
- source "$setup"
+ source "$setup"
fi
fi
diff --git a/plugins/conda-env/README.md b/plugins/conda-env/README.md
new file mode 100644
index 000000000..ccf48a392
--- /dev/null
+++ b/plugins/conda-env/README.md
@@ -0,0 +1,44 @@
+# conda-env
+
+The plugin displays information of the created virtual container of conda and allows background theming.
+
+To use it, add `conda-env` to the plugins array of your zshrc file:
+```
+plugins=(... conda-env)
+```
+
+The plugin creates a `conda_prompt_info` function that you can use in your theme, which displays the
+basename of the current `$CONDA_DEFAULT_ENV`.
+
+You can use this prompt function in your themes, by adding it to the `PROMPT` or `RPROMPT` variables. See [Example](#example) for more information.
+
+## Settings
+
+It uses two variables to control how the information is shown:
+
+- `ZSH_THEME_CONDA_PREFIX`: sets the prefix of the CONDA_DEFAULT_ENV.
+Defaults to `[`.
+
+- `ZSH_THEME_CONDA_SUFFIX`: sets the suffix of the CONDA_DEFAULT_ENV.
+Defaults to `]`.
+
+## Example
+
+```sh
+ZSH_THEME_CONDA_PREFIX='conda:%F{green}'
+ZSH_THEME_CONDA_SUFFIX='%f'
+RPROMPT='$(conda_prompt_info)'
+```
+
+## `CONDA_CHANGEPS1`
+
+This plugin also automatically sets the `CONDA_CHANGEPS1` variable to `false` to avoid conda changing the prompt
+automatically. This has the same effect as running `conda config --set changeps1 false`.
+
+You can override this behavior by adding `unset CONDA_CHANGEPS1` in your `.zshrc` file, after Oh My Zsh has been
+sourced.
+
+References:
+
+- https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#determining-your-current-environment
+- https://conda.io/projects/conda/en/latest/user-guide/configuration/use-condarc.html#precedence
diff --git a/plugins/conda-env/conda-env.plugin.zsh b/plugins/conda-env/conda-env.plugin.zsh
new file mode 100644
index 000000000..c710c952f
--- /dev/null
+++ b/plugins/conda-env/conda-env.plugin.zsh
@@ -0,0 +1,9 @@
+function conda_prompt_info(){
+ [[ -n ${CONDA_DEFAULT_ENV} ]] || return
+ echo "${ZSH_THEME_CONDA_PREFIX=[}${CONDA_DEFAULT_ENV:t:gs/%/%%}${ZSH_THEME_CONDA_SUFFIX=]}"
+}
+
+# Has the same effect as `conda config --set changeps1 false`
+# - https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#determining-your-current-environment
+# - https://conda.io/projects/conda/en/latest/user-guide/configuration/use-condarc.html#precedence
+export CONDA_CHANGEPS1=false
diff --git a/plugins/conda/README.md b/plugins/conda/README.md
new file mode 100644
index 000000000..70530d01e
--- /dev/null
+++ b/plugins/conda/README.md
@@ -0,0 +1,37 @@
+# conda plugin
+
+The conda plugin provides [aliases](#aliases) for `conda`, usually installed via [anaconda](https://www.anaconda.com/) or [miniconda](https://docs.conda.io/en/latest/miniconda.html).
+
+To use it, add `conda` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... conda)
+```
+
+## Aliases
+
+| Alias | Command | Description |
+| :------- | :-------------------------------------- | :------------------------------------------------------------------------------ |
+| `cna` | `conda activate` | Activate the specified conda environment |
+| `cnab` | `conda activate base` | Activate the base conda environment |
+| `cncf` | `conda env create -f` | Create a new conda environment from a YAML file |
+| `cncn` | `conda create -y -n` | Create a new conda environment with the given name |
+| `cnconf` | `conda config` | View or modify conda configuration |
+| `cncp` | `conda create -y -p` | Create a new conda environment with the given prefix |
+| `cncr` | `conda create -n` | Create new virtual environment with given name |
+| `cncss` | `conda config --show-source` | Show the locations of conda configuration sources |
+| `cnde` | `conda deactivate` | Deactivate the current conda environment |
+| `cnel` | `conda env list` | List all available conda environments |
+| `cni` | `conda install` | Install given package |
+| `cniy` | `conda install -y` | Install given package without confirmation |
+| `cnl` | `conda list` | List installed packages in the current environment |
+| `cnle` | `conda list --export` | Export the list of installed packages in the current environment |
+| `cnles` | `conda list --explicit > spec-file.txt` | Export the list of installed packages in the current environment to a spec file |
+| `cnr` | `conda remove` | Remove given package |
+| `cnrn` | `conda remove -y -all -n` | Remove all packages in the specified environment |
+| `cnrp` | `conda remove -y -all -p` | Remove all packages in the specified prefix |
+| `cnry` | `conda remove -y` | Remove given package without confirmation |
+| `cnsr` | `conda search` | Search conda repositories for package |
+| `cnu` | `conda update` | Update conda package manager |
+| `cnua` | `conda update --all` | Update all installed packages |
+| `cnuc` | `conda update conda` | Update conda package manager |
diff --git a/plugins/conda/conda.plugin.zsh b/plugins/conda/conda.plugin.zsh
new file mode 100644
index 000000000..7a130ba7b
--- /dev/null
+++ b/plugins/conda/conda.plugin.zsh
@@ -0,0 +1,23 @@
+alias cna='conda activate'
+alias cnab='conda activate base'
+alias cncf='conda env create -f'
+alias cncn='conda create -y -n'
+alias cnconf='conda config'
+alias cncp='conda create -y -p'
+alias cncr='conda create -n'
+alias cncss='conda config --show-source'
+alias cnde='conda deactivate'
+alias cnel='conda env list'
+alias cni='conda install'
+alias cniy='conda install -y'
+alias cnl='conda list'
+alias cnle='conda list --export'
+alias cnles='conda list --explicit > spec-file.txt'
+alias cnr='conda remove'
+alias cnrn='conda remove -y --all -n'
+alias cnrp='conda remove -y --all -p'
+alias cnry='conda remove -y'
+alias cnsr='conda search'
+alias cnu='conda update'
+alias cnua='conda update --all'
+alias cnuc='conda update conda'
diff --git a/plugins/copybuffer/copybuffer.plugin.zsh b/plugins/copybuffer/copybuffer.plugin.zsh
index e67f920f0..e636d9730 100644
--- a/plugins/copybuffer/copybuffer.plugin.zsh
+++ b/plugins/copybuffer/copybuffer.plugin.zsh
@@ -1,8 +1,8 @@
-# copy the active line from the command line buffer
+# copy the active line from the command line buffer
# onto the system clipboard
copybuffer () {
- if which clipcopy &>/dev/null; then
+ if builtin which clipcopy &>/dev/null; then
printf "%s" "$BUFFER" | clipcopy
else
zle -M "clipcopy not found. Please make sure you have Oh My Zsh installed correctly."
diff --git a/plugins/copyfile/copyfile.plugin.zsh b/plugins/copyfile/copyfile.plugin.zsh
index f4eca5acf..3281410e5 100644
--- a/plugins/copyfile/copyfile.plugin.zsh
+++ b/plugins/copyfile/copyfile.plugin.zsh
@@ -1,7 +1,19 @@
# Copies the contents of a given file to the system or X Windows clipboard
#
-# copyfile <file>
+# Usage: copyfile <file>
function copyfile {
emulate -L zsh
+
+ if [[ -z "$1" ]]; then
+ echo "Usage: copyfile <file>"
+ return 1
+ fi
+
+ if [[ ! -f "$1" ]]; then
+ echo "Error: '$1' is not a valid file."
+ return 1
+ fi
+
clipcopy $1
+ echo ${(%):-"%B$1%b copied to clipboard."}
}
diff --git a/plugins/dash/README.md b/plugins/dash/README.md
index 0ca3e4e44..970c6541f 100644
--- a/plugins/dash/README.md
+++ b/plugins/dash/README.md
@@ -19,7 +19,7 @@ dash
- Query for something in dash app: `dash query`
```
-dash golang
+dash golang
```
- You can optionally provide a keyword: `dash [keyword:]query`
diff --git a/plugins/dash/dash.plugin.zsh b/plugins/dash/dash.plugin.zsh
index f6801a870..9abd691c7 100644
--- a/plugins/dash/dash.plugin.zsh
+++ b/plugins/dash/dash.plugin.zsh
@@ -1,5 +1,5 @@
# Usage: dash [keyword:]query
-dash() { open -a Dash.app dash://"$*" }
+dash() { open -a Dash.app "dash://$(omz_urlencode -r $*)" }
compdef _dash dash
_dash() {
diff --git a/plugins/dbt/README.md b/plugins/dbt/README.md
index e05d79cc3..74ae631cd 100644
--- a/plugins/dbt/README.md
+++ b/plugins/dbt/README.md
@@ -1,13 +1,11 @@
# dbt plugin
-## Introduction
-
The `dbt plugin` adds several aliases for useful [dbt](https://docs.getdbt.com/) commands and
[aliases](#aliases).
To use it, add `dbt` to the plugins array of your zshrc file:
-```
+```zsh
plugins=(... dbt)
```
@@ -26,4 +24,4 @@ plugins=(... dbt)
## Maintainer
-### [msempere](https://github.com/msempere)
+- [msempere](https://github.com/msempere)
diff --git a/plugins/debian/debian.plugin.zsh b/plugins/debian/debian.plugin.zsh
index 5ef4cfb67..980440c0f 100644
--- a/plugins/debian/debian.plugin.zsh
+++ b/plugins/debian/debian.plugin.zsh
@@ -83,9 +83,9 @@ else
}
alias ac="su -ls '$apt_pref clean' root"
alias ad="su -lc '$apt_pref update' root"
- alias adg="su -lc '$apt_pref update && aptitude $apt_upgr' root"
- alias adu="su -lc '$apt_pref update && aptitude dist-upgrade' root"
- alias afu="su -lc '$apt-file update'"
+ alias adg="su -lc '$apt_pref update && $apt_pref $apt_upgr' root"
+ alias adu="su -lc '$apt_pref update && $apt_pref dist-upgrade' root"
+ alias afu="su -lc 'apt-file update'"
alias au="su -lc '$apt_pref $apt_upgr' root"
function ai() {
cmd="su -lc '$apt_pref install $@' root"
diff --git a/plugins/dircycle/README.md b/plugins/dircycle/README.md
index 3c9b3a96f..c4105558d 100644
--- a/plugins/dircycle/README.md
+++ b/plugins/dircycle/README.md
@@ -37,13 +37,13 @@ Say you opened these directories on the terminal:
3 ~
```
-By pressing <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Left</kbd>, the current working directory or `$CWD` will be from `oh-my-zsh` to `Hacktoberfest`. Press it again and it will be at `Projects`.
+By pressing <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Left</kbd>, the current working directory or `$PWD` will be from `oh-my-zsh` to `Hacktoberfest`. Press it again and it will be at `Projects`.
-And by pressing <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Right</kbd>, the `$CWD` will be from `Projects` to `Hacktoberfest`. Press it again and it will be at `oh-my-zsh`.
+And by pressing <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Right</kbd>, the `$PWD` will be from `Projects` to `Hacktoberfest`. Press it again and it will be at `oh-my-zsh`.
Here's a example history table with the same accessed directories like above:
-| Current `$CWD` | Key press | New `$CWD` |
+| Current `$PWD` | Key press | New `$PWD` |
| --------------- | ----------------------------------------------------- | --------------- |
| `oh-my-zsh` | <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Left</kbd> | `Hacktoberfest` |
| `Hacktoberfest` | <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Left</kbd> | `Projects` |
@@ -53,7 +53,7 @@ Here's a example history table with the same accessed directories like above:
| `Hacktoberfest` | <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Right</kbd> | `oh-my-zsh` |
| `oh-my-zsh` | <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Right</kbd> | `~` |
-Note the last traversal, when pressing <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Right</kbd> on a last known `$CWD`, it will change back to the first known `$CWD`, which in the example is `~`.
+Note the last traversal, when pressing <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Right</kbd> on a last known `$PWD`, it will change back to the first known `$PWD`, which in the example is `~`.
Here's an asciinema cast demonstrating the example above:
@@ -61,18 +61,22 @@ Here's an asciinema cast demonstrating the example above:
## Functions
-| Function | Description |
-| -------------------- | --------------------------------------------------------------------------------------------------------- |
-| `insert-cycledleft` | Change `$CWD` to the previous known stack, binded on <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Left</kbd> |
-| `insert-cycledright` | Change `$CWD` to the next known stack, binded on <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Right</kbd> |
+| Function | Description |
+| -------------------- | ------------------------------------------------------------------------------------------------------------------- |
+| `insert-cycledleft` | Change `$PWD` to the previous known stack, bound to <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Left</kbd> |
+| `insert-cycledright` | Change `$PWD` to the next known stack, bound to <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Right</kbd> |
+| `insert-cycledup` | Change `$PWD` to the parent folder, bound to <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Up</kbd> |
+| `insert-cycleddown` | Change `$PWD` to the first alphabetical child folder, bound to <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Down</kbd> |
## Rebinding keys
-You can bind these functions to other key sequences, as long as you know the bindkey sequence. For example, these commands bind to <kbd>Alt</kbd> + <kbd>Shift</kbd> + <kbd>Left</kbd> / <kbd>Right</kbd> in `xterm-256color`:
+You can bind these functions to other key sequences, as long as you know the bindkey sequence. For example, these commands bind to <kbd>Alt</kbd> + <kbd>Shift</kbd> + <kbd>key</kbd> in `xterm-256color`:
```zsh
bindkey '^[[1;4D' insert-cycledleft
bindkey '^[[1;4C' insert-cycledright
+bindkey "\e[1;4A" insert-cycledup
+bindkey "\e[1;4B" insert-cycleddown
```
You can get the bindkey sequence by pressing <kbd>Ctrl</kbd> + <kbd>V</kbd>, then pressing the keyboard shortcut you want to use.
diff --git a/plugins/dircycle/dircycle.plugin.zsh b/plugins/dircycle/dircycle.plugin.zsh
index bb69f6b3f..8c03594ba 100644
--- a/plugins/dircycle/dircycle.plugin.zsh
+++ b/plugins/dircycle/dircycle.plugin.zsh
@@ -8,7 +8,16 @@
# pushd +N: start counting from left of `dirs' output
# pushd -N: start counting from right of `dirs' output
+# Either switch to a directory from dirstack, using +N or -N syntax
+# or switch to a directory by path, using `switch-to-dir -- <path>`
switch-to-dir () {
+ # If $1 is --, then treat $2 as a directory path
+ if [[ $1 == -- ]]; then
+ # We use `-q` because we don't want chpwd to run, we'll do it manually
+ [[ -d "$2" ]] && builtin pushd -q "$2" &>/dev/null
+ return $?
+ fi
+
setopt localoptions nopushdminus
[[ ${#dirstack} -eq 0 ]] && return 1
@@ -22,10 +31,10 @@ switch-to-dir () {
}
insert-cycledleft () {
- switch-to-dir +1 || return
+ switch-to-dir +1 || return $?
local fn
- for fn (chpwd $chpwd_functions precmd $precmd_functions); do
+ for fn in chpwd $chpwd_functions precmd $precmd_functions; do
(( $+functions[$fn] )) && $fn
done
zle reset-prompt
@@ -33,22 +42,46 @@ insert-cycledleft () {
zle -N insert-cycledleft
insert-cycledright () {
- switch-to-dir -0 || return
+ switch-to-dir -0 || return $?
local fn
- for fn (chpwd $chpwd_functions precmd $precmd_functions); do
+ for fn in chpwd $chpwd_functions precmd $precmd_functions; do
(( $+functions[$fn] )) && $fn
done
zle reset-prompt
}
zle -N insert-cycledright
+insert-cycledup () {
+ switch-to-dir -- .. || return $?
+
+ local fn
+ for fn in chpwd $chpwd_functions precmd $precmd_functions; do
+ (( $+functions[$fn] )) && $fn
+ done
+ zle reset-prompt
+}
+zle -N insert-cycledup
+
+insert-cycleddown () {
+ switch-to-dir -- "$(find . -mindepth 1 -maxdepth 1 -type d | sort -n | head -n 1)" || return $?
+
+ local fn
+ for fn in chpwd $chpwd_functions precmd $precmd_functions; do
+ (( $+functions[$fn] )) && $fn
+ done
+ zle reset-prompt
+}
+zle -N insert-cycleddown
# These sequences work for xterm, Apple Terminal.app, and probably others.
# Not for rxvt-unicode, but it doesn't seem differentiate Ctrl-Shift-Arrow
# from plain Shift-Arrow, at least by default.
+#
# iTerm2 does not have these key combinations defined by default; you will need
# to add them under "Keys" in your profile if you want to use this. You can do
# this conveniently by loading the "xterm with Numeric Keypad" preset.
-bindkey "\e[1;6D" insert-cycledleft
-bindkey "\e[1;6C" insert-cycledright
+bindkey "\e[1;6D" insert-cycledleft # Ctrl+Shift+Left
+bindkey "\e[1;6C" insert-cycledright # Ctrl+Shift+Right
+bindkey "\e[1;6A" insert-cycledup # Ctrl+Shift+Up
+bindkey "\e[1;6B" insert-cycleddown # Ctrl+Shift+Down
diff --git a/plugins/direnv/direnv.plugin.zsh b/plugins/direnv/direnv.plugin.zsh
index 0a33194dd..c026dbe76 100644
--- a/plugins/direnv/direnv.plugin.zsh
+++ b/plugins/direnv/direnv.plugin.zsh
@@ -1,5 +1,8 @@
-# Don't continue if direnv is not found
-command -v direnv &>/dev/null || return
+# If direnv is not found, don't continue and print a warning
+if (( ! $+commands[direnv] )); then
+ echo "Warning: direnv not found. Please install direnv and ensure it's in your PATH before using this plugin."
+ return
+fi
_direnv_hook() {
trap -- '' SIGINT;
diff --git a/plugins/dirhistory/README.md b/plugins/dirhistory/README.md
index ede9b5410..66e3e0469 100644
--- a/plugins/dirhistory/README.md
+++ b/plugins/dirhistory/README.md
@@ -60,3 +60,46 @@ to `/usr` again.
After that, <kbd>Alt</kbd> + <kbd>Down</kbd> will probably go to `/usr/bin` if `bin` is the first directory in alphabetical
order (depends on your `/usr` folder structure). <kbd>Alt</kbd> + <kbd>Up</kbd> will return to `/usr`, and once more will get
you to the root folder (`/`).
+
+### cde
+
+This plugin also provides a `cde` alias that allows you to change to a directory without clearing the next directory stack.
+This changes the default behavior of `dirhistory`, which is to clear the next directory stack when changing directories.
+
+For example, if the shell was started, and the following commands were entered:
+
+```shell
+cd ~
+cd /usr
+cd share
+cd doc
+
+# <Alt + Left>
+# <Alt + Left>
+```
+
+The directory stack would look like this:
+
+```sh
+➜ /usr typeset -pm dirhistory_\*
+typeset -ax dirhistory_past=( /home/user /usr )
+typeset -ax dirhistory_future=( /usr/share/doc /usr/share )
+```
+
+This means that pressing <kbd>Alt</kbd> + <kbd>Right</kbd>, you'd go to `/usr/share` and `/usr/share/doc` (the "future" directories).
+
+If you run `cd /usr/bin`, the "future" directories will be removed, and you won't be able to access them with <kbd>Alt</kbd> + <kbd>Right</kbd>:
+
+```sh
+➜ /u/bin typeset -pm dirhistory_\*
+typeset -ax dirhistory_past=( /home/user /usr )
+typeset -ax dirhistory_future=( /usr/bin )
+```
+
+If you instead run `cde /usr/bin`, the "future" directories will be preserved:
+
+```sh
+➜ /u/bin typeset -pm dirhistory_\*
+typeset -ax dirhistory_past=( /home/user /usr /usr/bin )
+typeset -ax dirhistory_future=( /usr/share/doc /usr/share )
+```
diff --git a/plugins/dirhistory/dirhistory.plugin.zsh b/plugins/dirhistory/dirhistory.plugin.zsh
index 8d67c6188..706bb6fb2 100644
--- a/plugins/dirhistory/dirhistory.plugin.zsh
+++ b/plugins/dirhistory/dirhistory.plugin.zsh
@@ -11,9 +11,10 @@ dirhistory_past=($PWD)
dirhistory_future=()
export dirhistory_past
export dirhistory_future
-
export DIRHISTORY_SIZE=30
+alias cde='dirhistory_cd'
+
# Pop the last element of dirhistory_past.
# Pass the name of the variable to return the result in.
# Returns the element if the array was not empty,
@@ -136,7 +137,11 @@ for keymap in emacs vicmd viins; do
case "$TERM_PROGRAM" in
Apple_Terminal) bindkey -M $keymap "^[b" dirhistory_zle_dirhistory_back ;; # Terminal.app
- iTerm.app) bindkey -M $keymap "^[^[[D" dirhistory_zle_dirhistory_back ;; # iTerm2
+ ghostty) bindkey -M $keymap "^[b" dirhistory_zle_dirhistory_back ;; # ghostty
+ iTerm.app)
+ bindkey -M $keymap "^[^[[D" dirhistory_zle_dirhistory_back
+ bindkey -M $keymap "^[b" dirhistory_zle_dirhistory_back
+ ;;
esac
if (( ${+terminfo[kcub1]} )); then
@@ -151,7 +156,11 @@ for keymap in emacs vicmd viins; do
case "$TERM_PROGRAM" in
Apple_Terminal) bindkey -M $keymap "^[f" dirhistory_zle_dirhistory_future ;; # Terminal.app
- iTerm.app) bindkey -M $keymap "^[^[[C" dirhistory_zle_dirhistory_future ;; # iTerm2
+ ghostty) bindkey -M $keymap "^[f" dirhistory_zle_dirhistory_future ;; # ghostty
+ iTerm.app)
+ bindkey -M $keymap "^[^[[C" dirhistory_zle_dirhistory_future
+ bindkey -M $keymap "^[f" dirhistory_zle_dirhistory_future
+ ;;
esac
if (( ${+terminfo[kcuf1]} )); then
@@ -200,6 +209,7 @@ for keymap in emacs vicmd viins; do
case "$TERM_PROGRAM" in
Apple_Terminal) bindkey -M $keymap "^[[A" dirhistory_zle_dirhistory_up ;; # Terminal.app
iTerm.app) bindkey -M $keymap "^[^[[A" dirhistory_zle_dirhistory_up ;; # iTerm2
+ ghostty) bindkey -M $keymap "^[[1;3A" dirhistory_zle_dirhistory_up ;; # ghostty
esac
if (( ${+terminfo[kcuu1]} )); then
@@ -215,6 +225,7 @@ for keymap in emacs vicmd viins; do
case "$TERM_PROGRAM" in
Apple_Terminal) bindkey -M $keymap "^[[B" dirhistory_zle_dirhistory_down ;; # Terminal.app
iTerm.app) bindkey -M $keymap "^[^[[B" dirhistory_zle_dirhistory_down ;; # iTerm2
+ ghostty) bindkey -M $keymap "^[[1;3B" dirhistory_zle_dirhistory_down ;; # ghostty
esac
if (( ${+terminfo[kcud1]} )); then
diff --git a/plugins/dnf/_dnf5 b/plugins/dnf/_dnf5
new file mode 100644
index 000000000..3422fae32
--- /dev/null
+++ b/plugins/dnf/_dnf5
@@ -0,0 +1,570 @@
+#compdef dnf5
+# based on dnf-5.2.6.2
+
+# utility functions
+
+_dnf5_helper() {
+ _call_program specs $service "${(q-)@}" "${(q-)PREFIX}\*" \
+ -qC --assumeno --nogpgcheck 2>/dev/null </dev/null
+}
+
+_dnf5_repositories() {
+ # required option: -T (all|disabled|enabled)
+ local selected expl
+ zparseopts -D -E - T:=selected
+ selected=$selected[2]
+ _wanted $selected-repositories expl "$selected repository" \
+ compadd "$@" - "${(@)${(f)$(_dnf5_helper repo list --$selected)}[2,-1]%% *}"
+}
+
+_dnf5_packages() {
+ # required option: -T (all|available|installed|upgradable)
+ local selected opt expl
+ zparseopts -D -E - T:=selected
+ selected=$selected[2]
+ case $selected in
+ all) opt='' ;; # option --all does not exist
+ upgradable) opt='--upgrades' ;;
+ *) opt="--$selected" ;;
+ esac
+ _wanted $selected-packages expl "$selected package" \
+ compadd "$@" - $(_dnf5_helper repoquery $opt --qf='%{name} ')
+}
+
+_dnf5_rpm_files() {
+ local expl
+ _wanted rpm-files expl 'rpm file' _files -g '(#i)*.rpm(-.)'
+}
+
+_dnf5_packages_or_rpms() {
+ if [[ "$words[CURRENT]" = (*/*|\~*) ]]; then # if looks like a path name
+ _dnf5_rpm_files
+ else
+ _dnf5_packages "$@"
+ fi
+}
+
+_dnf5_groups() {
+ # optional option: -T (available|installed)
+ local update_policy selected line pat groups
+ zparseopts -D -E - T:=selected
+ selected=$selected[2]
+ if [[ -z $selected ]]; then
+ selected=all
+ opt= # option --all does not exist
+ else
+ opt=--$selected
+ fi
+ # XXX hidden groups are not included
+ for line in ${${(f)"$(_dnf5_helper group list $opt)"}[2,-1]}; do
+ line=( ${(z)line} )
+ groups+=( "$line[1]:$line[2,-2]" )
+ done
+ _describe -t $selected-groups "$selected group" groups
+}
+
+_dnf5_environments() {
+ local line envs
+ for line in ${${(f)"$(_dnf5_helper environment list)"}[2,-1]}; do
+ line=( ${(z)line} )
+ envs+=( "$line[1]:$line[2,-2]" )
+ done
+ _describe -t environments 'environment' envs
+}
+
+# completers for (several) dnf commands
+
+_dnf5-advisory () {
+ _arguments : \
+ $advisory_opts \
+ '--contains-pkgs=[only show advisories containing specified packages]: : _sequence _dnf5_packages -T installed' \
+ + '(with)' \
+ '--with-cve[show only advisories referencing CVE ticket]' \
+ '--with-bz[show only advisories referencing Bugzilla ticket]' \
+ + '(type)' \
+ '--all[show all advisories]' \
+ '--available[show advisories containing newer versions of installed packages (default)]' \
+ '--installed[show advisories containing equal and older version of installed packages]' \
+ '--updates[show advisories containing upgradable packages]' \
+ + args \
+ ':subcommand:(list info summary)' '*:advisory spec:'
+}
+
+_dnf5-group() {
+ local -a tmp
+ if (( CURRENT == 2 )); then
+ tmp=(
+ 'list:list all matching groups'
+ 'info:print detailed information about groups'
+ 'install:install packages from specified groups'
+ 'remove:remove removable packages in specified groups'
+ 'upgrade:upgrade specified groups and packages in them'
+ )
+ _describe -t subcommands 'subcommand' tmp
+ else
+ case $words[2] in
+ list|info)
+ tmp=(
+ '(--installed)--available[show only available groups]'
+ '(--available)--installed[show only installed groups]'
+ '--hidden[show also hidden groups]'
+ '--contains-pkgs=[show only groups containing specified packages]: : _sequence _dnf5_packages -T all'
+ '*: : _dnf5_groups'
+ )
+ ;;
+ install)
+ tmp=( $common_opts
+ '--with-optional[include optional packages from the groups]'
+ '*: : _dnf5_groups -T available' )
+ ;|
+ upgrade)
+ tmp=( ${common_opts:#--skip-broken*}
+ '*: : _dnf5_groups -T installed' )
+ ;|
+ remove)
+ tmp=( $offline_opts
+ '*: : _dnf5_groups -T installed' )
+ ;|
+ install|remove)
+ tmp+=( '--no-packages[operate on groups only, not manipulate any packages]' )
+ ;|
+ install|upgrade)
+ tmp+=( $downgrade_opts )
+ ;;
+ esac
+ _arguments : $tmp
+ fi
+}
+
+_dnf5-history() {
+ local -a tmp
+ if (( CURRENT == 2 )); then
+ tmp=(
+ 'list:list info about recorded transactions'
+ 'info:print detailed about specific transactions'
+ 'undo:revert all actions from the specified transaction'
+ 'redo:repeat the specified transaction'
+ 'rollback:undo all transactions performed after the specified transaction'
+ 'store:store the transaction into a directory'
+ )
+ _describe -t subcommands 'subcommand' tmp
+ else
+ case $words[2] in
+ list|info)
+ tmp=( '--reverse[reverse the order of transactions in output]' )
+ ;;
+ undo|rollback|redo)
+ tmp=( '--skip-unavailable[allow skipping impossible actions]' )
+ ;|
+ undo|rollback)
+ tmp+=( $replay_opts )
+ ;;
+ store)
+ tmp=( {-o,--output=}'[directory for storing the transaction (default ./transaction)]: : _directories')
+ esac
+ _arguments : $tmp '2:transaction:( )'
+ fi
+}
+
+_dnf5-mark() {
+ local -a tmp
+ if (( CURRENT == 2 )); then
+ tmp=(
+ 'user:mark the package as user-installed'
+ 'dependency:mark the package as a dependency'
+ 'weak:mark the package as a weak dependency'
+ 'group:mark the package as installed by the specified group'
+ )
+ _describe -t subcommands 'subcommand' tmp
+ else
+ tmp=(
+ '--skip-unavailable[skip packages not installed on the system]'
+ '--store=[store the transaction in specified directory]: : _directories'
+ )
+ if [[ $words[2] = group ]]; then
+ tmp+=( '2:group-id: _dnf5_groups -T installed' )
+ fi
+ _arguments : $tmp '*: : _dnf5_packages -T installed'
+ fi
+}
+
+_dnf5-module() {
+ local -a tmp
+ if (( CURRENT == 2 )); then
+ tmp=(
+ 'list:list module streams'
+ 'info:print details about module streams'
+ 'enable:enable module streams'
+ 'disable:disable modules including all their streams'
+ "reset:reset module state so it's no longer enabled or disabled"
+ )
+ _describe -t subcommands 'subcommand' tmp
+ elif (( CURRENT == 3 )) && [[ $cur = -* ]]; then
+ case $words[2] in
+ list|info) tmp=( --enabled --disabled ) ;;
+ enable) tmp=( --skip-broken --skip-unavailable ) ;;
+ *) tmp=( --skip-unavailable ) ;;
+ esac
+ _wanted options expl 'option' compadd -a tmp
+ else
+ _message 'module spec'
+ fi
+}
+
+_dnf5-offline() { # also used by the 'system-upgrade' command
+ local -a tmp
+ if (( CURRENT == 2 )); then
+ tmp=(
+ 'clean:remove any stored offline transactions and cached packages'
+ 'log:list boots during which offline transaction was attempted'
+ 'reboot:prepare the system for offline transaction and reboot'
+ )
+ if [[ $cmd = offline ]]; then
+ tmp+=( 'status:show status of the current offline transaction' )
+ else
+ tmp+=( 'download:download all packages needed for upgrade' )
+ fi
+ _describe -t subcommands 'subcommand' tmp && ret=0
+ else
+ case $words[2] in
+ download)
+ _arguments : \
+ '--releasever=[the version to upgrade to]:version number:' \
+ '--no-downgrade:do not install packages older than currently installed' '*: :' && ret=0
+ ;;
+ log)
+ _arguments : \
+ '--number=[show log of transaction specified by number]:transaction number:' '*: :' && ret=0
+ ;;
+ reboot)
+ _wanted options expl 'option' compadd -- --poweroff && ret=0
+ ;;
+ esac
+ fi
+}
+
+_dnf5-repoquery() {
+ local v
+ local -a opts=(
+ $advisory_opts
+ '--arch=[limit results to specified architectures]:list of archs: '
+ '--available[limit results to available packages]'
+ '--disable-modular-filtering[include packages of inactive module streams]'
+ '--duplicates[limit to installed duplicate packages]'
+ '--exactdeps[limit to packages that require capability specified by ==what{requires,depends}]'
+ '--extras[limit to installed packages that are not present in any available repository]'
+ '--file=[limit results to packages which own specified file]:list of files: _sequence _files'
+ '--installed[query installed packages]'
+ '--installonly[limit to installed installonly packages]'
+ '--latest-limit=[limit to latest packages of specified number]:number:'
+ '--leaves[limit to groups of installed packages not required by other installed packages]'
+ '--providers-of=[select packages that provide specified attribute]:attribute:(conflicts depends enhances obsoletes provides recommends requires requires_pre suggests supplement)'
+ '--recent[limit to only recently changed packages]'
+ '--recursive[make --whatrequires/--providers-of work recursively]'
+ '--security[limit to packages in security advisories]'
+ '--srpm[use the corresponding source RPM]'
+ '--unneeded[limit to unneeded installed packages]'
+ '--upgrades[limit to available packages that provide upgrade for installed packages]'
+ '--userinstalled[limit to packages that are not installed as dependencies]'
+ '--whatdepends=[limit to packages that require, enhance, recommend, suggest of supplement specified capability]:list of capability:'
+ '--whatconflicts=[limit to packages that conflicts with specified capabilities]:list of capability: '
+ )
+ for v in enhance obsolete provide recommend require suggest supplement; do
+ opts+=( "--what${v}s=[limit to packages that $v specified capabilities]:list of capability: ")
+ done
+ # mutually exclusive formatting options
+ opts+=(
+ + '(format)'
+ '--conflicts[display capabilities that the package conflicts with]'
+ '--depends[display capabilities that the package depends on, enables, recommends, suggests or supplements]'
+ '--files[show files in the package]'
+ '--requires-pre[display capabilities required to run pre/post scripts of the package]'
+ '--sourcerpm[display source RPM of the package]'
+ '--location[display location of the package]'
+ '--info[show detailed information about the package]'
+ '--changelogs[print the package changelogs]'
+ '(- *)--querytags[list tags recognized by --queryformat]'
+ '--queryformat=[specify output format]:format:'
+ )
+ for v in enhance obsolete provide recommend require suggest supplement; do
+ opts+=( "--${v}s[display capabilities ${v}ed by the package]" )
+ done
+
+ _arguments : '*: : _dnf5_packages -T all' $opts
+}
+
+# dnf commands
+
+_dnf5_commands() {
+ local -a dnf_cmds=(
+ 'advisory:manage advisories'
+ 'autoremove:remove unneeded packages'
+ 'check:check for problems in package database'
+ 'check-upgrade:check for available package upgrades'
+ 'clean:remove or invalidate cached data'
+ 'distro-sync:up/downgrade installed packages to the latest available'
+ 'downgrade:downgrade packages'
+ 'download:download packages'
+ 'environment:manage comps environments'
+ 'group:manage comps groups'
+ 'history:manage transaction history'
+ 'info:provide detailed information about packages'
+ 'install:install packages'
+ 'leaves:list groups of leaf packages'
+ 'list:list installed or available packages'
+ 'makecache:generate the metadata cache'
+ 'mark:change the reason of an installed package'
+ 'module:manage modules'
+ 'offline:manage offline transactions'
+ 'provides:find what package provides the given value'
+ 'reinstall:reinstall packages'
+ 'remove:remove packages'
+ 'replay:replay stored transactions'
+ 'repo:manage repositories'
+ 'repoquery:search for packages in repositories'
+ 'search:search for packages using keywords'
+ 'swap:remove software and install another in the single transaction'
+ 'system-upgrade:upgrade the system to a new major release'
+ 'upgrade:upgrade packages'
+ 'versionlock:protect packages from updates to newer versions'
+ )
+ _describe -t dnf-commands 'dnf command' dnf_cmds
+}
+
+# subcommands and options
+
+_dnf5_subcmds_opts() {
+ local cur=$words[CURRENT] cmd=$words[1] expl ret=1
+ local -a tmp
+ # common options
+ local -a offline_opts=(
+ '(--store)--offline[store the transaction to be performed offline]'
+ '(--offline)--store=[store the transaction in specified directory]: : _directories'
+ )
+ local -a common_opts=(
+ $offline_opts
+ '--allowerasing[allow erasing of installed packages]'
+ '--skip-broken[resolve dependency problems by skipping problematic packages]'
+ "--skip-unavailable[skip packages that can't be synchronized]"
+ '--downloadonly[download packages without executing transaction]'
+ )
+ local -a advisory_opts=(
+ '--advisories=[consider only specified advisories]:list of advisories:'
+ '--advisory-severities=[limit to advisories with specified severity]:severity:_sequence compadd - critical important moderate low none'
+ '--bzs=[limit to advisories that fix specified Bugzilla ID]:list of Bugzilla ID:'
+ '--cves=[limit to advisories that fix specified CVE ID]:list of CVD ID]:'
+ '--security[limit to security advisories]'
+ '--bugfix[limit to bugfix advisories]'
+ '--enhancement[limit to enhancement advisories]'
+ '--newpackage[limit to newpackage advisories]'
+ )
+ local -a downgrade_opts=(
+ '(--no-allow-downgrade)--allow-downgrade[enable downgrade of dependencies]'
+ '(--allow-downgrade)--no-allow-downgrade[disable downgrade of dependencies]'
+ )
+ local -a replay_opts=(
+ '--ignore-extras[not consider extra packages]'
+ '--ignore-installed[mismatches between installed and stored transaction are not errors]'
+ )
+ # Deal with some aliases (not comprehensive)
+ case $cmd in
+ check-updgrade) cmd=check-update;;
+ dg) cmd=downgrade;;
+ dsync) cmd=distro-sync;;
+ grp) cmd=group;;
+ if) cmd=info;;
+ in) cmd=install;;
+ ls) cmd=list;;
+ mc) cmd=makecache;;
+ rei) cmd=reinstall;;
+ rm) cmd=remove ;;
+ rq) cmd=repoquery;;
+ se) cmd=search;;
+ update|up) cmd=upgrade;;
+ esac
+ local curcontext="${curcontext%:*:*}:dnf-${cmd}:"
+
+ case $cmd in
+ advisory|group|history|mark|module|offline|repoquery)
+ _dnf5-$cmd && ret=0
+ ;;
+ system-upgrade)
+ _dnf5-offline && ret=0
+ ;;
+ autoremove)
+ _arguments : $offline_opts && ret=0
+ ;;
+ check)
+ _arguments : \
+ '--dependencies[show missing dependencies and conflicts]' \
+ '--duplicates[show duplicated packages]' \
+ '--obsoleted[show obsoleted packages]' && ret=0
+ ;;
+ check-upgrade)
+ _arguments : \
+ $advisory_opts \
+ '--changelogs[print package changelogs]' \
+ '--minimal[reports the lowest versions of packages that fix advisories]' \
+ '*: : _dnf5_packages -T installed' && ret=0
+ ;;
+ clean)
+ tmp=(
+ 'dbcache:remove cache files generated from the repository metadata'
+ 'expire-cache:mark the repository metadata expired'
+ 'metadata:remove the repository metadata'
+ 'packages:remove any cached packages'
+ 'all:clean all'
+ )
+ _describe -t cache-types 'cache type' tmp && ret=0
+ ;;
+ distro-sync)
+ _arguments : $common_opts '*: : _dnf5_packages -T installed' && ret=0
+ ;;
+ downgrade)
+ _arguments : \
+ $common_opts $downgrade_opts \
+ '*: : _dnf5_packages -T installed' && ret=0
+ ;;
+ download)
+ _arguments : \
+ '--arch=[limit to packages of specified architecture]:list of architectures:' \
+ '--resolve[resolve and download needed dependencies]' \
+ '--alldeps[with --resolve, also download already installed dependencies]' \
+ '--destdir=[download to the specified directory]: : _directories' \
+ '--srpm[download the source rpm]' \
+ '--url[print the list of URLs where the rpms can be downloaded]' \
+ '*--urlprotocol=[with --url, limit to specified protocols]:protocol:_sequence compadd - http https ftp file' \
+ '*: : _dnf5_packages -T all' && ret=0
+ ;;
+ environment)
+ _arguments : \
+ '--available[show only available environments]' \
+ '--installed[show only installed environments]' \
+ ':subcommand:(list info)' \
+ '*: : _dnf5_environments' && ret=0
+ ;;
+ info|list)
+ _arguments : \
+ '--showduplicates[show all versions of the packages]' \
+ '*: : _dnf5_packages -T all' \
+ + '(type)' \
+ '--installed[list only installed packages]:*: : _dnf5_packages -T installed' \
+ '--available[list only available packages]:*: : _dnf5_packages -T available' \
+ '--extras[list only extras]' \
+ '--obsoletes[list only installed but obsoleted packages]:*: : _dnf5_packages -T installed' \
+ '--recent[list only recently added packages]' \
+ '--upgrades[list only available upgrades of installed packages]:*: : _dnf5_packages -T upgradable' \
+ '--autoremove[list only packages that will be autoremoved]:*: : _dnf5_packages -T installed' &&ret=0
+ ;;
+ install)
+ _arguments : \
+ $common_opts $downgrade_opts $advisory_opts \
+ '*: : _dnf5_packages_or_rpms -T available' && ret=0
+ ;;
+ leaves|makecache)
+ # nothing to complete
+ ;;
+ provides)
+ _files && ret=0
+ ;;
+ reinstall)
+ _arguments : \
+ $common_opts $downgrade_opts \
+ '*: : _dnf5_packages_or_rpms -T installed' && ret=0
+ ;;
+ remove)
+ _arguments : \
+ $offline_opts \
+ '--no-autoremove[not remove dependencies that are no longer used]' \
+ '*: : _dnf5_packages -T installed' && ret=0
+ ;;
+ replay)
+ _arguments : \
+ $replay_opts \
+ ':transaction path:_directories' && ret=0
+ ;;
+ repo)
+ _arguments : \
+ '--all[show info about all repositories]' \
+ '--enabled[show info only about enabled repositories]' \
+ '--disabled[show info only about disabled repositories]' \
+ ':subcommand:(list info)' && ret=0
+ ;;
+ search)
+ _arguments : \
+ '--all[search patterns also inside description and URL fields]' \
+ '--showduplicates[show all versions of packages, not only the latest ones]' \
+ '*:search pattern:' && ret=0
+ ;;
+ swap)
+ _arguments : \
+ $offline_opts \
+ '--allowerasing[allow erasing of installed packages]' \
+ ': : _dnf5_packages -T installed' \
+ ': : _dnf5_packages -T available' && ret=0
+ ;;
+ upgrade)
+ _arguments : \
+ ${common_opts:#--skip-broken*} $downgrade_opts $advisory_opts \
+ '--minimal[upgrade only to the lowest available versions that fix advisories]' \
+ '--destdir=[specify directory into which downloading packages]: : _directories' \
+ '*: : _dnf5_packages_or_rpms -T upgradable' && ret=0
+ ;;
+ versionlock)
+ _arguments : \
+ ':subcommand:(add exclude clear delete list)' \
+ '*: : _dnf5_packages -T all' && ret=0
+ ;;
+ esac
+ return ret
+}
+
+# main completer
+
+_dnf5() {
+ local curcontext="$curcontext" state state_descr line ret=1
+ typeset -A opt_args
+ local -a opts=(
+ '(-y --assumeyes)--assumeno[answer no for all questions]'
+ '--best[try the best available package version]'
+ '(-C --cacheonly)'{-C,--cacheonly}"[run entirely from system cache, don't update cache]"
+ '--comment=[add comment to transaction history]:comment:'
+ '(-c --config)'{-c+,--config=}'[specify configuration file]:config file:_files'
+ '--debugsolver[dump detailed solving results in file ./debugdata]'
+ '*--disable-plugin=[disable specified plugins]:list of plugin names:'
+ '(--repo)*--disable-repo=[disable specified repos]: : _sequence _dnf5_repositories -T enabled'
+ '--dump-main-config[print main configuration values to stdout]'
+ '*--dump-repo-config=[print repository configuration values to stdout]:repi id'
+ '--dump-variables[print variable values to stdout]'
+ '*--enable-plugin=[enable specified plugins]:list of plugin names:'
+ '*--enable-repo=[enable additional repos]: : _sequence _dnf5_repositories -T disabled'
+ '--forcearch=[force the use of the specified arch]:arch:'
+ '(-)'{-h,--help}'[show the help message]'
+ '--installroot=[set install root]: : _directories'
+ '--no-best[do not limit transactions to best candidates]'
+ '--no-docs[do not install documentation]'
+ '--no-gpgcheck[skip checking GPG signatures on packages]'
+ '--no-plugins[disable all plugins]'
+ '(-q --quiet)'{-q,--quiet}'[show just the relevant content]'
+ '--refresh[force refreshing metadata before running the command]'
+ '--releasever=[override distribution release in config files]:release ver:'
+ '(--disablerepo)*--repo=[enable just the specified repo]: : _sequence _dnf5_repositories -T all'
+ '*--repofrompath=[specify additional repos]:repository_label,path_or_url: '
+ '*--setopt=[override option in config file]:repoid.option=value:'
+ '*--setvar=[override DNF5 variable value]'
+ '--show-new-leaves[show newly installed leaf packages]'
+ '--use-host-config[use config files and variables from host system]'
+ '(- *)--version[show dnf version]'
+ '(-y --assumeyes --assumeno)'{-y,--assumeyes}'[answer yes for all questions]'
+ '*'{-x+,--exclude=}'[exclude specified packages from transaction]: : _sequence _dnf5_packages -T all'
+ )
+ _arguments -C -s : $opts ': :->command' '*:: :->cmd_args' && ret=0
+
+ case $state in
+ command) _dnf5_commands && ret=0 ;;
+ cmd_args) _dnf5_subcmds_opts && ret=0 ;;
+ esac
+ return ret
+}
+
+_dnf5 "$@"
diff --git a/plugins/docker-compose/README.md b/plugins/docker-compose/README.md
index 66d4e0521..5a0290462 100644
--- a/plugins/docker-compose/README.md
+++ b/plugins/docker-compose/README.md
@@ -2,6 +2,8 @@
This plugin provides completion for [docker-compose](https://docs.docker.com/compose/) as well as some
aliases for frequent docker-compose commands.
+This plugin chooses automatically between the legacy `docker-compose` command and the modern
+`docker compose` subcommand, preferring `docker-compose` when both are available.
To use it, add docker-compose to the plugins array of your zshrc file:
diff --git a/plugins/docker-compose/_docker-compose b/plugins/docker-compose/_docker-compose
index c6b733500..d0ebfe515 100644
--- a/plugins/docker-compose/_docker-compose
+++ b/plugins/docker-compose/_docker-compose
@@ -128,7 +128,7 @@ __docker-compose_subcommand() {
'--resolve-image-digests[Pin image tags to digests.]' \
'--services[Print the service names, one per line.]' \
'--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
+ '--hash[Print the service config hash, one per line. Set "service1,service2" for a list of specified services.]' && ret=0
;;
(create)
_arguments \
diff --git a/plugins/docker-compose/docker-compose.plugin.zsh b/plugins/docker-compose/docker-compose.plugin.zsh
index d1823f535..7863c4f39 100644
--- a/plugins/docker-compose/docker-compose.plugin.zsh
+++ b/plugins/docker-compose/docker-compose.plugin.zsh
@@ -1,5 +1,8 @@
-# support Compose v2 as docker CLI plugin
-(( ${+commands[docker-compose]} )) && dccmd='docker-compose' || dccmd='docker compose'
+# Support Compose v2 as docker CLI plugin
+#
+# This tests that the (old) docker-compose command is in $PATH and that
+# it resolves to an existing executable file if it's a symlink.
+[[ -x "${commands[docker-compose]:A}" ]] && dccmd='docker-compose' || dccmd='docker compose'
alias dco="$dccmd"
alias dcb="$dccmd build"
diff --git a/plugins/docker-machine/README.md b/plugins/docker-machine/README.md
deleted file mode 100644
index 308a6cfdb..000000000
--- a/plugins/docker-machine/README.md
+++ /dev/null
@@ -1,19 +0,0 @@
-# docker-machine plugin for oh my zsh
-
-### Usage
-
-#### docker-vm
-Will create a docker-machine with the name "dev" (required only once)
-To create a second machine call "docker-vm foobar" or pass any other name
-
-#### docker-up
-This will start your "dev" docker-machine (if necessary) and set it as the active one
-To start a named machine use "docker-up foobar"
-
-#### docker-switch dev
-Use this to activate a running docker-machine (or to switch between multiple machines)
-You need to call either this or docker-up when opening a new terminal
-
-#### docker-stop
-This will stop your "dev" docker-machine
-To stop a named machine use "docker-stop foobar" \ No newline at end of file
diff --git a/plugins/docker-machine/_docker-machine b/plugins/docker-machine/_docker-machine
deleted file mode 100644
index 17bcd3598..000000000
--- a/plugins/docker-machine/_docker-machine
+++ /dev/null
@@ -1,359 +0,0 @@
-#compdef docker-machine
-# Description
-# -----------
-# zsh completion for docker-machine
-# https://github.com/leonhartX/docker-machine-zsh-completion
-# -------------------------------------------------------------------------
-# Version
-# -------
-# 0.1.1
-# -------------------------------------------------------------------------
-# Authors
-# -------
-# * Ke Xu <leonhartx.k@gmail.com>
-# -------------------------------------------------------------------------
-# Inspiration
-# -----------
-# * @sdurrheimer docker-compose-zsh-completion https://github.com/sdurrheimer/docker-compose-zsh-completion
-# * @ilkka _docker-machine
-
-
-__docker-machine_get_hosts() {
- [[ $PREFIX = -* ]] && return 1
- local state
- declare -a hosts
- state=$1; shift
- if [[ $state != all ]]; then
- hosts=(${(f)"$(_call_program commands docker-machine ls -q --filter state=$state)"})
- else
- hosts=(${(f)"$(_call_program commands docker-machine ls -q)"})
- fi
- _describe 'host' hosts "$@" && ret=0
- return ret
-}
-
-__docker-machine_hosts_with_state() {
- declare -a hosts
- hosts=(${(f)"$(_call_program commands docker-machine ls -f '{{.Name}}\:{{.DriverName}}\({{.State}}\)\ {{.URL}}')"})
- _describe 'host' hosts
-}
-
-__docker-machine_hosts_all() {
- __docker-machine_get_hosts all "$@"
-}
-
-__docker-machine_hosts_running() {
- __docker-machine_get_hosts Running "$@"
-}
-
-__docker-machine_get_swarm() {
- declare -a swarms
- swarms=(${(f)"$(_call_program commands docker-machine ls -f {{.Swarm}} | awk '{print $1}')"})
- _describe 'swarm' swarms
-}
-
-__docker-machine_hosts_and_files() {
- _alternative "hosts:host:__docker-machine_hosts_all -qS ':'" 'files:files:_path_files'
-}
-
-__docker-machine_filters() {
- [[ $PREFIX = -* ]] && return 1
- integer ret=1
-
- if compset -P '*='; then
- case "${${words[-1]%=*}#*=}" in
- (driver)
- _describe -t driver-filter-opts "driver filter" opts_driver && ret=0
- ;;
- (swarm)
- __docker-machine_get_swarm && ret=0
- ;;
- (state)
- opts_state=('Running' 'Paused' 'Saved' 'Stopped' 'Stopping' 'Starting' 'Error')
- _describe -t state-filter-opts "state filter" opts_state && ret=0
- ;;
- (name)
- __docker-machine_hosts_all && ret=0
- ;;
- (label)
- _message 'label' && ret=0
- ;;
- *)
- _message 'value' && ret=0
- ;;
- esac
- else
- opts=('driver' 'swarm' 'state' 'name' 'label')
- _describe -t filter-opts "filter" opts -qS "=" && ret=0
- fi
- return ret
-}
-
-__get_swarm_discovery() {
- declare -a masters services
- local service
- services=()
- masters=($(docker-machine ls -f {{.Swarm}} |grep '(master)' |awk '{print $1}'))
- for master in $masters; do
- service=${${${(f)"$(_call_program commands docker-machine inspect -f '{{.HostOptions.SwarmOptions.Discovery}}:{{.Name}}' $master)"}/:/\\:}}
- services=($services $service)
- done
- _describe -t services "swarm service" services && ret=0
- return ret
-}
-
-__get_create_argument() {
- typeset -g docker_machine_driver
- if [[ CURRENT -le 2 ]]; then
- docker_machine_driver="none"
- elif [[ CURRENT > 2 && $words[CURRENT-2] = '-d' || $words[CURRENT-2] = '--driver' ]]; then
- docker_machine_driver=$words[CURRENT-1]
- elif [[ $words[CURRENT-1] =~ '^(-d|--driver)=' ]]; then
- docker_machine_driver=${${words[CURRENT-1]}/*=/}
- fi
- local driver_opt_cmd
- local -a opts_provider opts_common opts_read_argument
- opts_read_argument=(
- ": :->argument"
- )
- opts_common=(
- $opts_help \
- '(--driver -d)'{--driver=,-d=}'[Driver to create machine with]:dirver:->driver-option' \
- '--engine-install-url=[Custom URL to use for engine installation]:url' \
- '*--engine-opt=[Specify arbitrary flags to include with the created engine in the form flag=value]:flag' \
- '*--engine-insecure-registry=[Specify insecure registries to allow with the created engine]:registry' \
- '*--engine-registry-mirror=[Specify registry mirrors to use]:mirror' \
- '*--engine-label=[Specify labels for the created engine]:label' \
- '--engine-storage-driver=[Specify a storage driver to use with the engine]:storage-driver:->storage-driver-option' \
- '*--engine-env=[Specify environment variables to set in the engine]:environment' \
- '--swarm[Configure Machine with Swarm]' \
- '--swarm-image=[Specify Docker image to use for Swarm]:image' \
- '--swarm-master[Configure Machine to be a Swarm master]' \
- '--swarm-discovery=[Discovery service to use with Swarm]:service:->swarm-service' \
- '--swarm-strategy=[Define a default scheduling strategy for Swarm]:strategy:(spread binpack random)' \
- '*--swarm-opt=[Define arbitrary flags for swarm]:flag' \
- '*--swarm-join-opt=[Define arbitrary flags for Swarm join]:flag' \
- '--swarm-host=[ip/socket to listen on for Swarm master]:host' \
- '--swarm-addr=[addr to advertise for Swarm (default: detect and use the machine IP)]:address' \
- '--swarm-experimental[Enable Swarm experimental features]' \
- '*--tls-san=[Support extra SANs for TLS certs]:option'
- )
- driver_opt_cmd="docker-machine create -d $docker_machine_driver | grep $docker_machine_driver | sed -e 's/\(--.*\)\ *\[\1[^]]*\]/*\1/g' -e 's/\(\[[^]]*\)/\\\\\\1\\\\/g' -e 's/\".*\"\(.*\)/\1/g' | awk '{printf \"%s[\", \$1; for(i=2;i<=NF;i++) {printf \"%s \", \$i}; print \"]\"}'"
- if [[ $docker_machine_driver != "none" ]]; then
- opts_provider=(${(f)"$(_call_program commands $driver_opt_cmd)"})
- _arguments \
- $opts_provider \
- $opts_read_argument \
- $opts_common && ret=0
- else
- _arguments $opts_common && ret=0
- fi
- case $state in
- (driver-option)
- _describe -t driver-option "driver" opts_driver && ret=0
- ;;
- (storage-driver-option)
- _describe -t storage-driver-option "storage driver" opts_storage_driver && ret=0
- ;;
- (swarm-service)
- __get_swarm_discovery && ret=0
- ;;
- (argument)
- ret=0
- ;;
- esac
- return ret
-}
-
-
-__docker-machine_subcommand() {
- local -a opts_help
- opts_help=("(- :)--help[Print usage]")
- local -a opts_only_host opts_driver opts_storage_driver opts_state
- opts_only_host=(
- "$opts_help"
- "*:host:__docker-machine_hosts_all"
- )
- opts_driver=('amazonec2' 'azure' 'digitalocean' 'exoscale' 'generic' 'google' 'hyperv' 'none' 'openstack' 'rackspace' 'softlayer' 'virtualbox' 'vmwarefusion' 'vmwarevcloudair' 'vmwarevsphere')
- opts_storage_driver=('overlay' 'aufs' 'btrfs' 'devicemapper' 'vfs' 'zfs')
- integer ret=1
-
- case "$words[1]" in
- (active)
- _arguments \
- $opts_help \
- '(--timeout -t)'{--timeout=,-t=}'[Timeout in seconds, default to 10s]:seconds' && ret=0
- ;;
- (config)
- _arguments \
- $opts_help \
- '--swarm[Display the Swarm config instead of the Docker daemon]' \
- "*:host:__docker-machine_hosts_all" && ret=0
- ;;
- (create)
- __get_create_argument
- ;;
- (env)
- _arguments \
- $opts_help \
- '--swarm[Display the Swarm config instead of the Docker daemon]' \
- '--shell=[Force environment to be configured for a specified shell: \[fish, cmd, powershell\], default is auto-detect]:shell' \
- '(--unset -u)'{--unset,-u}'[Unset variables instead of setting them]' \
- '--no-proxy[Add machine IP to NO_PROXY environment variable]' \
- '*:host:__docker-machine_hosts_running' && ret=0
- ;;
- (help)
- _arguments ':subcommand:__docker-machine_commands' && ret=0
- ;;
- (inspect)
- _arguments \
- $opts_help \
- '(--format -f)'{--format=,-f=}'[Format the output using the given go template]:template' \
- '*:host:__docker-machine_hosts_all' && ret=0
- ;;
- (ip)
- _arguments \
- $opts_help \
- '*:host:__docker-machine_hosts_running' && ret=0
- ;;
- (kill)
- _arguments \
- $opts_help \
- '*:host:__docker-machine_hosts_with_state' && ret=0
- ;;
- (ls)
- _arguments \
- $opts_help \
- '(--quiet -q)'{--quiet,-q}'[Enable quiet mode]' \
- '*--filter=[Filter output based on conditions provided]:filter:->filter-options' \
- '(--timeout -t)'{--timeout=,-t=}'[Timeout in seconds, default to 10s]:seconds' \
- '(--format -f)'{--format=,-f=}'[Pretty-print machines using a Go template]:template' && ret=0
- case $state in
- (filter-options)
- __docker-machine_filters && ret=0
- ;;
- esac
- ;;
- (provision)
- _arguments $opts_only_host && ret=0
- ;;
- (regenerate-certs)
- _arguments \
- $opts_help \
- '(--force -f)'{--force,-f}'[Force rebuild and do not prompt]' \
- '*:host:__docker-machine_hosts_all' && ret=0
- ;;
- (restart)
- _arguments \
- $opts_help \
- '*:host:__docker-machine_hosts_with_state' && ret=0
- ;;
- (rm)
- _arguments \
- $opts_help \
- '(--force -f)'{--force,-f}'[Remove local configuration even if machine cannot be removed, also implies an automatic yes (`-y`)]' \
- '-y[Assumes automatic yes to proceed with remove, without prompting further user confirmation]' \
- '*:host:__docker-machine_hosts_with_state' && ret=0
- ;;
- (scp)
- _arguments \
- $opts_help \
- '(--recursive -r)'{--recursive,-r}'[Copy files recursively (required to copy directories))]' \
- '*:files:__docker-machine_hosts_and_files' && ret=0
- ;;
- (ssh)
- _arguments \
- $opts_help \
- '*:host:__docker-machine_hosts_running' && ret=0
- ;;
- (start)
- _arguments \
- $opts_help \
- '*:host:__docker-machine_hosts_with_state' && ret=0
- ;;
- (status)
- _arguments $opts_only_host && ret=0
- ;;
- (stop)
- _arguments \
- $opts_help \
- '*:host:__docker-machine_hosts_with_state' && ret=0
- ;;
- (upgrade)
- _arguments $opts_only_host && ret=0
- ;;
- (url)
- _arguments \
- $opts_help \
- '*:host:__docker-machine_hosts_running' && ret=0
- ;;
- esac
-
- return ret
-}
-
-
-__docker-machine_commands() {
- local cache_policy
-
- zstyle -s ":completion:${curcontext}:" cache-policy cache_policy
- if [[ -z "$cache_policy" ]]; then
- zstyle ":completion:${curcontext}:" cache-policy __docker-machine_caching_policy
- fi
-
- if ( [[ ${+_docker_machine_subcommands} -eq 0 ]] || _cache_invalid docker_machine_subcommands) \
- && ! _retrieve_cache docker_machine_subcommands;
- then
- local -a lines
- lines=(${(f)"$(_call_program commands docker-machine 2>&1)"})
- _docker_machine_subcommands=(${${${lines[$((${lines[(i)Commands:]} + 1)),${lines[(I) *]}]}## #}/$'\t'##/:})
- (( $#_docker_machine_subcommands > 0 )) && _store_cache docker_machine_subcommands _docker_machine_subcommands
- fi
- _describe -t docker-machine-commands "docker-machine command" _docker_machine_subcommands
-}
-
-__docker-machine_caching_policy() {
- oldp=( "$1"(Nmh+1) )
- (( $#oldp ))
-}
-
-_docker-machine() {
- if [[ $service != docker-machine ]]; then
- _call_function - _$service
- return
- fi
-
- local curcontext="$curcontext" state line
- integer ret=1
- typeset -A opt_args
-
- _arguments -C \
- "(- :)"{-h,--help}"[Show help]" \
- "(-D --debug)"{-D,--debug}"[Enable debug mode]" \
- '(-s --storage-path)'{-s,--storage-path}'[Configures storage path]:file:_files' \
- '--tls-ca-cert[CA to verify remotes against]:file:_files' \
- '--tls-ca-key[Private key to generate certificates]:file:_files' \
- '--tls-client-cert[Client cert to use for TLS]:file:_files' \
- '--tls-client-key[Private key used in client TLS auth]:file:_files' \
- '--github-api-token[Token to use for requests to the GitHub API]' \
- '--native-ssh[Use the native (Go-based) SSH implementation.]' \
- '--bugsnag-api-token[Bugsnag API token for crash reporting]' \
- '(- :)'{-v,--version}'[Print the version]' \
- "(-): :->command" \
- "(-)*:: :->option-or-argument" && ret=0
-
- case $state in
- (command)
- __docker-machine_commands && ret=0
- ;;
- (option-or-argument)
- curcontext=${curcontext%:*:*}:docker-machine-$words[1]:
- __docker-machine_subcommand && ret=0
- ret=0
- ;;
- esac
-
- return ret
-}
-
-_docker-machine "$@"
diff --git a/plugins/docker-machine/docker-machine.plugin.zsh b/plugins/docker-machine/docker-machine.plugin.zsh
deleted file mode 100644
index 235d90ee8..000000000
--- a/plugins/docker-machine/docker-machine.plugin.zsh
+++ /dev/null
@@ -1,33 +0,0 @@
-DEFAULT_MACHINE="default"
-
-docker-up() {
- if [ -z "$1" ]
- then
- docker-machine start "${DEFAULT_MACHINE}"
- eval $(docker-machine env "${DEFAULT_MACHINE}")
- else
- docker-machine start $1
- eval $(docker-machine env $1)
- fi
- echo $DOCKER_HOST
-}
-docker-stop() {
- if [ -z "$1" ]
- then
- docker-machine stop "${DEFAULT_MACHINE}"
- else
- docker-machine stop $1
- fi
-}
-docker-switch() {
- eval $(docker-machine env $1)
- echo $DOCKER_HOST
-}
-docker-vm() {
- if [ -z "$1" ]
- then
- docker-machine create -d virtualbox --virtualbox-disk-size 20000 --virtualbox-memory 4096 --virtualbox-cpu-count 2 "${DEFAULT_MACHINE}"
- else
- docker-machine create -d virtualbox --virtualbox-disk-size 20000 --virtualbox-memory 4096 --virtualbox-cpu-count 2 $1
- fi
-} \ No newline at end of file
diff --git a/plugins/docker/README.md b/plugins/docker/README.md
index 0ab2e41fb..0bc24b54a 100644
--- a/plugins/docker/README.md
+++ b/plugins/docker/README.md
@@ -39,6 +39,10 @@ following setting. See https://github.com/ohmyzsh/ohmyzsh/issues/11789 for more
zstyle ':omz:plugins:docker' legacy-completion yes
```
+### For Podman's Docker wrapper users
+
+If you use Podman's Docker wrapper, you need to enable legacy completion. See above section.
+
## Aliases
| Alias | Command | Description |
@@ -51,6 +55,7 @@ zstyle ':omz:plugins:docker' legacy-completion yes
| dii | `docker image inspect` | Display detailed information on one or more images |
| dils | `docker image ls` | List docker images |
| dipu | `docker image push` | Push an image or repository to a remote registry |
+| dipru | `docker image prune -a` | Remove all images not referenced by any container |
| dirm | `docker image rm` | Remove one or more images |
| dit | `docker image tag` | Add a name and tag to a particular image |
| dlo | `docker container logs` | Fetch the logs of a docker container |
@@ -61,6 +66,8 @@ zstyle ':omz:plugins:docker' legacy-completion yes
| dnls | `docker network ls` | List all networks the engine daemon knows about, including those spanning multiple hosts |
| dnrm | `docker network rm` | Remove one or more networks |
| dpo | `docker container port` | List port mappings or a specific mapping for the container |
+| dps | `docker ps` | List all the running docker containers |
+| dpsa | `docker ps -a` | List all running and stopped containers |
| dpu | `docker pull` | Pull an image or a repository from a registry |
| dr | `docker container run` | Create a new container and start it using the specified command |
| drit | `docker container run -it` | Create a new container and start it in an interactive shell |
@@ -70,6 +77,7 @@ zstyle ':omz:plugins:docker' legacy-completion yes
| drs | `docker container restart` | Restart one or more containers |
| dsta | `docker stop $(docker ps -q)` | Stop all running containers |
| dstp | `docker container stop` | Stop one or more running containers |
+| dsts | `docker stats` | Display real-time streaming statistics for containers |
| dtop | `docker top` | Display the running processes of a container |
| dvi | `docker volume inspect` | Display detailed information about one or more volumes |
| dvls | `docker volume ls` | List all the volumes known to docker |
diff --git a/plugins/docker/docker.plugin.zsh b/plugins/docker/docker.plugin.zsh
index 7e657f2df..5268f6cd6 100644
--- a/plugins/docker/docker.plugin.zsh
+++ b/plugins/docker/docker.plugin.zsh
@@ -6,6 +6,7 @@ alias dib='docker image build'
alias dii='docker image inspect'
alias dils='docker image ls'
alias dipu='docker image push'
+alias dipru='docker image prune -a'
alias dirm='docker image rm'
alias dit='docker image tag'
alias dlo='docker container logs'
@@ -16,6 +17,8 @@ alias dni='docker network inspect'
alias dnls='docker network ls'
alias dnrm='docker network rm'
alias dpo='docker container port'
+alias dps='docker ps'
+alias dpsa='docker ps -a'
alias dpu='docker pull'
alias dr='docker container run'
alias drit='docker container run -it'
@@ -25,6 +28,7 @@ alias dst='docker container start'
alias drs='docker container restart'
alias dsta='docker stop $(docker ps -q)'
alias dstp='docker container stop'
+alias dsts='docker stats'
alias dtop='docker top'
alias dvi='docker volume inspect'
alias dvls='docker volume ls'
@@ -36,7 +40,7 @@ if (( ! $+commands[docker] )); then
return
fi
-# Standarized $0 handling
+# Standardized $0 handling
# https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html
0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
0="${${(M)0:#/*}:-$PWD/$0}"
@@ -57,6 +61,6 @@ fi
! is-at-least 23.0.0 ${${(s:,:z)"$(command docker --version)"}[3]}; then
command cp "${0:h}/completions/_docker" "$ZSH_CACHE_DIR/completions/_docker"
else
- command docker completion zsh >| "$ZSH_CACHE_DIR/completions/_docker"
+ command docker completion zsh | tee "$ZSH_CACHE_DIR/completions/_docker" > /dev/null
fi
} &|
diff --git a/plugins/dotnet/README.md b/plugins/dotnet/README.md
index a15e80577..2b06d8810 100644
--- a/plugins/dotnet/README.md
+++ b/plugins/dotnet/README.md
@@ -1,6 +1,6 @@
-# .NET Core CLI plugin
+# .NET CLI plugin
-This plugin provides completion and useful aliases for [.NET Core CLI](https://dotnet.microsoft.com/).
+This plugin provides completion and useful aliases for [.NET CLI](https://dotnet.microsoft.com/).
To use it, add `dotnet` to the plugins array in your zshrc file.
@@ -23,3 +23,4 @@ plugins=(... dotnet)
| dp | dotnet pack | Create a NuGet package. |
| dng | dotnet nuget | Provides additional NuGet commands. |
| db | dotnet build | Build a .NET project |
+| dres | dotnet restore | Restore dependencies and project-specific tools for a project. |
diff --git a/plugins/dotnet/dotnet.plugin.zsh b/plugins/dotnet/dotnet.plugin.zsh
index 40ee7efae..2b7782474 100644
--- a/plugins/dotnet/dotnet.plugin.zsh
+++ b/plugins/dotnet/dotnet.plugin.zsh
@@ -10,8 +10,8 @@ _dotnet_completion() {
compdef _dotnet_completion dotnet
-# Aliases bellow are here for backwards compatibility
-# added by Shaun Tabone (https://github.com/xontab)
+# Aliases below are here for backwards compatibility
+# added by Shaun Tabone (https://github.com/xontab)
alias dn='dotnet new'
alias dr='dotnet run'
@@ -24,3 +24,4 @@ alias da='dotnet add'
alias dp='dotnet pack'
alias dng='dotnet nuget'
alias db='dotnet build'
+alias dres='dotnet restore'
diff --git a/plugins/emacs/README.md b/plugins/emacs/README.md
index 8ed4a1473..47c7644ab 100644
--- a/plugins/emacs/README.md
+++ b/plugins/emacs/README.md
@@ -27,4 +27,4 @@ The plugin uses a custom launcher (which we'll call here `$EMACS_LAUNCHER`) that
| eeval | `$EMACS_LAUNCHER --eval` | Same as `M-x eval` but from outside Emacs |
| eframe | `emacsclient --alternate-editor="" --create-frame` | Create new X frame |
| efile | - | Print the path to the file open in the current buffer |
-| ecd | - | Print the directory of the file open in the the current buffer |
+| ecd | - | Print the directory of the file open in the current buffer |
diff --git a/plugins/emacs/emacs.plugin.zsh b/plugins/emacs/emacs.plugin.zsh
index 4747f035b..3ed6cee19 100644
--- a/plugins/emacs/emacs.plugin.zsh
+++ b/plugins/emacs/emacs.plugin.zsh
@@ -35,7 +35,7 @@ alias eeval="$EMACS_PLUGIN_LAUNCHER --eval"
alias eframe='emacsclient --alternate-editor="" --create-frame'
# Emacs ANSI Term tracking
-if [[ -n "$INSIDE_EMACS" ]]; then
+if [[ -n "$INSIDE_EMACS" ]] && [[ "$INSIDE_EMACS" != "vterm" ]]; then
chpwd_emacs() { print -P "\033AnSiTc %d"; }
print -P "\033AnSiTc %d" # Track current working directory
print -P "\033AnSiTu %n" # Track username
@@ -60,7 +60,7 @@ function efile {
}
# Write to standard output the directory of the file
-# opened in the the current buffer
+# opened in the current buffer
function ecd {
local file
file="$(efile)" || return $?
diff --git a/plugins/ember-cli/README.md b/plugins/ember-cli/README.md
index 419704ade..1532eea9c 100644
--- a/plugins/ember-cli/README.md
+++ b/plugins/ember-cli/README.md
@@ -29,5 +29,5 @@ plugins=(... ember-cli)
- [BilalBudhani](https://github.com/BilalBudhani)
- [eubenesa](https://github.com/eubenesa)
-- [scottkidder](https://github.com/scottkidder]
+- [scottkidder](https://github.com/scottkidder)
- [t-sauer](https://www.github.com/t-sauer)
diff --git a/plugins/emoji/emoji.plugin.zsh b/plugins/emoji/emoji.plugin.zsh
index f9e476ebf..f7be56cf7 100644
--- a/plugins/emoji/emoji.plugin.zsh
+++ b/plugins/emoji/emoji.plugin.zsh
@@ -24,7 +24,7 @@ unset _omz_emoji_plugin_dir
# This is a combining character that can be placed after any other character to surround
# it in a "keycap" symbol.
-# The digits 0-9 are already in the emoji table as keycap_digit_<N>, keycap_ten, etc.
+# The digits 0-9 are already in the emoji table as keycap_digit_<N>, keycap_ten, etc.
# It's unclear whether this should be in the $emoji array, because those characters are all ones
# which can be displayed on their own.
@@ -63,9 +63,9 @@ function random_emoji() {
[[ $list_size -eq 0 ]] && return 1
local random_index=$(( ( RANDOM % $list_size ) + 1 ))
local name=${names[$random_index]}
- if [[ "$group" == "flags" ]]; then
+ if [[ "$group" == "flags" ]]; then
echo ${emoji_flags[$name]}
- else
+ else
echo ${emoji[$name]}
fi
}
@@ -86,22 +86,22 @@ function display_emoji() {
# terminals treat these emoji chars as single-width.
local counter=1
for i in $names; do
- if [[ "$group" == "flags" ]]; then
+ if [[ "$group" == "flags" ]]; then
printf '%s ' "$emoji_flags[$i]"
- else
- printf '%s ' "$emoji[$i]"
+ else
+ printf '%s ' "$emoji[$i]"
fi
# New line every 20 emoji, to avoid weirdnesses
if (($counter % 20 == 0)); then
- printf "\n"
+ printf "\n"
fi
let counter=$counter+1
done
print
for i in $names; do
- if [[ "$group" == "flags" ]]; then
+ if [[ "$group" == "flags" ]]; then
echo "${emoji_flags[$i]} = $i"
- else
+ else
echo "${emoji[$i]} = $i"
fi
done
diff --git a/plugins/emoji/update_emoji.py b/plugins/emoji/update_emoji.py
index 18b3c060d..9e115a7fa 100644
--- a/plugins/emoji/update_emoji.py
+++ b/plugins/emoji/update_emoji.py
@@ -1,6 +1,6 @@
"""
Update Emoji.py
-Refeshes OMZ emoji database based on the latest Unicode spec
+Refreshes OMZ emoji database based on the latest Unicode spec
"""
import re
import json
@@ -95,7 +95,7 @@ def name_to_omz(_name, _group, _subgroup, _status):
shortname = snake_case(_name)
# Special treatment by status
# Enables us to have every emoji combination,
- # even the one that are not officially sanctionned
+ # even the one that are not officially sanctioned
# and are implemented by, say, only one vendor
if _status == "unqualified":
shortname += "_unqualified"
diff --git a/plugins/emotty/emotty.plugin.zsh b/plugins/emotty/emotty.plugin.zsh
index 661169a8b..b48d121dc 100644
--- a/plugins/emotty/emotty.plugin.zsh
+++ b/plugins/emotty/emotty.plugin.zsh
@@ -4,7 +4,7 @@
# AUTHOR: Alexis Hildebrandt (afh[at]surryhill.net)
# VERSION: 1.0.0
# DEPENDS: emoji plugin
-#
+#
# There are different sets of emoji characters available, to choose a different
# set export emotty_set to the name of the set you would like to use, e.g.:
# % export emotty_set=nature
diff --git a/plugins/encode64/README.md b/plugins/encode64/README.md
index 7cdf8c3f3..e3e25a742 100644
--- a/plugins/encode64/README.md
+++ b/plugins/encode64/README.md
@@ -40,7 +40,7 @@ plugins=(... encode64)
### Encoding a file
-Encode a file's contents to base64 and save output to text file.
+Encode a file's contents to base64 and save output to text file.
**NOTE:** Takes provided file and saves encoded content as new file with `.txt` extension
- From parameter
diff --git a/plugins/encode64/encode64.plugin.zsh b/plugins/encode64/encode64.plugin.zsh
index 6927f5216..8e6fdb169 100644
--- a/plugins/encode64/encode64.plugin.zsh
+++ b/plugins/encode64/encode64.plugin.zsh
@@ -10,7 +10,7 @@ encodefile64() {
if [[ $# -eq 0 ]]; then
echo "You must provide a filename"
else
- base64 -i $1 -o $1.txt
+ base64 $1 > $1.txt
echo "${1}'s content encoded in base64 and saved as ${1}.txt"
fi
}
diff --git a/plugins/extract/README.md b/plugins/extract/README.md
index c8d98b229..7bedfb1c6 100644
--- a/plugins/extract/README.md
+++ b/plugins/extract/README.md
@@ -14,52 +14,56 @@ plugins=(... extract)
## Supported file extensions
-| Extension | Description |
-| :---------------- | :----------------------------------- |
-| `7z` | 7zip file |
-| `Z` | Z archive (LZW) |
-| `apk` | Android app file |
-| `aar` | Android library file |
-| `bz2` | Bzip2 file |
-| `cab` | Microsoft cabinet archive |
-| `cpio` | Cpio archive |
-| `deb` | Debian package |
-| `ear` | Enterprise Application aRchive |
-| `exe` | Windows executable file |
-| `gz` | Gzip file |
-| `ipa` | iOS app package |
-| `ipsw` | iOS firmware file |
-| `jar` | Java Archive |
-| `lrz` | LRZ archive |
-| `lz4` | LZ4 archive |
-| `lzma` | LZMA archive |
-| `obscpio` | cpio archive used on OBS |
-| `rar` | WinRAR archive |
-| `rpm` | RPM package |
-| `sublime-package` | Sublime Text package |
-| `tar` | Tarball |
-| `tar.bz2` | Tarball with bzip2 compression |
-| `tar.gz` | Tarball with gzip compression |
-| `tar.lrz` | Tarball with lrzip compression |
-| `tar.lz` | Tarball with lzip compression |
-| `tar.lz4` | Tarball with lz4 compression |
-| `tar.xz` | Tarball with lzma2 compression |
-| `tar.zma` | Tarball with lzma compression |
-| `tar.zst` | Tarball with zstd compression |
-| `tbz` | Tarball with bzip compression |
-| `tbz2` | Tarball with bzip2 compression |
-| `tgz` | Tarball with gzip compression |
-| `tlz` | Tarball with lzma compression |
-| `txz` | Tarball with lzma2 compression |
-| `tzst` | Tarball with zstd compression |
-| `war` | Web Application archive (Java-based) |
-| `whl` | Python wheel file |
-| `xpi` | Mozilla XPI module file |
-| `xz` | LZMA2 archive |
-| `zip` | Zip archive |
-| `zlib` | zlib archive |
-| `zst` | Zstandard file (zstd) |
-| `zpaq` | Zpaq file |
+| Extension | Description |
+| :---------------- | :-------------------------------------- |
+| `7z` | 7zip file |
+| `apk` | Android app file |
+| `aar` | Android library file |
+| `bz2` | Bzip2 file |
+| `cab` | Microsoft cabinet archive |
+| `cpio` | Cpio archive |
+| `deb` | Debian package |
+| `ear` | Enterprise Application aRchive |
+| `exe` | Windows executable file |
+| `gz` | Gzip file |
+| `ipa` | iOS app package |
+| `ipsw` | iOS firmware file |
+| `jar` | Java Archive |
+| `lrz` | LRZ archive |
+| `lz4` | LZ4 archive |
+| `lzma` | LZMA archive |
+| `obscpio` | cpio archive used on OBS |
+| `pk3` | Renamed Zip archive used by Quake games |
+| `pk4` | Renamed Zip archive used by Quake games |
+| `pk7` | Renamed 7zip file used by Quake games |
+| `rar` | WinRAR archive |
+| `rpm` | RPM package |
+| `sublime-package` | Sublime Text package |
+| `tar` | Tarball |
+| `tar.bz2` | Tarball with bzip2 compression |
+| `tar.gz` | Tarball with gzip compression |
+| `tar.lrz` | Tarball with lrzip compression |
+| `tar.lz` | Tarball with lzip compression |
+| `tar.lz4` | Tarball with lz4 compression |
+| `tar.xz` | Tarball with lzma2 compression |
+| `tar.zma` | Tarball with lzma compression |
+| `tar.zst` | Tarball with zstd compression |
+| `tbz` | Tarball with bzip compression |
+| `tbz2` | Tarball with bzip2 compression |
+| `tgz` | Tarball with gzip compression |
+| `tlz` | Tarball with lzma compression |
+| `txz` | Tarball with lzma2 compression |
+| `tzst` | Tarball with zstd compression |
+| `vsix` | VS Code extension zip file |
+| `war` | Web Application archive (Java-based) |
+| `whl` | Python wheel file |
+| `xpi` | Mozilla XPI module file |
+| `xz` | LZMA2 archive |
+| `Z` | Z archive (LZW) |
+| `zip` | Zip archive |
+| `zlib` | zlib archive |
+| `zst` | Zstandard file (zstd) |
+| `zpaq` | Zpaq file |
See [list of archive formats](https://en.wikipedia.org/wiki/List_of_archive_formats) for more information
regarding archive formats.
diff --git a/plugins/extract/_extract b/plugins/extract/_extract
index 56b17058f..6641443d3 100644
--- a/plugins/extract/_extract
+++ b/plugins/extract/_extract
@@ -1,7 +1,57 @@
#compdef extract
#autoload
+local -a exts=(
+ 7z
+ aar
+ apk
+ bz2
+ cab
+ cpio
+ crx
+ deb
+ ear
+ gz
+ ipa
+ ipsw
+ jar
+ lrz
+ lz4
+ lzma
+ obscpio
+ pk3
+ pk4
+ pk7
+ rar
+ rpm
+ sublime-package
+ tar
+ tar.bz2
+ tar.gz
+ tar.lrz
+ tar.lz
+ tar.lz4
+ tar.xz
+ tar.zma
+ tar.zst
+ tbz
+ tbz2
+ tgz
+ tlz
+ txz
+ tzst
+ vsix
+ war
+ whl
+ xpi
+ xz
+ Z
+ zip
+ zpaq
+ zst
+)
+
_arguments \
'(-r --remove)'{-r,--remove}'[Remove archive.]' \
- "*::archive file:_files -g '(#i)*.(7z|Z|apk|aar|bz2|cab|cpio|deb|ear|gz|ipa|ipsw|jar|lrz|lz4|lzma|obscpio|rar|rpm|sublime-package|tar|tar.bz2|tar.gz|tar.lrz|tar.lz|tar.lz4|tar.xz|tar.zma|tar.zst|tbz|tbz2|tgz|tlz|txz|tzst|war|whl|xpi|xz|zip|zst|zpaq)(-.)'" \
+ "*::archive file:_files -g '(#i)*.(${(j:|:)exts})(-.)'" \
&& return 0
diff --git a/plugins/extract/extract.plugin.zsh b/plugins/extract/extract.plugin.zsh
index 88d8b0740..aed77e7d7 100644
--- a/plugins/extract/extract.plugin.zsh
+++ b/plugins/extract/extract.plugin.zsh
@@ -70,24 +70,32 @@ EOF
(*.tar.lz4) lz4 -c -d "$full_path" | tar xvf - ;;
(*.tar.lrz) (( $+commands[lrzuntar] )) && lrzuntar "$full_path" ;;
(*.gz) (( $+commands[pigz] )) && pigz -cdk "$full_path" > "${file:t:r}" || gunzip -ck "$full_path" > "${file:t:r}" ;;
- (*.bz2) bunzip2 "$full_path" ;;
+ (*.bz2) (( $+commands[pbzip2] )) && pbzip2 -d "$full_path" || bunzip2 "$full_path" ;;
(*.xz) unxz "$full_path" ;;
(*.lrz) (( $+commands[lrunzip] )) && lrunzip "$full_path" ;;
(*.lz4) lz4 -d "$full_path" ;;
(*.lzma) unlzma "$full_path" ;;
(*.z) uncompress "$full_path" ;;
- (*.zip|*.war|*.jar|*.ear|*.sublime-package|*.ipa|*.ipsw|*.xpi|*.apk|*.aar|*.whl) unzip "$full_path" ;;
- (*.rar) unrar x -ad "$full_path" ;;
+ (*.zip|*.war|*.jar|*.ear|*.sublime-package|*.ipa|*.ipsw|*.xpi|*.apk|*.aar|*.whl|*.vsix|*.crx|*.pk3|*.pk4) unzip "$full_path" ;;
+ (*.rar)
+ if (( $+commands[unrar] )); then
+ unrar x -ad "$full_path"
+ elif (( $+commands[unar] )); then
+ unar -o . "$full_path"
+ else
+ echo "extract: cannot extract RAR files: install unrar or unar" >&2
+ success=1
+ fi ;;
(*.rpm)
rpm2cpio "$full_path" | cpio --quiet -id ;;
- (*.7z) 7za x "$full_path" ;;
+ (*.7z | *.7z.[0-9]* | *.pk7) 7za x "$full_path" ;;
(*.deb)
command mkdir -p "control" "data"
ar vx "$full_path" > /dev/null
builtin cd -q control; extract ../control.tar.*
builtin cd -q ../data; extract ../data.tar.*
builtin cd -q ..; command rm *.tar.* debian-binary ;;
- (*.zst) unzstd "$full_path" ;;
+ (*.zst) unzstd --stdout "$full_path" > "${file:t:r}" ;;
(*.cab|*.exe) cabextract "$full_path" ;;
(*.cpio|*.obscpio) cpio -idmvF "$full_path" ;;
(*.zpaq) zpaq x "$full_path" ;;
diff --git a/plugins/eza/README.md b/plugins/eza/README.md
new file mode 100644
index 000000000..bec1f85cb
--- /dev/null
+++ b/plugins/eza/README.md
@@ -0,0 +1,144 @@
+# eza plugin
+
+This provides aliases that invoke the [`eza`](https://github.com/eza-community/eza) utility rather than `ls`
+
+To use it add `eza` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... eza)
+```
+
+## Configuration
+
+All configurations are done using the `zstyle` command in the `:omz:plugins:eza` namespace.
+
+**NOTE:** The configuring needs to be done prior to OMZ loading the plugins. When the plugin is loaded,
+changing the `zstyle` won't have any effect.
+
+### `dirs-first`
+
+```zsh
+zstyle ':omz:plugins:eza' 'dirs-first' yes|no
+```
+
+If `yes`, directories will be grouped first.
+
+Default: `no`
+
+### `git-status`
+
+```zsh
+zstyle ':omz:plugins:eza' 'git-status' yes|no
+```
+
+If `yes`, always add `--git` flag to indicate git status (if tracked / in a git repo).
+
+Default: `no`
+
+### `header`
+
+```zsh
+zstyle ':omz:plugins:eza' 'header' yes|no
+```
+
+If `yes`, always add `-h` flag to add a header row for each column.
+
+Default: `no`
+
+### `show-group`
+
+```zsh
+zstyle ':omz:plugins:eza' 'show-group' yes|no
+```
+
+If `yes` (default), always add `-g` flag to show the group ownership.
+
+Default: `yes`
+
+### `icons`
+
+```zsh
+zstyle ':omz:plugins:eza' 'icons' yes|no
+```
+
+If `yes`, sets the `--icons` option of `eza`, adding icons for files and folders.
+
+Default: `no`
+
+### `color-scale`
+
+```zsh
+zstyle ':omz:plugins:eza' 'color-scale' all|age|size
+```
+
+Highlight levels of field(s) distinctly. Use comma(,) separated list of `all`, `age`, `size`
+
+Default: `none`
+
+### `color-scale-mode`
+
+```zsh
+zstyle ':omz:plugins:eza' 'color-scale-mode' gradient|fixed
+```
+
+Choose the mode for highlighting:
+
+- `gradient` (default) -- gradient coloring
+- `fixed` -- fixed coloring
+
+Default: `gradient`
+
+### `size-prefix`
+
+```zsh
+zstyle ':omz:plugins:eza' 'size-prefix' (binary|none|si)
+```
+
+Choose the prefix to be used in displaying file size:
+
+- `binary` -- use [binary prefixes](https://en.wikipedia.org/wiki/Binary_prefix) such as "Ki", "Mi", "Gi" and
+ so on
+- `none` -- don't use any prefix, show size in bytes
+- `si` (default) -- use [Metric/S.I. prefixes](https://en.wikipedia.org/wiki/Metric_prefix)
+
+Default: `si`
+
+### `time-style`
+
+```zsh
+zstyle ':omz:plugins:eza' 'time-style' $TIME_STYLE
+```
+
+Sets the `--time-style` option of `eza`. (See `man eza` for the options)
+
+Default: Not set, which means the default behavior of `eza` will take place.
+
+### `hyperlink`
+
+```zsh
+zstyle ':omz:plugins:eza' 'hyperlink' yes|no
+```
+
+If `yes`, always add `--hyperlink` flag to create hyperlink with escape codes.
+
+Default: `no`
+
+## Aliases
+
+**Notes:**
+
+- Aliases may be modified by Configuration
+- The term "files" without "only" qualifier means both files & directories
+
+| Alias | Command | Description |
+| ------ | ----------------- | -------------------------------------------------------------------------- |
+| `la` | `eza -la` | List all files (except . and ..) as a long list |
+| `ldot` | `eza -ld .*` | List dotfiles only (directories shown as entries instead of recursed into) |
+| `lD` | `eza -lD` | List only directories (excluding dotdirs) as a long list |
+| `lDD` | `eza -laD` | List only directories (including dotdirs) as a long list |
+| `ll` | `eza -l` | List files as a long list |
+| `ls` | `eza` | Plain eza call |
+| `lsd` | `eza -d` | List specified files with directories as entries, in a grid |
+| `lsdl` | `eza -dl` | List specified files with directories as entries, in a long list |
+| `lS` | `eza -l -ssize` | List files as a long list, sorted by size |
+| `lT` | `eza -l -snewest` | List files as a long list, sorted by date (newest last) |
diff --git a/plugins/eza/eza.plugin.zsh b/plugins/eza/eza.plugin.zsh
new file mode 100644
index 000000000..60ed1eb27
--- /dev/null
+++ b/plugins/eza/eza.plugin.zsh
@@ -0,0 +1,76 @@
+if ! (( $+commands[eza] )); then
+ print "zsh eza plugin: eza not found. Please install eza before using this plugin." >&2
+ return 1
+fi
+
+typeset -a _EZA_HEAD
+typeset -a _EZA_TAIL
+
+function _configure_eza() {
+ local _val
+ # Get the head flags
+ if zstyle -T ':omz:plugins:eza' 'show-group'; then
+ _EZA_HEAD+=("g")
+ fi
+ if zstyle -t ':omz:plugins:eza' 'header'; then
+ _EZA_HEAD+=("h")
+ fi
+ zstyle -s ':omz:plugins:eza' 'size-prefix' _val
+ case "${_val:l}" in
+ binary)
+ _EZA_HEAD+=("b")
+ ;;
+ none)
+ _EZA_HEAD+=("B")
+ ;;
+ esac
+ # Get the tail long-options
+ if zstyle -t ':omz:plugins:eza' 'dirs-first'; then
+ _EZA_TAIL+=("--group-directories-first")
+ fi
+ if zstyle -t ':omz:plugins:eza' 'git-status'; then
+ _EZA_TAIL+=("--git")
+ fi
+ if zstyle -t ':omz:plugins:eza' 'icons'; then
+ _EZA_TAIL+=("--icons=auto")
+ fi
+ zstyle -s ':omz:plugins:eza' 'color-scale' _val
+ if [[ $_val ]]; then
+ _EZA_TAIL+=("--color-scale=$_val")
+ fi
+ zstyle -s ':omz:plugins:eza' 'color-scale-mode' _val
+ if [[ $_val == (gradient|fixed) ]]; then
+ _EZA_TAIL+=("--color-scale-mode=$_val")
+ fi
+ zstyle -s ':omz:plugins:eza' 'time-style' _val
+ if [[ $_val ]]; then
+ _EZA_TAIL+=("--time-style='$_val'")
+ fi
+ if zstyle -t ":omz:plugins:eza" "hyperlink"; then
+ _EZA_TAIL+=("--hyperlink")
+ fi
+}
+
+_configure_eza
+
+function _alias_eza() {
+ local _head="${(j::)_EZA_HEAD}$2"
+ local _tail="${(j: :)_EZA_TAIL}"
+ alias "$1"="eza${_head:+ -}${_head}${_tail:+ }${_tail}${3:+ }$3"
+}
+
+_alias_eza la la
+_alias_eza ldot ld ".*"
+_alias_eza lD lD
+_alias_eza lDD lDa
+_alias_eza ll l
+_alias_eza ls
+_alias_eza lsd d
+_alias_eza lsdl dl
+_alias_eza lS "l -ssize"
+_alias_eza lT "l -snewest"
+
+unfunction _alias_eza
+unfunction _configure_eza
+unset _EZA_HEAD
+unset _EZA_TAIL
diff --git a/plugins/fancy-ctrl-z/README.md b/plugins/fancy-ctrl-z/README.md
index f1b1dfa5c..7766c51eb 100644
--- a/plugins/fancy-ctrl-z/README.md
+++ b/plugins/fancy-ctrl-z/README.md
@@ -1,14 +1,24 @@
-# Use Ctrl-Z to switch back to Vim
+# fancy-ctrl-z
-I frequently need to execute random commands in my shell. To achieve it I pause
+Allows pressing Ctrl-Z again to switch back to a background job.
+
+To use it, add `fancy-ctrl-z` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... fancy-ctrl-z)
+```
+
+## Motivation
+
+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 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
+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.
Source: http://sheerun.net/2014/03/21/how-to-boost-your-vim-productivity/
-Credits:
+Credits:
- original idea by @sheerun
- added to OMZ by @mbologna
diff --git a/plugins/fastfile/README.md b/plugins/fastfile/README.md
index 32f619ffd..7291fde38 100644
--- a/plugins/fastfile/README.md
+++ b/plugins/fastfile/README.md
@@ -71,13 +71,13 @@ them, add `<variable>=<value>` to your zshrc file, before Oh My Zsh is sourced.
For example: `fastfile_var_prefix='@'`.
- `fastfile_var_prefix`: prefix for the global aliases created. Controls the prefix of the
- created global aliases.
+ created global aliases.
**Default:** `§` (section sign), easy to type in a german keyboard via the combination
[`⇧ Shift`+`3`](https://en.wikipedia.org/wiki/German_keyboard_layout#/media/File:KB_Germany.svg),
or using `⌥ Option`+`6` in macOS.
- `fastfile_dir`: directory where the fastfile shortcuts are stored. Needs to end
- with a trailing slash.
+ with a trailing slash.
**Default:** `$HOME/.fastfile/`.
## Author
diff --git a/plugins/fastfile/fastfile.plugin.zsh b/plugins/fastfile/fastfile.plugin.zsh
index 896fed5f7..86f224b71 100644
--- a/plugins/fastfile/fastfile.plugin.zsh
+++ b/plugins/fastfile/fastfile.plugin.zsh
@@ -5,8 +5,8 @@
# If they are not set yet, they will be
# overwritten with their default values
-default fastfile_dir "${HOME}/.fastfile"
-default fastfile_var_prefix "§"
+fastfile_dir="${fastfile_dir:-${HOME}/.fastfile}"
+fastfile_var_prefix="${fastfile_var_prefix:-§}"
###########################
# Impl
diff --git a/plugins/fd/README.md b/plugins/fd/README.md
deleted file mode 100644
index f3341612f..000000000
--- a/plugins/fd/README.md
+++ /dev/null
@@ -1,9 +0,0 @@
-# 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)
-```
diff --git a/plugins/fd/_fd b/plugins/fd/_fd
deleted file mode 100644
index 45b8ca477..000000000
--- a/plugins/fd/_fd
+++ /dev/null
@@ -1,273 +0,0 @@
-#compdef fd
-
-##
-# zsh completion function for fd
-#
-# Based on ripgrep completion function.
-# Originally based on code from the zsh-users project — see copyright notice
-# below.
-
-autoload -U is-at-least
-
-_fd() {
- local curcontext="$curcontext" no='!' ret=1
- local -a context line state state_descr _arguments_options fd_types fd_args
- local -A opt_args
-
- if is-at-least 5.2; then
- _arguments_options=( -s -S )
- else
- _arguments_options=( -s )
- fi
-
- fd_types=(
- {f,file}'\:"regular files"'
- {d,directory}'\:"directories"'
- {l,symlink}'\:"symbolic links"'
- {e,empty}'\:"empty files or directories"'
- {x,executable}'\:"executable (files)"'
- {s,socket}'\:"sockets"'
- {p,pipe}'\:"named pipes (FIFOs)"'
- )
-
- # Do not complete rare options unless either the current prefix
- # matches one of those 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
- # (--[bpsu]* => match all options marked with '$no')
- [[ $PREFIX$SUFFIX == --[bopsu]* ]] ||
- 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
- fd_args=(
- + '(hidden)' # hidden files
- {-H,--hidden}'[search hidden files/directories]'
-
- + '(no-ignore-full)' # all ignore files
- '(no-ignore-partial)'{-I,--no-ignore}"[don't respect .(git|fd)ignore and global ignore files]"
- $no'(no-ignore-partial)*'{-u,--unrestricted}'[alias for --no-ignore, when repeated also alias for --hidden]'
-
- + no-ignore-partial # some ignore files
- "(no-ignore-full --no-ignore-vcs)--no-ignore-vcs[don't respect .gitignore files]"
- "!(no-ignore-full --no-global-ignore-file)--no-global-ignore-file[don't respect the global ignore file]"
- $no'(no-ignore-full --no-ignore-parent)--no-ignore-parent[]'
-
- + '(case)' # case-sensitivity
- {-s,--case-sensitive}'[perform a case-sensitive search]'
- {-i,--ignore-case}'[perform a case-insensitive search]'
-
- + '(regex-pattern)' # regex-based search pattern
- '(no-regex-pattern)--regex[perform a regex-based search (default)]'
-
- + '(no-regex-pattern)' # non-regex-based search pattern
- {-g,--glob}'[perform a glob-based search]'
- {-F,--fixed-strings}'[treat pattern as literal string instead of a regex]'
-
- + '(match-full)' # match against full path
- {-p,--full-path}'[match the pattern against the full path instead of the basename]'
-
- + '(follow)' # follow symlinks
- {-L,--follow}'[follow symbolic links to directories]'
-
- + '(abs-path)' # show absolute paths
- '(long-listing)'{-a,--absolute-path}'[show absolute paths instead of relative paths]'
-
- + '(null-sep)' # use null separator for output
- '(long-listing)'{-0,--print0}'[separate search results by the null character]'
-
- + '(long-listing)' # long-listing output
- '(abs-path null-sep max-results exec-cmds)'{-l,--list-details}'[use a long listing format with file metadata]'
-
- + '(max-results)' # max number of results
- '(long-listing exec-cmds)--max-results=[limit number of search results to given count and quit]:count'
- '(long-listing exec-cmds)-1[limit to a single search result and quit]'
-
- + '(fs-errors)' # file-system errors
- $no'--show-errors[enable the display of filesystem errors]'
-
- + '(fs-traversal)' # file-system traversal
- $no"--one-file-system[don't descend into directories on other file systems]"
- '!--mount'
- '!--xdev'
-
- + dir-depth # directory depth
- '(--exact-depth -d --max-depth)'{-d+,--max-depth=}'[set max directory depth to descend when searching]:depth'
- '!(--exact-depth -d --max-depth)--maxdepth:depth'
- '(--exact-depth --min-depth)--min-depth=[set directory depth to descend before start searching]:depth'
- '(--exact-depth -d --max-depth --maxdepth --min-depth)--exact-depth=[only search at the exact given directory depth]:depth'
-
- + prune # pruning
- "--prune[don't traverse into matching directories]"
-
- + filter-misc # filter search
- '*'{-t+,--type=}"[filter search by type]:type:(($fd_types))"
- '*'{-e+,--extension=}'[filter search by file extension]:extension'
- '*'{-E+,--exclude=}'[exclude files/directories that match the given glob pattern]:glob pattern'
- '*'{-S+,--size=}'[limit search by file size]:size limit:->size'
- '(-o --owner)'{-o+,--owner=}'[filter by owning user and/or group]:owner and/or group:->owner'
-
- + ignore-file # extra ignore files
- '*--ignore-file=[add a custom, low-precedence ignore-file with .gitignore format]: :_files'
-
- + '(filter-mtime-newer)' # filter by files modified after than
- '--changed-within=[limit search to files/directories modified within the given date/duration]:date or duration'
- '!--change-newer-than=:date/duration'
- '!--newer=:date/duration'
-
- + '(filter-mtime-older)' # filter by files modified before than
- '--changed-before=[limit search to files/directories modified before the given date/duration]:date or duration'
- '!--change-older-than=:date/duration'
- '!--older=:date/duration'
-
- + '(color)' # colorize output
- {-c+,--color=}'[declare when to colorize search results]:when to colorize:((
- auto\:"show colors if the output goes to an interactive console (default)"
- never\:"do not use colorized output"
- always\:"always use colorized output"
- ))'
-
- + '(threads)'
- {-j+,--threads=}'[set the number of threads for searching and executing]:number of threads'
-
- + '(exec-cmds)' # execute command
- '(long-listing max-results)'{-x+,--exec=}'[execute command for each search result]:command: _command_names -e:*\;::program arguments: _normal'
- '(long-listing max-results)'{-X+,--exec-batch=}'[execute command for all search results at once]:command: _command_names -e:*\;::program arguments: _normal'
- '(long-listing max-results)--batch-size=[max number of args for each -X call]:size'
-
- + other
- '!(--max-buffer-time)--max-buffer-time=[set amount of time to buffer before showing output]:time (ms)'
-
- + '(about)' # about flags
- '(: * -)'{-h,--help}'[display help message]'
- '(: * -)'{-v,--version}'[display version information]'
-
- + path-sep # set path separator for output
- $no'(--path-separator)--path-separator=[set the path separator to use when printing file paths]:path separator'
-
- + search-path
- $no'(--base-directory)--base-directory=[change the current working directory to the given path]:directory:_files -/'
- $no'(*)*--search-path=[set search path (instead of positional <path> arguments)]:directory:_files -/'
-
- + strip-cwd-prefix
- $no'(strip-cwd-prefix exec-cmds)--strip-cwd-prefix[Strip ./ prefix when output is redirected]'
-
- + args # positional arguments
- '1: :_guard "^-*" pattern'
- '(--search-path)*:directory:_files -/'
- )
-
- # Strip out argument groups where unsupported (see above)
- is-at-least 5.4 ||
- fd_args=( ${(@)args:#(#i)(+|[a-z0-9][a-z0-9_-]#|\([a-z0-9][a-z0-9_-]#\))} )
-
- _arguments $_arguments_options : $fd_args && ret=0
-
- case ${state} in
- owner)
- compset -P '(\\|)\!'
- if compset -P '*:'; then
- _groups && ret=0
- else
- if
- compset -S ':*' ||
- # Do not add the colon suffix when completing "!user<TAB>
- # (with a starting double-quote) otherwise pressing tab again
- # after the inserted colon "!user:<TAB> will complete history modifiers
- [[ $IPREFIX == (\\|\!)* && ($QIPREFIX == \"* && -z $QISUFFIX) ]]
- then
- _users && ret=0
- else
- local q
- # Since quotes are needed when using the negation prefix !,
- # automatically remove the colon suffix also when closing the quote
- if [[ $QIPREFIX == [\'\"]* ]]; then
- q=${QIPREFIX:0:1}
- fi
- _users -r ": \t\n\-$q" -S : && ret=0
- fi
- fi
- ;;
-
- size)
- if compset -P '[-+][0-9]##'; then
- local -a suff=(
- 'B:bytes'
- 'K:kilobytes (10^3 = 1000 bytes)'
- 'M:megabytes (10^6 = 1000^2 bytes)'
- 'G:gigabytes (10^9 = 1000^3 bytes)'
- 'T:terabytes (10^12 = 1000^4 bytes)'
- 'Ki:kibibytes ( 2^10 = 1024 bytes)'
- 'Mi:mebibytes ( 2^20 = 1024^2 bytes)'
- 'Gi:gigibytes ( 2^30 = 1024^3 bytes)'
- 'Ti:tebibytes ( 2^40 = 1024^4 bytes)'
- )
- _describe -t units 'size limit units' suff -V 'units'
- elif compset -P '[-+]'; then
- _message -e 'size limit number (full format: <+-><number><unit>)'
- else
- _values 'size limit prefix (full format: <prefix><number><unit>)' \
- '\+[file size must be greater or equal to]'\
- '-[file size must be less than or equal to]' && ret=0
- fi
- ;;
- esac
-
- return ret
-}
-
-_fd "$@"
-
-# ------------------------------------------------------------------------------
-# 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 fd
-#
-# ------------------------------------------------------------------------------
-# Authors
-# -------
-#
-# * smancill (https://github.com/smancill)
-#
-# ------------------------------------------------------------------------------
-
-# 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/fig/README.md b/plugins/fig/README.md
deleted file mode 100644
index 3861958d6..000000000
--- a/plugins/fig/README.md
+++ /dev/null
@@ -1,9 +0,0 @@
-# Fig plugin
-
-This plugin sets up completion for [Fig](https://fig.io/).
-
-To use it, add `fig` to the plugins array in your zshrc file:
-
-```zsh
-plugins=(... fig)
-```
diff --git a/plugins/fig/fig.plugin.zsh b/plugins/fig/fig.plugin.zsh
deleted file mode 100644
index cddb6c7c0..000000000
--- a/plugins/fig/fig.plugin.zsh
+++ /dev/null
@@ -1,13 +0,0 @@
-if ! (( $+commands[fig] )); then
- return
-fi
-
-# If the completion file doesn't exist yet, we need to autoload it and
-# bind it to `fig`. Otherwise, compinit will have already done that
-if [[ ! -f "$ZSH_CACHE_DIR/completions/_fig" ]]; then
- autoload -Uz _fig
- typeset -g -A _comps
- _comps[fig]=_fig
-fi
-
-fig completion zsh >| "$ZSH_CACHE_DIR/completions/_fig" &|
diff --git a/plugins/flutter/flutter.plugin.zsh b/plugins/flutter/flutter.plugin.zsh
index 44d196cd4..5e853b78f 100644
--- a/plugins/flutter/flutter.plugin.zsh
+++ b/plugins/flutter/flutter.plugin.zsh
@@ -26,4 +26,4 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_flutter" ]]; then
_comps[flutter]=_flutter
fi
-flutter zsh-completion >| "$ZSH_CACHE_DIR/completions/_flutter" &| \ No newline at end of file
+flutter zsh-completion < /dev/null >| "$ZSH_CACHE_DIR/completions/_flutter" &| \ No newline at end of file
diff --git a/plugins/foot/README.md b/plugins/foot/README.md
new file mode 100644
index 000000000..67777d9fa
--- /dev/null
+++ b/plugins/foot/README.md
@@ -0,0 +1,35 @@
+# foot
+
+This plugin adds shell integration for [foot, a fast, lightweight and
+minimalistic Wayland terminal emulator](https://codeberg.org/dnkl/foot).
+
+To use, add `foot` to the list of plugins in your `.zshrc` file:
+
+```zsh
+plugins=(... foot)
+```
+
+## Spawning new terminal instances in the current working directory
+
+When spawning a new terminal instance (with `ctrl+shift+n` by default), the new
+instance will start in the current working directory.
+
+## Jumping between prompts
+
+Foot can move the current viewport to focus prompts of already executed
+commands (bound to ctrl+shift+z/x by default).
+
+## Piping last command's output
+
+The key binding `pipe-command-output` can pipe the last command's output to an
+application of your choice (similar to the other `pipe-*` key bindings):
+
+```
+[key-bindings]
+pipe-command-output=[sh -c "f=$(mktemp); cat - > $f; footclient emacsclient -nw $f; rm $f"] Control+Shift+g
+```
+
+When pressing ctrl+shift+g, the last command's output is written to a
+temporary file, then an emacsclient is started in a new footclient instance.
+The temporary file is removed after the footclient instance has closed.
+
diff --git a/plugins/foot/foot.plugin.zsh b/plugins/foot/foot.plugin.zsh
new file mode 100644
index 000000000..c1d077e26
--- /dev/null
+++ b/plugins/foot/foot.plugin.zsh
@@ -0,0 +1,10 @@
+function precmd {
+ print -Pn "\e]133;A\e\\"
+ if ! builtin zle; then
+ print -n "\e]133;D\e\\"
+ fi
+}
+
+function preexec {
+ print -n "\e]133;C\e\\"
+}
diff --git a/plugins/forklift/forklift.plugin.zsh b/plugins/forklift/forklift.plugin.zsh
index 85889481b..4bc74958d 100644
--- a/plugins/forklift/forklift.plugin.zsh
+++ b/plugins/forklift/forklift.plugin.zsh
@@ -2,6 +2,7 @@
# Author: Adam Strzelecki nanoant.com, modified by Bodo Tasche bitboxer.de
# Updated to support ForkLift 2 and ForkLift 3 by Johan Kaving
# Updated to support ForkLift from Setapp by Paul Rudkin
+# Updated to support ForkLift 4 by Michal Szymanski (misiektoja)
#
# Usage:
# fl [<folder>]
@@ -58,7 +59,7 @@ function fl {
tell application forkLiftSetapp
activate
set forkLiftVersion to version
- end tell
+ end tell
else if forkLift3 is not null and application forkLift3 is running then
tell application forkLift3
activate
@@ -84,7 +85,7 @@ function fl {
else if forkLift is not null then
set appName to forkLift
end if
-
+
tell application appName
activate
set forkLiftVersion to version
@@ -110,6 +111,11 @@ function fl {
tell pop over of list of group of splitter group of splitter group of topWindow
set value of text field 1 to "$PWD"
end tell
+ else if forkLiftVersion starts with "4" then
+ tell pop over of list of group of splitter group of splitter group of topWindow
+ keystroke "$PWD"
+ delay 0.1
+ end tell
else
tell sheet 1 of topWindow
set value of text field 1 to "$PWD"
diff --git a/plugins/fzf/fzf.plugin.zsh b/plugins/fzf/fzf.plugin.zsh
index b253a23d2..e244b4cfb 100644
--- a/plugins/fzf/fzf.plugin.zsh
+++ b/plugins/fzf/fzf.plugin.zsh
@@ -1,3 +1,16 @@
+function fzf_setup_using_fzf() {
+ (( ${+commands[fzf]} )) || return 1
+
+ # we remove "fzf " prefix, this fixes really old fzf versions behaviour
+ # see https://github.com/ohmyzsh/ohmyzsh/issues/12387
+ local fzf_ver=${"$(fzf --version)"#fzf }
+
+ autoload -Uz is-at-least
+ is-at-least 0.48.0 ${${(s: :)fzf_ver}[1]} || return 1
+
+ eval "$(fzf --zsh)"
+}
+
function fzf_setup_using_base_dir() {
local fzf_base fzf_shell fzfdirs dir
@@ -8,6 +21,7 @@ function fzf_setup_using_base_dir() {
"${HOME}/.fzf"
"${HOME}/.nix-profile/share/fzf"
"${XDG_DATA_HOME:-$HOME/.local/share}/fzf"
+ "${MSYSTEM_PREFIX}/share/fzf"
"/usr/local/opt/fzf"
"/opt/homebrew/opt/fzf"
"/usr/share/fzf"
@@ -61,7 +75,7 @@ function fzf_setup_using_base_dir() {
function fzf_setup_using_debian() {
if (( ! $+commands[apt] && ! $+commands[apt-get] )); then
- # Not a debian based distro
+ # Not a debian based distro
return 1
fi
@@ -134,6 +148,27 @@ function fzf_setup_using_opensuse() {
return 0
}
+function fzf_setup_using_fedora() {
+ (( $+commands[fzf] )) || return 1
+
+ local completions="/usr/share/zsh/site-functions/fzf"
+ local key_bindings="/usr/share/fzf/shell/key-bindings.zsh"
+
+ if [[ ! -f "$completions" || ! -f "$key_bindings" ]]; then
+ return 1
+ fi
+
+ if [[ -o interactive && "$DISABLE_FZF_AUTO_COMPLETION" != "true" ]]; then
+ source "$completions" 2>/dev/null
+ fi
+
+ if [[ "$DISABLE_FZF_KEY_BINDINGS" != "true" ]]; then
+ source "$key_bindings" 2>/dev/null
+ fi
+
+ return 0
+}
+
function fzf_setup_using_openbsd() {
# openBSD installs fzf in /usr/local/bin/fzf
if [[ "$OSTYPE" != openbsd* ]] || (( ! $+commands[fzf] )); then
@@ -216,9 +251,11 @@ Please add `export FZF_BASE=/path/to/fzf/install/dir` to your .zshrc
EOF
}
-fzf_setup_using_openbsd \
+fzf_setup_using_fzf \
+ || fzf_setup_using_openbsd \
|| fzf_setup_using_debian \
|| fzf_setup_using_opensuse \
+ || fzf_setup_using_fedora \
|| fzf_setup_using_cygwin \
|| fzf_setup_using_macports \
|| fzf_setup_using_base_dir \
diff --git a/plugins/gatsby/README.md b/plugins/gatsby/README.md
index 36846a228..cc1bd392e 100644
--- a/plugins/gatsby/README.md
+++ b/plugins/gatsby/README.md
@@ -1,6 +1,6 @@
# gatsby autocomplete plugin
-* Adds autocomplete options for all gatsby commands.
+Adds autocomplete options for all gatsby commands.
## Requirements
diff --git a/plugins/gcloud/gcloud.plugin.zsh b/plugins/gcloud/gcloud.plugin.zsh
index 9a4213aaf..fa8f884a4 100644
--- a/plugins/gcloud/gcloud.plugin.zsh
+++ b/plugins/gcloud/gcloud.plugin.zsh
@@ -9,6 +9,7 @@ if [[ -z "${CLOUDSDK_HOME}" ]]; then
"/usr/local/share/google-cloud-sdk"
"/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk"
"/opt/homebrew/Caskroom/google-cloud-sdk/latest/google-cloud-sdk"
+ "/opt/homebrew/share/google-cloud-sdk"
"/usr/share/google-cloud-sdk"
"/snap/google-cloud-sdk/current"
"/snap/google-cloud-cli/current"
@@ -17,6 +18,7 @@ if [[ -z "${CLOUDSDK_HOME}" ]]; then
"/opt/google-cloud-sdk"
"/opt/google-cloud-cli"
"/opt/local/libexec/google-cloud-sdk"
+ "$HOME/.asdf/installs/gcloud/*/"
)
for gcloud_sdk_location in $search_locations; do
diff --git a/plugins/gem/_gem b/plugins/gem/completions/_gem
index 92feebe95..92feebe95 100644
--- a/plugins/gem/_gem
+++ b/plugins/gem/completions/_gem
diff --git a/plugins/gem/gem.plugin.zsh b/plugins/gem/gem.plugin.zsh
index 938f5c993..41c434a09 100644
--- a/plugins/gem/gem.plugin.zsh
+++ b/plugins/gem/gem.plugin.zsh
@@ -4,4 +4,29 @@ alias gemp="gem push *.gem"
# gemy GEM 0.0.0 = gem yank GEM -v 0.0.0
function gemy {
gem yank $1 -v $2
-} \ No newline at end of file
+}
+
+# If the completion file doesn't exist yet, we need to autoload it and
+# bind it to `gem`. Otherwise, compinit will have already done that.
+if [[ ! -f "$ZSH_CACHE_DIR/completions/_gem" ]]; then
+ typeset -g -A _comps
+ autoload -Uz _gem
+ _comps[gem]=_gem
+fi
+
+# zsh 5.5 already provides completion for `_gem`. With this we ensure that
+# our provided completion (which is not optimal but is enough in most cases)
+# is used for older versions
+autoload -Uz is-at-least
+if is-at-least 5.5; then
+ return 0
+fi
+
+{
+ # Standardized $0 handling
+ # https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html
+ 0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
+ 0="${${(M)0:#/*}:-$PWD/$0}"
+
+ command cp -f "${0:h}/completions/_gem" "$ZSH_CACHE_DIR/completions/_gem"
+} &|
diff --git a/plugins/git-auto-fetch/README.md b/plugins/git-auto-fetch/README.md
index e96ab42a3..0d7431bba 100644
--- a/plugins/git-auto-fetch/README.md
+++ b/plugins/git-auto-fetch/README.md
@@ -18,7 +18,7 @@ You can change the fetch interval in your .zshrc:
GIT_AUTO_FETCH_INTERVAL=1200 # in seconds
```
-A log of `git fetch --all` will be saved in `.git/FETCH_LOG`.
+A log of `git-fetch-all` will be saved in `.git/FETCH_LOG`.
## Toggle auto-fetch per folder
diff --git a/plugins/git-commit/README.md b/plugins/git-commit/README.md
index 91cc73b44..f812ee23f 100644
--- a/plugins/git-commit/README.md
+++ b/plugins/git-commit/README.md
@@ -1,6 +1,8 @@
# git-commit plugin
-The git-commit plugin adds several [git aliases](https://www.git-scm.com/docs/git-config#Documentation/git-config.txt-alias) for [conventional commit](https://www.conventionalcommits.org/en/v1.0.0/#summary) messages.
+The git-commit plugin adds several
+[git aliases](https://www.git-scm.com/docs/git-config#Documentation/git-config.txt-alias) for
+[conventional commit](https://www.conventionalcommits.org/en/v1.0.0/#summary) messages.
To use it, add `git-commit` to the plugins array in your zshrc file:
@@ -11,11 +13,9 @@ plugins=(... git-commit)
## Syntax
```zsh
-git <type> [(-s, --scope) "<scope>"] "<message>"
+git <type> [(-s, --scope) "<scope>"] [(-a, --attention)] "<message>"
```
-> ⚠️ Single/Double quotes around the scope and message are required
-
Where `type` is one of the following:
- `build`
@@ -29,14 +29,19 @@ Where `type` is one of the following:
- `rev`
- `style`
- `test`
+- `wip`
-> NOTE: the alias for `revert` type is `rev`, as otherwise it conflicts with the git command of the same name.
+> NOTE: the alias for `revert` type is `rev`, as otherwise it conflicts with the git command of the same name.
> It will still generate a commit message in the format `revert: <message>`
+> ⚠️ Enabling this plugin will (potentially) overwrite all `alias.<type>` that you manually set. Use with
+> care!
+
## Examples
| Git alias | Command |
| --------------------------------------------- | ---------------------------------------------------- |
| `git style "remove trailing whitespace"` | `git commit -m "style: remove trailing whitespace"` |
+| `git wip "work in progress"` | `git commit -m "work in progress"` |
| `git fix -s "router" "correct redirect link"` | `git commit -m "fix(router): correct redirect link"` |
| `git rev -s "api" "rollback v2"` | `git commit -m "revert(api): rollback v2"` |
diff --git a/plugins/git-commit/git-commit.plugin.zsh b/plugins/git-commit/git-commit.plugin.zsh
index 72cecb1d6..c4df77c80 100644
--- a/plugins/git-commit/git-commit.plugin.zsh
+++ b/plugins/git-commit/git-commit.plugin.zsh
@@ -1,3 +1,9 @@
+local _rev="$(git -C $ZSH rev-parse HEAD 2> /dev/null)"
+if [[ $_rev == $(git config --global --get oh-my-zsh.git-commit-alias 2> /dev/null) ]]; then
+ return
+fi
+git config --global oh-my-zsh.git-commit-alias "$_rev"
+
local -a _git_commit_aliases
_git_commit_aliases=(
'build'
@@ -11,21 +17,42 @@ _git_commit_aliases=(
'revert'
'style'
'test'
+ 'wip'
)
-local alias type
-for type in "${_git_commit_aliases[@]}"; do
+local _alias _type
+for _type in "${_git_commit_aliases[@]}"; do
# an alias can't be named "revert" because the git command takes precedence
# https://stackoverflow.com/a/3538791
- case "$type" in
- revert) alias=rev ;;
- *) alias=$type ;;
+ case "$_type" in
+ revert) _alias=rev ;;
+ *) _alias=$_type ;;
esac
- local func='!a() { if [ "$1" = "-s" ] || [ "$1" = "--scope" ]; then local scope="$2"; shift 2; git commit -m "'$type'(${scope}): ${@}"; else git commit -m "'$type': ${@}"; fi }; a'
- if ! git config --global --get-all alias.${alias} >/dev/null 2>&1; then
- git config --global alias.${alias} "$func"
- fi
+ local _func='!a() {
+local _scope _attention _message
+while [ $# -ne 0 ]; do
+case $1 in
+ -s | --scope )
+ if [ -z $2 ]; then
+ echo "Missing scope!"
+ return 1
+ fi
+ _scope="$2"
+ shift 2
+ ;;
+ -a | --attention )
+ _attention="!"
+ shift 1
+ ;;
+ * )
+ _message="${_message} $1"
+ shift 1
+ ;;
+esac
done
+git commit -m "'$_type'${_scope:+(${_scope})}${_attention}:${_message}"
+}; a'
-unset _git_commit_aliases alias type func
+ git config --global alias.$_alias "$_func"
+done
diff --git a/plugins/git-prompt/README.md b/plugins/git-prompt/README.md
index 05208d72f..8f42c6842 100644
--- a/plugins/git-prompt/README.md
+++ b/plugins/git-prompt/README.md
@@ -9,6 +9,10 @@ To use it, add `git-prompt` to the plugins array in your zshrc file:
plugins=(... git-prompt)
```
+You may also need to [customize your theme](https://github.com/ohmyzsh/ohmyzsh/issues/9395#issuecomment-1027130429)
+to change the way the prompt is built. See the
+[OMZ wiki on customizing themes](https://github.com/ohmyzsh/ohmyzsh/wiki/Customization#overriding-and-adding-themes).
+
See the [original repository](https://github.com/olivierverdier/zsh-git-prompt).
## Requirements
diff --git a/plugins/git-prompt/gitstatus.py b/plugins/git-prompt/gitstatus.py
index 94774d828..7cd8f54e2 100644
--- a/plugins/git-prompt/gitstatus.py
+++ b/plugins/git-prompt/gitstatus.py
@@ -23,9 +23,10 @@ def get_tagname_or_hash():
return hash_
return None
-# Re-use method from https://github.com/magicmonty/bash-git-prompt to get stashs count
+# Re-use method from https://github.com/magicmonty/bash-git-prompt to get stash count
+# Use `--git-common-dir` to avoid problems with git worktrees, which don't have individual stashes
def get_stash():
- cmd = Popen(['git', 'rev-parse', '--git-dir'], stdout=PIPE, stderr=PIPE)
+ cmd = Popen(['git', 'rev-parse', '--git-common-dir'], stdout=PIPE, stderr=PIPE)
so, se = cmd.communicate()
stash_file = '%s%s' % (so.decode('utf-8').rstrip(), '/logs/refs/stash')
@@ -35,7 +36,6 @@ def get_stash():
except IOError:
return 0
-
# `git status --porcelain --branch` can collect all information
# branch, remote_branch, untracked, staged, changed, conflicts, ahead, behind
po = Popen(['git', 'status', '--porcelain', '--branch'], env=dict(os.environ, LANG="C"), stdout=PIPE, stderr=PIPE)
diff --git a/plugins/git/README.md b/plugins/git/README.md
index 93dc8ccea..0090fa6cf 100644
--- a/plugins/git/README.md
+++ b/plugins/git/README.md
@@ -41,8 +41,8 @@ plugins=(... git)
| `gba` | `git branch --all` |
| `gbd` | `git branch --delete` |
| `gbD` | `git branch --delete --force` |
-| `gbgd` | `LANG=C git branch --no-color -vv \| grep ": gone\]" \| awk '"'"'{print $1}'"'"' \| xargs git branch -d` |
-| `gbgD` | `LANG=C git branch --no-color -vv \| grep ": gone\]" \| awk '"'"'{print $1}'"'"' \| xargs git branch -D` |
+| `gbgd` | `LANG=C git branch --no-color -vv \| grep ": gone\]" \| cut -c 3- \| awk '"'"'{print $1}'"'"' \| xargs git branch -d` |
+| `gbgD` | `LANG=C git branch --no-color -vv \| grep ": gone\]" \| cut -c 3- \| awk '"'"'{print $1}'"'"' \| xargs git branch -D` |
| `gbm` | `git branch --move` |
| `gbnm` | `git branch --no-merged` |
| `gbr` | `git branch --remote` |
@@ -51,6 +51,7 @@ plugins=(... git)
| `gco` | `git checkout` |
| `gcor` | `git checkout --recurse-submodules` |
| `gcb` | `git checkout -b` |
+| `gcB` | `git checkout -B` |
| `gcd` | `git checkout $(git_develop_branch)` |
| `gcm` | `git checkout $(git_main_branch)` |
| `gcp` | `git cherry-pick` |
@@ -58,6 +59,7 @@ plugins=(... git)
| `gcpc` | `git cherry-pick --continue` |
| `gclean` | `git clean --interactive -d` |
| `gcl` | `git clone --recurse-submodules` |
+| `gclf` | `git clone --recursive --shallow-submodules --filter=blob:none --also-filter-submodules` |
| `gccd` | `git clone --recurse-submodules "$@" && cd "$(basename $\_ .git)"` |
| `gcam` | `git commit --all --message` |
| `gcas` | `git commit --all --signoff` |
@@ -69,12 +71,15 @@ plugins=(... git)
| `gca!` | `git commit --verbose --all --amend` |
| `gcan!` | `git commit --verbose --all --no-edit --amend` |
| `gcans!` | `git commit --verbose --all --signoff --no-edit --amend` |
+| `gcann!` | `git commit --verbose --all --date=now --no-edit --amend` |
| `gc!` | `git commit --verbose --amend` |
+| `gcn` | `git commit --verbose --no-edit` |
| `gcn!` | `git commit --verbose --no-edit --amend` |
| `gcs` | `git commit -S` |
| `gcss` | `git commit -S -s` |
| `gcssm` | `git commit -S -s -m` |
| `gcf` | `git config --list` |
+| `gcfu` | `git commit --fixup` |
| `gdct` | `git describe --tags $(git rev-list --tags --max-count=1)` |
| `gd` | `git diff` |
| `gdca` | `git diff --cached` |
@@ -86,7 +91,7 @@ plugins=(... git)
| `gdnolock` | `git diff $@ ":(exclude)package-lock.json" ":(exclude)\*.lock"` |
| `gdt` | `git diff-tree --no-commit-id --name-only -r` |
| `gf` | `git fetch` |
-| `gfa` | `git fetch --all --prune` |
+| `gfa` | `git fetch --all --tags --prune` |
| `gfo` | `git fetch origin` |
| `gg` | `git gui citool` |
| `gga` | `git gui citool --amend` |
@@ -109,7 +114,9 @@ plugins=(... git)
| `gfg` | `git ls-files \| grep` |
| `gm` | `git merge` |
| `gma` | `git merge --abort` |
+| `gmc` | `git merge --continue` |
| `gms` | `git merge --squash` |
+| `gmff` | `git merge --ff-only` |
| `gmom` | `git merge origin/$(git_main_branch)` |
| `gmum` | `git merge upstream/$(git_main_branch)` |
| `gmtl` | `git mergetool --no-prompt` |
@@ -121,6 +128,8 @@ plugins=(... git)
| `gprav` | `git pull --rebase --autostash -v` |
| `gprom` | `git pull --rebase origin $(git_main_branch)` |
| `gpromi` | `git pull --rebase=interactive origin $(git_main_branch)` |
+| `gprum` | `git pull --rebase upstream $(git_main_branch)` |
+| `gprumi` | `git pull --rebase=interactive upstream $(git_main_branch)` |
| `ggpull` | `git pull origin "$(git_current_branch)"` |
| `ggl` | `git pull origin $(current_branch)` |
| `gluc` | `git pull upstream $(git_current_branch)` |
@@ -150,6 +159,8 @@ plugins=(... git)
| `grbd` | `git rebase $(git_develop_branch)` |
| `grbm` | `git rebase $(git_main_branch)` |
| `grbom` | `git rebase origin/$(git_main_branch)` |
+| `grbum` | `git rebase upstream/$(git_main_branch)` |
+| `grf` | `git reflog` |
| `gr` | `git remote` |
| `grv` | `git remote --verbose` |
| `gra` | `git remote add` |
@@ -162,7 +173,8 @@ plugins=(... git)
| `grhh` | `git reset --hard` |
| `grhk` | `git reset --keep` |
| `grhs` | `git reset --soft` |
-| `gpristine` | `git reset --hard && git clean -dffx` |
+| `gpristine` | `git reset --hard && git clean --force -dfx` |
+| `gwipe` | `git reset --hard && git clean --force -df` |
| `groh` | `git reset origin/$(git_current_branch) --hard` |
| `grs` | `git restore` |
| `grss` | `git restore --source` |
@@ -201,7 +213,7 @@ plugins=(... git)
| `gtv` | `git tag \| sort -V` |
| `gignore` | `git update-index --assume-unchanged` |
| `gunignore` | `git update-index --no-assume-unchanged` |
-| `gwch` | `git whatchanged -p --abbrev-commit --pretty=medium` |
+| `gwch` | `git log --patch --abbrev-commit --pretty=medium --raw` |
| `gwt` | `git worktree` |
| `gwtls` | `git worktree list` |
| `gwtmv` | `git worktree move` |
@@ -222,40 +234,26 @@ branch exists. We do this via the function `git_main_branch`.
These are aliases that have been removed, renamed, or otherwise modified in a way that may, or may not,
receive further support.
-| Alias | Command | Modification |
-| :------- | :-------------------------------------------------------- | :-------------------------------------------------------- |
-| `gap` | `git add --patch` | New alias: `gapa`. |
-| `gcl` | `git config --list` | New alias: `gcf`. |
-| `gdc` | `git diff --cached` | New alias: `gdca`. |
-| `gdt` | `git difftool` | No replacement. |
-| `ggpull` | `git pull origin $(current_branch)` | New alias: `ggl`. (`ggpull` still exists for now though.) |
-| `ggpur` | `git pull --rebase origin $(current_branch)` | New alias: `ggu`. (`ggpur` still exists for now though.) |
-| `ggpush` | `git push origin $(current_branch)` | New alias: `ggp`. (`ggpush` still exists for now though.) |
-| `gk` | `gitk --all --branches` | Now aliased to `gitk --all --branches`. |
-| `glg` | `git log --stat --max-count=10` | Now aliased to `git log --stat --color`. |
-| `glgg` | `git log --graph --max-count=10` | Now aliased to `git log --graph --color`. |
-| `gwc` | `git whatchanged -p --abbrev-commit --pretty = medium` | New alias: `gwch`. |
-| `gup` | `git pull --rebase` | now alias `gpr` |
-| `gupv` | `git pull --rebase -v` | now alias `gprv` |
-| `gupa` | `git pull --rebase --autostash` | now alias `gpra` |
-| `gupav` | `git pull --rebase --autostash -v` | now alias `gprav` |
-| `gupom` | `git pull --rebase origin $(git_main_branch)` | now alias `gprom` |
-| `gupomi` | `git pull --rebase=interactive origin $(git_main_branch)` | now alias `gpromi` |
+| Alias | Command | Modification |
+| :------- | :-------------------------------------------------------- | :-----------------------------------------------------|
+| `gap` | `git add --patch` | New alias: `gapa` |
+| `gcl` | `git config --list` | New alias: `gcf` |
+| `gdt` | `git difftool` | No replacement |
## Functions
### Current
-| Command | Description |
-| :----------------------- | :-------------------------------------------------------------------------------------------------------------- |
-| `current_branch` | Returns the name of the current branch. |
-| `git_current_user_email` | Returns the `user.email` config value. (Lives in `lib/git.zsh`.) |
-| `git_current_user_name` | Returns the `user.name` config value. (Lives in `lib/git.zsh`.) |
-| `git_develop_branch` | Returns the name of the “development” branch: `dev`, `devel`, `development` if they exist, `develop` otherwise. |
-| `git_main_branch` | Returns the name of the main branch: `main` if it exists, `master` otherwise. |
-| `grename <old> <new>` | Renames branch `<old>` to `<new>`, including on the origin remote. |
-| `gbda` | Deletes all merged branches |
-| `gbds` | Deletes all squash-merged branches (**Note: performance degrades with number of branches**) |
+| Command | Description |
+| :----------------------- | :------------------------------------------------------------------------------------------------------------- |
+| `git_current_branch` | Returns the name of the current branch (Lives in `lib/git.zsh`) |
+| `git_current_user_email` | Returns the `user.email` config value (Lives in `lib/git.zsh`) |
+| `git_current_user_name` | Returns the `user.name` config value (Lives in `lib/git.zsh`) |
+| `git_develop_branch` | Returns the name of the “development” branch: `dev`, `devel`, `development` if they exist, `develop` otherwise |
+| `git_main_branch` | Returns the name of the main branch: `main` if it exists, `master` otherwise |
+| `grename <old> <new>` | Renames branch `<old>` to `<new>`, including on the origin remote |
+| `gbda` | Deletes all merged branches |
+| `gbds` | Deletes all squash-merged branches (**Note: performance degrades with number of branches**) |
### Work in Progress (WIP)
@@ -275,4 +273,3 @@ Note that `gwip` and `gunwip` are aliases, but are also documented here to group
| Command | Description | Reason |
| :------------------- | :-------------------------------------- | :--------------------------------------------------------------- |
-| `current_repository` | Return the names of the current remotes | Didn't work properly. Use `git remote -v` instead (`grv` alias). |
diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh
index 2a824444b..9ef60d69a 100644
--- a/plugins/git/git.plugin.zsh
+++ b/plugins/git/git.plugin.zsh
@@ -8,14 +8,6 @@ git_version="${${(As: :)$(git version 2>/dev/null)}[3]}"
# (order should follow README)
#
-# The name of the current branch
-# Back-compatibility wrapper for when this function was defined here in
-# the plugin, before being pulled in to core lib/git.zsh as git_current_branch()
-# to fix the core -> git plugin dependency.
-function current_branch() {
- git_current_branch
-}
-
# Check for develop and similarly named branches
function git_develop_branch() {
command git rev-parse --git-dir &>/dev/null || return
@@ -31,16 +23,26 @@ function git_develop_branch() {
return 1
}
-# Check if main exists and use instead of master
+# Get the default branch name from common branch names or fallback to remote HEAD
function git_main_branch() {
command git rev-parse --git-dir &>/dev/null || return
- local ref
- for ref in refs/{heads,remotes/{origin,upstream}}/{main,trunk,mainline,default,master}; do
+
+ local remote ref
+
+ for ref in refs/{heads,remotes/{origin,upstream}}/{main,trunk,mainline,default,stable,master}; do
if command git show-ref -q --verify $ref; then
echo ${ref:t}
return 0
fi
done
+
+ # Fallback: try to get the default branch from remote HEAD symbolic refs
+ for remote in origin upstream; do
+ ref=$(command git rev-parse --abbrev-ref $remote/HEAD 2>/dev/null)
+ if [[ $ref == $remote/* ]]; then
+ echo ${ref#"$remote/"}; return 0
+ fi
+ done
# If no main branch was found, fall back to master but return error
echo master
@@ -86,13 +88,13 @@ function work_in_progress() {
# Aliases
# (sorted alphabetically by command)
# (order should follow README)
-# (in some cases force the alisas order to match README, like for example gke and gk)
+# (in some cases force the alias order to match README, like for example gke and gk)
#
alias grt='cd "$(git rev-parse --show-toplevel || echo .)"'
function ggpnp() {
- if [[ "$#" == 0 ]]; then
+ if [[ $# == 0 ]]; then
ggl && ggp
else
ggl "${*}" && ggp "${*}"
@@ -147,8 +149,8 @@ function gbds() {
done
}
-alias gbgd='LANG=C git branch --no-color -vv | grep ": gone\]" | awk '"'"'{print $1}'"'"' | xargs git branch -d'
-alias gbgD='LANG=C git branch --no-color -vv | grep ": gone\]" | awk '"'"'{print $1}'"'"' | xargs git branch -D'
+alias gbgd='LANG=C git branch --no-color -vv | grep ": gone\]" | cut -c 3- | awk '"'"'{print $1}'"'"' | xargs git branch -d'
+alias gbgD='LANG=C git branch --no-color -vv | grep ": gone\]" | cut -c 3- | awk '"'"'{print $1}'"'"' | xargs git branch -D'
alias gbm='git branch --move'
alias gbnm='git branch --no-merged'
alias gbr='git branch --remote'
@@ -157,6 +159,7 @@ alias gbg='LANG=C git branch -vv | grep ": gone\]"'
alias gco='git checkout'
alias gcor='git checkout --recurse-submodules'
alias gcb='git checkout -b'
+alias gcB='git checkout -B'
alias gcd='git checkout $(git_develop_branch)'
alias gcm='git checkout $(git_main_branch)'
alias gcp='git cherry-pick'
@@ -164,6 +167,7 @@ alias gcpa='git cherry-pick --abort'
alias gcpc='git cherry-pick --continue'
alias gclean='git clean --interactive -d'
alias gcl='git clone --recurse-submodules'
+alias gclf='git clone --recursive --shallow-submodules --filter=blob:none --also-filter-submodules'
function gccd() {
setopt localoptions extendedglob
@@ -193,9 +197,12 @@ alias gca='git commit --verbose --all'
alias gca!='git commit --verbose --all --amend'
alias gcan!='git commit --verbose --all --no-edit --amend'
alias gcans!='git commit --verbose --all --signoff --no-edit --amend'
+alias gcann!='git commit --verbose --all --date=now --no-edit --amend'
alias gc!='git commit --verbose --amend'
+alias gcn='git commit --verbose --no-edit'
alias gcn!='git commit --verbose --no-edit --amend'
alias gcf='git config --list'
+alias gcfu='git commit --fixup'
alias gdct='git describe --tags $(git rev-list --tags --max-count=1)'
alias gd='git diff'
alias gdca='git diff --cached'
@@ -217,8 +224,8 @@ alias gdt='git diff-tree --no-commit-id --name-only -r'
alias gf='git fetch'
# --jobs=<n> was added in git 2.8
is-at-least 2.8 "$git_version" \
- && alias gfa='git fetch --all --prune --jobs=10' \
- || alias gfa='git fetch --all --prune'
+ && alias gfa='git fetch --all --tags --prune --jobs=10' \
+ || alias gfa='git fetch --all --tags --prune'
alias gfo='git fetch origin'
alias gg='git gui citool'
alias gga='git gui citool --amend'
@@ -250,7 +257,9 @@ alias gignored='git ls-files -v | grep "^[[:lower:]]"'
alias gfg='git ls-files | grep'
alias gm='git merge'
alias gma='git merge --abort'
+alias gmc='git merge --continue'
alias gms="git merge --squash"
+alias gmff="git merge --ff-only"
alias gmom='git merge origin/$(git_main_branch)'
alias gmum='git merge upstream/$(git_main_branch)'
alias gmtl='git mergetool --no-prompt'
@@ -263,24 +272,28 @@ alias gpra='git pull --rebase --autostash'
alias gprav='git pull --rebase --autostash -v'
function ggu() {
- [[ "$#" != 1 ]] && local b="$(git_current_branch)"
- git pull --rebase origin "${b:=$1}"
+ local b
+ [[ $# != 1 ]] && b="$(git_current_branch)"
+ git pull --rebase origin "${b:-$1}"
}
-compdef _git ggu=git-checkout
+compdef _git ggu=git-pull
alias gprom='git pull --rebase origin $(git_main_branch)'
alias gpromi='git pull --rebase=interactive origin $(git_main_branch)'
+alias gprum='git pull --rebase upstream $(git_main_branch)'
+alias gprumi='git pull --rebase=interactive upstream $(git_main_branch)'
alias ggpull='git pull origin "$(git_current_branch)"'
function ggl() {
- if [[ "$#" != 0 ]] && [[ "$#" != 1 ]]; then
+ if [[ $# != 0 ]] && [[ $# != 1 ]]; then
git pull origin "${*}"
else
- [[ "$#" == 0 ]] && local b="$(git_current_branch)"
- git pull origin "${b:=$1}"
+ local b
+ [[ $# == 0 ]] && b="$(git_current_branch)"
+ git pull origin "${b:-$1}"
fi
}
-compdef _git ggl=git-checkout
+compdef _git ggl=git-pull
alias gluc='git pull upstream $(git_current_branch)'
alias glum='git pull upstream $(git_main_branch)'
@@ -288,10 +301,11 @@ alias gp='git push'
alias gpd='git push --dry-run'
function ggf() {
- [[ "$#" != 1 ]] && local b="$(git_current_branch)"
- git push --force origin "${b:=$1}"
+ local b
+ [[ $# != 1 ]] && b="$(git_current_branch)"
+ git push --force origin "${b:-$1}"
}
-compdef _git ggf=git-checkout
+compdef _git ggf=git-push
alias gpf!='git push --force'
is-at-least 2.30 "$git_version" \
@@ -299,10 +313,11 @@ is-at-least 2.30 "$git_version" \
|| alias gpf='git push --force-with-lease'
function ggfl() {
- [[ "$#" != 1 ]] && local b="$(git_current_branch)"
- git push --force-with-lease origin "${b:=$1}"
+ local b
+ [[ $# != 1 ]] && b="$(git_current_branch)"
+ git push --force-with-lease origin "${b:-$1}"
}
-compdef _git ggfl=git-checkout
+compdef _git ggfl=git-push
alias gpsup='git push --set-upstream origin $(git_current_branch)'
is-at-least 2.30 "$git_version" \
@@ -314,14 +329,15 @@ alias gpod='git push origin --delete'
alias ggpush='git push origin "$(git_current_branch)"'
function ggp() {
- if [[ "$#" != 0 ]] && [[ "$#" != 1 ]]; then
+ if [[ $# != 0 ]] && [[ $# != 1 ]]; then
git push origin "${*}"
else
- [[ "$#" == 0 ]] && local b="$(git_current_branch)"
- git push origin "${b:=$1}"
+ local b
+ [[ $# == 0 ]] && b="$(git_current_branch)"
+ git push origin "${b:-$1}"
fi
}
-compdef _git ggp=git-checkout
+compdef _git ggp=git-push
alias gpu='git push upstream'
alias grb='git rebase'
@@ -333,6 +349,8 @@ alias grbs='git rebase --skip'
alias grbd='git rebase $(git_develop_branch)'
alias grbm='git rebase $(git_main_branch)'
alias grbom='git rebase origin/$(git_main_branch)'
+alias grbum='git rebase upstream/$(git_main_branch)'
+alias grf='git reflog'
alias gr='git remote'
alias grv='git remote --verbose'
alias gra='git remote add'
@@ -346,12 +364,15 @@ alias grhh='git reset --hard'
alias grhk='git reset --keep'
alias grhs='git reset --soft'
alias gpristine='git reset --hard && git clean --force -dfx'
+alias gwipe='git reset --hard && git clean --force -df'
alias groh='git reset origin/$(git_current_branch) --hard'
alias grs='git restore'
alias grss='git restore --source'
alias grst='git restore --staged'
alias gunwip='git rev-list --max-count=1 --format="%s" HEAD | grep -q "\--wip--" && git reset HEAD~1'
alias grev='git revert'
+alias greva='git revert --abort'
+alias grevc='git revert --continue'
alias grm='git rm'
alias grmc='git rm --cached'
alias gcount='git shortlog --summary --numbered'
@@ -385,7 +406,7 @@ alias gts='git tag --sign'
alias gtv='git tag | sort -V'
alias gignore='git update-index --assume-unchanged'
alias gunignore='git update-index --no-assume-unchanged'
-alias gwch='git whatchanged -p --abbrev-commit --pretty=medium'
+alias gwch='git log --patch --abbrev-commit --pretty=medium --raw'
alias gwt='git worktree'
alias gwta='git worktree add'
alias gwtls='git worktree list'
@@ -398,19 +419,13 @@ alias gke='\gitk --all $(git log --walk-reflogs --pretty=%h) &!'
unset git_version
-# Logic for adding warnings on deprecated aliases
-local old_alias new_alias
-for old_alias new_alias (
- # TODO(2023-10-19): remove deprecated `git pull --rebase` aliases
- gup gpr
- gupv gprv
- gupa gpra
- gupav gprav
- gupom gprom
- gupomi gpromi
+# Logic for adding warnings on deprecated aliases or functions
+local old_name new_name
+for old_name new_name (
+ current_branch git_current_branch
); do
- aliases[$old_alias]="
- print -Pu2 \"%F{yellow}[oh-my-zsh] '%F{red}${old_alias}%F{yellow}' is a deprecated alias, using '%F{green}${new_alias}%F{yellow}' instead.%f\"
- $new_alias"
+ aliases[$old_name]="
+ print -Pu2 \"%F{yellow}[oh-my-zsh] '%F{red}${old_name}%F{yellow}' is deprecated, using '%F{green}${new_name}%F{yellow}' instead.%f\"
+ $new_name"
done
-unset old_alias new_alias
+unset old_name new_name
diff --git a/plugins/gitfast/MANUAL.adoc b/plugins/gitfast/MANUAL.adoc
new file mode 100644
index 000000000..5333f5a2c
--- /dev/null
+++ b/plugins/gitfast/MANUAL.adoc
@@ -0,0 +1,40 @@
+This project is a friendly fork of the official Git completion
+(`contrib/completion`) and prompt scripts for Bash, Zsh, and possibly other
+shells.
+
+Most Git developers use the Bash shell, for which the completion scripts work
+rather well, however, Zsh is typically neglected. I've sent many patches to fix
+the issues, many have been merged, but many have been ignored, thus the need for
+a canonical location of a good, working Zsh completion.
+
+There are advantages for Bash users too. Currently the scripts under `contrib` are tied to the
+specific Git version, for example the completion scripts of version v2.40
+(https://git.kernel.org/pub/scm/git/git.git/plain/contrib/completion/git-completion.bash?h=v2.40.0[git-completion.bash])
+have issues with older versions of Git (e.g. v2.33); the ones in
+this project don't.
+
+With `git-completion` you can be sure you are using the latest completion that
+works in both shells, and any Git version.
+
+This is a sister project of the
+https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/gitfast[Oh My Zsh
+gitfast] plugin (that I also maintain), which has similar needs.
+
+== Installation ==
+
+* https://github.com/felipec/git-completion/wiki/Bash[Bash instructions]
+* https://github.com/felipec/git-completion/wiki/Zsh[Zsh instructions]
+
+== Improvements from upstream ==
+
+This is a short list of the benefits you get:
+
+* Easier installation
+* Tons of bug fixes
+* Works with older versions of git
+* Zsh: much more options
+* Zsh: quoting works properly
+* Zsh: automatic suffix removal
+
+For a full list of all the patches on top of upstream git check
+https://github.com/felipec/git-completion/wiki/Patches[Patches].
diff --git a/plugins/gitfast/README.md b/plugins/gitfast/README.md
index fed4b120a..60b84a23c 100644
--- a/plugins/gitfast/README.md
+++ b/plugins/gitfast/README.md
@@ -7,9 +7,3 @@ To use it, add `gitfast` to the plugins array in your zshrc file:
```zsh
plugins=(... gitfast)
```
-
-## Aliases
-
-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/ohmyzsh/ohmyzsh/tree/master/plugins/git)
-as well.
diff --git a/plugins/gitfast/_git b/plugins/gitfast/_git
index 31bf88c1c..1283c713e 100644
--- a/plugins/gitfast/_git
+++ b/plugins/gitfast/_git
@@ -2,23 +2,11 @@
# zsh completion wrapper for git
#
-# Copyright (c) 2012-2020 Felipe Contreras <felipe.contreras@gmail.com>
+# Copyright (c) 2012-2024 Felipe Contreras <felipe.contreras@gmail.com>
#
-# The recommended way to install this script is to make a copy of it as a
-# file named '_git' inside any directory in your fpath.
+# The recommended way to use this script is to prepend its location to your $fpath:
#
-# For example, create a directory '~/.zsh/', copy this file to '~/.zsh/_git',
-# and then add the following to your ~/.zshrc file:
-#
-# fpath=(~/.zsh $fpath)
-#
-# You need git's bash completion script installed. By default bash-completion's
-# location will be used (e.g. pkg-config --variable=completionsdir bash-completion).
-#
-# If your bash completion script is somewhere else, you can specify the
-# location in your ~/.zshrc:
-#
-# zstyle ':completion:*:*:git:*' script ~/.git-completion.bash
+# fpath=($git_completion_srcdir $fpath)
#
zstyle -T ':completion:*:*:git:*' tag-order && \
diff --git a/plugins/gitfast/git-completion.bash b/plugins/gitfast/git-completion.bash
index dd06b5048..8a790ca69 100644
--- a/plugins/gitfast/git-completion.bash
+++ b/plugins/gitfast/git-completion.bash
@@ -1,6 +1,8 @@
# bash/zsh completion support for core Git.
#
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
+# Copyright (c) 2012-2024 Felipe Contreras <felipe.contreras@gmail.com>
+#
# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/).
# Distributed under the GNU General Public License, version 2.0.
#
@@ -58,6 +60,12 @@
#
# When set to "1" suggest all options, including options which are
# typically hidden (e.g. '--allow-empty' for 'git commit').
+#
+# GIT_COMPLETION_IGNORE_CASE
+#
+# When set, uses for-each-ref '--ignore-case' to find refs that match
+# case insensitively, even on systems with case sensitive file systems
+# (e.g., completing tag name "FOO" on "git checkout f<TAB>").
# The following functions are meant to modify COMPREPLY, which should not be
# modified directly. The purpose is to localize the modifications so it's
@@ -320,116 +328,6 @@ else
unset $(compgen -v __gitcomp_builtin_)
fi
-__gitcomp_builtin_add_default=" --dry-run --verbose --interactive --patch --edit --force --update --renormalize --intent-to-add --all --ignore-removal --refresh --ignore-errors --ignore-missing --sparse --chmod= --pathspec-from-file= --pathspec-file-nul --no-dry-run -- --no-verbose --no-interactive --no-patch --no-edit --no-force --no-update --no-renormalize --no-intent-to-add --no-all --no-ignore-removal --no-refresh --no-ignore-errors --no-ignore-missing --no-sparse --no-chmod --no-pathspec-from-file --no-pathspec-file-nul"
-__gitcomp_builtin_am_default=" --interactive --3way --quiet --signoff --utf8 --keep --keep-non-patch --message-id --keep-cr --no-keep-cr --scissors --quoted-cr= --whitespace= --ignore-space-change --ignore-whitespace --directory= --exclude= --include= --patch-format= --reject --resolvemsg= --continue --resolved --skip --abort --quit --show-current-patch --allow-empty --committer-date-is-author-date --ignore-date --rerere-autoupdate --gpg-sign --empty= -- --no-interactive --no-3way --no-quiet --no-signoff --no-utf8 --no-keep --no-keep-non-patch --no-message-id --no-scissors --no-whitespace --no-ignore-space-change --no-ignore-whitespace --no-directory --no-exclude --no-include --no-patch-format --no-reject --no-resolvemsg --no-committer-date-is-author-date --no-ignore-date --no-rerere-autoupdate --no-gpg-sign"
-__gitcomp_builtin_apply_default=" --exclude= --include= --no-add --stat --numstat --summary --check --index --intent-to-add --cached --apply --3way --build-fake-ancestor= --whitespace= --ignore-space-change --ignore-whitespace --reverse --unidiff-zero --reject --allow-overlap --verbose --quiet --inaccurate-eof --recount --directory= --allow-empty --add -- --no-stat --no-numstat --no-summary --no-check --no-index --no-intent-to-add --no-cached --no-apply --no-3way --no-build-fake-ancestor --no-whitespace --no-ignore-space-change --no-ignore-whitespace --no-reverse --no-unidiff-zero --no-reject --no-allow-overlap --no-verbose --no-quiet --no-inaccurate-eof --no-recount --no-directory --no-allow-empty"
-__gitcomp_builtin_archive_default=" --output= --remote= --exec= --no-output -- --no-remote --no-exec"
-__gitcomp_builtin_bisect__helper_default=" --bisect-reset --bisect-next-check --bisect-terms --bisect-start --bisect-next --bisect-state --bisect-log --bisect-replay --bisect-skip --bisect-visualize --bisect-run --no-log --log"
-__gitcomp_builtin_blame_default=" --incremental --root --show-stats --progress --score-debug --show-name --show-number --porcelain --line-porcelain --show-email --ignore-rev= --ignore-revs-file= --color-lines --color-by-age --minimal --contents= --abbrev --no-incremental -- --no-root --no-show-stats --no-progress --no-score-debug --no-show-name --no-show-number --no-porcelain --no-line-porcelain --no-show-email --no-ignore-rev --no-ignore-revs-file --no-color-lines --no-color-by-age --no-minimal --no-contents --no-abbrev"
-__gitcomp_builtin_branch_default=" --verbose --quiet --track --set-upstream-to= --unset-upstream --color --remotes --contains --no-contains --abbrev --all --delete --move --copy --list --show-current --create-reflog --edit-description --merged --no-merged --column --sort= --points-at= --ignore-case --recurse-submodules --format= -- --no-verbose --no-quiet --no-track --no-set-upstream-to --no-unset-upstream --no-color --no-remotes --no-abbrev --no-all --no-delete --no-move --no-copy --no-list --no-show-current --no-create-reflog --no-edit-description --no-column --no-sort --no-points-at --no-ignore-case --no-recurse-submodules --no-format"
-__gitcomp_builtin_bugreport_default=" --output-directory= --suffix= --no-output-directory -- --no-suffix"
-__gitcomp_builtin_cat_file_default=" --allow-unknown-type --batch --batch-check --batch-command --batch-all-objects --buffer --follow-symlinks --unordered --textconv --filters --path= --no-allow-unknown-type -- --no-buffer --no-follow-symlinks --no-unordered --no-path"
-__gitcomp_builtin_check_attr_default=" --all --cached --stdin --no-all -- --no-cached --no-stdin"
-__gitcomp_builtin_check_ignore_default=" --quiet --verbose --stdin --non-matching --no-index --index -- --no-quiet --no-verbose --no-stdin --no-non-matching"
-__gitcomp_builtin_check_mailmap_default=" --stdin --no-stdin"
-__gitcomp_builtin_checkout_default=" --guess --overlay --quiet --recurse-submodules --progress --merge --conflict= --detach --track --orphan= --ignore-other-worktrees --ours --theirs --patch --ignore-skip-worktree-bits --pathspec-from-file= --pathspec-file-nul --no-guess -- --no-overlay --no-quiet --no-recurse-submodules --no-progress --no-merge --no-conflict --no-detach --no-track --no-orphan --no-ignore-other-worktrees --no-patch --no-ignore-skip-worktree-bits --no-pathspec-from-file --no-pathspec-file-nul"
-__gitcomp_builtin_checkout__worker_default=" --prefix= --no-prefix"
-__gitcomp_builtin_checkout_index_default=" --all --ignore-skip-worktree-bits --force --quiet --no-create --index --stdin --temp --prefix= --stage= --create -- --no-all --no-ignore-skip-worktree-bits --no-force --no-quiet --no-index --no-stdin --no-temp --no-prefix"
-__gitcomp_builtin_cherry_default=" --abbrev --verbose --no-abbrev -- --no-verbose"
-__gitcomp_builtin_cherry_pick_default=" --quit --continue --abort --skip --cleanup= --no-commit --edit --signoff --mainline= --rerere-autoupdate --strategy= --strategy-option= --gpg-sign --ff --allow-empty --allow-empty-message --keep-redundant-commits --commit -- --no-cleanup --no-edit --no-signoff --no-mainline --no-rerere-autoupdate --no-strategy --no-strategy-option --no-gpg-sign --no-ff --no-allow-empty --no-allow-empty-message --no-keep-redundant-commits"
-__gitcomp_builtin_clean_default=" --quiet --dry-run --interactive --exclude= --no-quiet -- --no-dry-run --no-interactive"
-__gitcomp_builtin_clone_default=" --verbose --quiet --progress --reject-shallow --no-checkout --bare --mirror --local --no-hardlinks --shared --recurse-submodules --jobs= --template= --reference= --reference-if-able= --dissociate --origin= --branch= --upload-pack= --depth= --shallow-since= --shallow-exclude= --single-branch --no-tags --shallow-submodules --separate-git-dir= --config= --server-option= --ipv4 --ipv6 --filter= --also-filter-submodules --remote-submodules --sparse --checkout --hardlinks --tags -- --no-verbose --no-quiet --no-progress --no-reject-shallow --no-bare --no-mirror --no-local --no-shared --no-recurse-submodules --no-recursive --no-jobs --no-template --no-reference --no-reference-if-able --no-dissociate --no-origin --no-branch --no-upload-pack --no-depth --no-shallow-since --no-shallow-exclude --no-single-branch --no-shallow-submodules --no-separate-git-dir --no-config --no-server-option --no-ipv4 --no-ipv6 --no-filter --no-also-filter-submodules --no-remote-submodules --no-sparse"
-__gitcomp_builtin_column_default=" --command= --mode --raw-mode= --width= --indent= --nl= --padding= --no-command -- --no-mode --no-raw-mode --no-width --no-indent --no-nl --no-padding"
-__gitcomp_builtin_commit_default=" --quiet --verbose --file= --author= --date= --message= --reedit-message= --reuse-message= --fixup= --squash= --reset-author --trailer= --signoff --template= --edit --cleanup= --status --gpg-sign --all --include --interactive --patch --only --no-verify --dry-run --short --branch --ahead-behind --porcelain --long --null --amend --no-post-rewrite --untracked-files --pathspec-from-file= --pathspec-file-nul --verify --post-rewrite -- --no-quiet --no-verbose --no-file --no-author --no-date --no-message --no-reedit-message --no-reuse-message --no-fixup --no-squash --no-reset-author --no-signoff --no-template --no-edit --no-cleanup --no-status --no-gpg-sign --no-all --no-include --no-interactive --no-patch --no-only --no-dry-run --no-short --no-branch --no-ahead-behind --no-porcelain --no-long --no-null --no-amend --no-untracked-files --no-pathspec-from-file --no-pathspec-file-nul"
-__gitcomp_builtin_commit_graph_default=" --object-dir= --no-object-dir"
-__gitcomp_builtin_config_default=" --global --system --local --worktree --file= --blob= --get --get-all --get-regexp --get-urlmatch --replace-all --add --unset --unset-all --rename-section --remove-section --list --fixed-value --edit --get-color --get-colorbool --type= --bool --int --bool-or-int --bool-or-str --path --expiry-date --null --name-only --includes --show-origin --show-scope --default= --no-global -- --no-system --no-local --no-worktree --no-file --no-blob --no-get --no-get-all --no-get-regexp --no-get-urlmatch --no-replace-all --no-add --no-unset --no-unset-all --no-rename-section --no-remove-section --no-list --no-fixed-value --no-edit --no-get-color --no-get-colorbool --no-type --no-null --no-name-only --no-includes --no-show-origin --no-show-scope --no-default"
-__gitcomp_builtin_count_objects_default=" --verbose --human-readable --no-verbose -- --no-human-readable"
-__gitcomp_builtin_credential_cache_default=" --timeout= --socket= --no-timeout -- --no-socket"
-__gitcomp_builtin_credential_cache__daemon_default=" --debug --no-debug"
-__gitcomp_builtin_credential_store_default=" --file= --no-file"
-__gitcomp_builtin_describe_default=" --contains --debug --all --tags --long --first-parent --abbrev --exact-match --candidates= --match= --exclude= --always --dirty --broken --no-contains -- --no-debug --no-all --no-tags --no-long --no-first-parent --no-abbrev --no-exact-match --no-candidates --no-match --no-exclude --no-always --no-dirty --no-broken"
-__gitcomp_builtin_difftool_default=" --gui --dir-diff --no-prompt --symlinks --tool= --tool-help --trust-exit-code --extcmd= --no-index --index -- --no-gui --no-dir-diff --no-symlinks --no-tool --no-tool-help --no-trust-exit-code --no-extcmd"
-__gitcomp_builtin_env__helper_default=" --type= --default= --exit-code --no-default -- --no-exit-code"
-__gitcomp_builtin_fast_export_default=" --progress= --signed-tags= --tag-of-filtered-object= --reencode= --export-marks= --import-marks= --import-marks-if-exists= --fake-missing-tagger --full-tree --use-done-feature --no-data --refspec= --anonymize --anonymize-map= --reference-excluded-parents --show-original-ids --mark-tags --data -- --no-progress --no-signed-tags --no-tag-of-filtered-object --no-reencode --no-export-marks --no-import-marks --no-import-marks-if-exists --no-fake-missing-tagger --no-full-tree --no-use-done-feature --no-refspec --no-anonymize --no-reference-excluded-parents --no-show-original-ids --no-mark-tags"
-__gitcomp_builtin_fetch_default=" --verbose --quiet --all --set-upstream --append --atomic --upload-pack= --force --multiple --tags --jobs= --prefetch --prune --prune-tags --recurse-submodules --dry-run --write-fetch-head --keep --update-head-ok --progress --depth= --shallow-since= --shallow-exclude= --deepen= --unshallow --refetch --update-shallow --refmap= --server-option= --ipv4 --ipv6 --negotiation-tip= --negotiate-only --filter= --auto-maintenance --auto-gc --show-forced-updates --write-commit-graph --stdin --no-verbose -- --no-quiet --no-all --no-set-upstream --no-append --no-atomic --no-upload-pack --no-force --no-multiple --no-tags --no-jobs --no-prefetch --no-prune --no-prune-tags --no-recurse-submodules --no-dry-run --no-write-fetch-head --no-keep --no-update-head-ok --no-progress --no-depth --no-shallow-since --no-shallow-exclude --no-deepen --no-update-shallow --no-server-option --no-ipv4 --no-ipv6 --no-negotiation-tip --no-negotiate-only --no-filter --no-auto-maintenance --no-auto-gc --no-show-forced-updates --no-write-commit-graph --no-stdin"
-__gitcomp_builtin_fmt_merge_msg_default=" --log --message= --into-name= --file= --no-log -- --no-message --no-into-name --no-file"
-__gitcomp_builtin_for_each_ref_default=" --shell --perl --python --tcl --count= --format= --color --sort= --points-at= --merged --no-merged --contains --no-contains --ignore-case -- --no-shell --no-perl --no-python --no-tcl --no-count --no-format --no-color --no-sort --no-points-at --no-ignore-case"
-__gitcomp_builtin_for_each_repo_default=" --config= --no-config"
-__gitcomp_builtin_format_patch_default=" --numbered --no-numbered --signoff --stdout --cover-letter --numbered-files --suffix= --start-number= --reroll-count= --filename-max-length= --rfc --cover-from-description= --subject-prefix= --output-directory= --keep-subject --no-binary --zero-commit --ignore-if-in-upstream --no-stat --add-header= --to= --cc= --from --in-reply-to= --attach --inline --thread --signature= --base= --signature-file= --quiet --progress --interdiff= --range-diff= --creation-factor= --binary -- --no-numbered --no-signoff --no-stdout --no-cover-letter --no-numbered-files --no-suffix --no-start-number --no-reroll-count --no-filename-max-length --no-cover-from-description --no-zero-commit --no-ignore-if-in-upstream --no-add-header --no-to --no-cc --no-from --no-in-reply-to --no-attach --no-thread --no-signature --no-base --no-signature-file --no-quiet --no-progress --no-interdiff --no-range-diff --no-creation-factor"
-__gitcomp_builtin_fsck_default=" --verbose --unreachable --dangling --tags --root --cache --reflogs --full --connectivity-only --strict --lost-found --progress --name-objects --no-verbose -- --no-unreachable --no-dangling --no-tags --no-root --no-cache --no-reflogs --no-full --no-connectivity-only --no-strict --no-lost-found --no-progress --no-name-objects"
-__gitcomp_builtin_fsck_objects_default=" --verbose --unreachable --dangling --tags --root --cache --reflogs --full --connectivity-only --strict --lost-found --progress --name-objects --no-verbose -- --no-unreachable --no-dangling --no-tags --no-root --no-cache --no-reflogs --no-full --no-connectivity-only --no-strict --no-lost-found --no-progress --no-name-objects"
-__gitcomp_builtin_fsmonitor__daemon_default=""
-__gitcomp_builtin_gc_default=" --quiet --prune --aggressive --keep-largest-pack --no-quiet -- --no-prune --no-aggressive --no-keep-largest-pack"
-__gitcomp_builtin_grep_default=" --cached --no-index --untracked --exclude-standard --recurse-submodules --invert-match --ignore-case --word-regexp --text --textconv --recursive --max-depth= --extended-regexp --basic-regexp --fixed-strings --perl-regexp --line-number --column --full-name --files-with-matches --name-only --files-without-match --only-matching --count --color --break --heading --context= --before-context= --after-context= --threads= --show-function --function-context --and --or --not --quiet --all-match --index -- --no-cached --no-untracked --no-exclude-standard --no-recurse-submodules --no-invert-match --no-ignore-case --no-word-regexp --no-text --no-textconv --no-recursive --no-extended-regexp --no-basic-regexp --no-fixed-strings --no-perl-regexp --no-line-number --no-column --no-full-name --no-files-with-matches --no-name-only --no-files-without-match --no-only-matching --no-count --no-color --no-break --no-heading --no-context --no-before-context --no-after-context --no-threads --no-show-function --no-function-context --no-or --no-quiet --no-all-match"
-__gitcomp_builtin_hash_object_default=" --stdin --stdin-paths --no-filters --literally --path= --filters -- --no-stdin --no-stdin-paths --no-literally --no-path"
-__gitcomp_builtin_help_default=" --all --external-commands --aliases --man --web --info --verbose --guides --config --no-external-commands -- --no-aliases --no-man --no-web --no-info --no-verbose"
-__gitcomp_builtin_hook_default=""
-__gitcomp_builtin_init_default=" --template= --bare --shared --quiet --separate-git-dir= --initial-branch= --object-format= --no-template -- --no-bare --no-quiet --no-separate-git-dir --no-initial-branch --no-object-format"
-__gitcomp_builtin_init_db_default=" --template= --bare --shared --quiet --separate-git-dir= --initial-branch= --object-format= --no-template -- --no-bare --no-quiet --no-separate-git-dir --no-initial-branch --no-object-format"
-__gitcomp_builtin_interpret_trailers_default=" --in-place --trim-empty --where= --if-exists= --if-missing= --only-trailers --only-input --unfold --parse --no-divider --trailer= --divider -- --no-in-place --no-trim-empty --no-where --no-if-exists --no-if-missing --no-only-trailers --no-only-input --no-unfold --no-trailer"
-__gitcomp_builtin_log_default=" --quiet --source --use-mailmap --decorate-refs= --decorate-refs-exclude= --decorate --no-quiet -- --no-source --no-use-mailmap --no-mailmap --no-decorate-refs --no-decorate-refs-exclude --no-decorate"
-__gitcomp_builtin_ls_files_default=" --cached --deleted --modified --others --ignored --stage --killed --directory --eol --empty-directory --unmerged --resolve-undo --exclude= --exclude-from= --exclude-per-directory= --exclude-standard --full-name --recurse-submodules --error-unmatch --with-tree= --abbrev --debug --deduplicate --sparse --no-cached -- --no-deleted --no-modified --no-others --no-ignored --no-stage --no-killed --no-directory --no-eol --no-empty-directory --no-unmerged --no-resolve-undo --no-exclude-per-directory --no-recurse-submodules --no-error-unmatch --no-with-tree --no-abbrev --no-debug --no-deduplicate --no-sparse"
-__gitcomp_builtin_ls_remote_default=" --quiet --upload-pack= --tags --heads --refs --get-url --sort= --symref --server-option= --no-quiet -- --no-upload-pack --no-tags --no-heads --no-refs --no-get-url --no-sort --no-symref --no-server-option"
-__gitcomp_builtin_ls_tree_default=" --long --name-only --name-status --object-only --full-name --full-tree --format= --abbrev --no-full-name -- --no-full-tree --no-abbrev"
-__gitcomp_builtin_merge_default=" --stat --summary --log --squash --commit --edit --cleanup= --ff --ff-only --rerere-autoupdate --verify-signatures --strategy= --strategy-option= --message= --file --into-name= --verbose --quiet --abort --quit --continue --allow-unrelated-histories --progress --gpg-sign --autostash --overwrite-ignore --signoff --no-verify --verify -- --no-stat --no-summary --no-log --no-squash --no-commit --no-edit --no-cleanup --no-ff --no-rerere-autoupdate --no-verify-signatures --no-strategy --no-strategy-option --no-message --no-into-name --no-verbose --no-quiet --no-abort --no-quit --no-continue --no-allow-unrelated-histories --no-progress --no-gpg-sign --no-autostash --no-overwrite-ignore --no-signoff"
-__gitcomp_builtin_merge_base_default=" --all --octopus --independent --is-ancestor --fork-point --no-all"
-__gitcomp_builtin_merge_file_default=" --stdout --diff3 --zdiff3 --ours --theirs --union --marker-size= --quiet --no-stdout -- --no-diff3 --no-zdiff3 --no-ours --no-theirs --no-union --no-marker-size --no-quiet"
-__gitcomp_builtin_mktree_default=" --missing --batch --no-missing -- --no-batch"
-__gitcomp_builtin_multi_pack_index_default=" --object-dir= --no-object-dir"
-__gitcomp_builtin_mv_default=" --verbose --dry-run --sparse --no-verbose -- --no-dry-run --no-sparse"
-__gitcomp_builtin_name_rev_default=" --name-only --tags --refs= --exclude= --all --stdin --annotate-stdin --undefined --always --no-name-only -- --no-tags --no-refs --no-exclude --no-all --no-stdin --no-annotate-stdin --no-undefined --no-always"
-__gitcomp_builtin_notes_default=" --ref= --no-ref"
-__gitcomp_builtin_pack_objects_default=" --quiet --progress --all-progress --all-progress-implied --index-version= --max-pack-size= --local --incremental --window= --window-memory= --depth= --reuse-delta --reuse-object --delta-base-offset --threads= --non-empty --revs --unpacked --all --reflog --indexed-objects --stdin-packs --stdout --include-tag --keep-unreachable --pack-loose-unreachable --unpack-unreachable --sparse --thin --shallow --honor-pack-keep --keep-pack= --compression= --keep-true-parents --use-bitmap-index --write-bitmap-index --filter= --missing= --exclude-promisor-objects --delta-islands --uri-protocol= --no-quiet -- --no-progress --no-all-progress --no-all-progress-implied --no-local --no-incremental --no-window --no-depth --no-reuse-delta --no-reuse-object --no-delta-base-offset --no-threads --no-non-empty --no-revs --no-stdin-packs --no-stdout --no-include-tag --no-keep-unreachable --no-pack-loose-unreachable --no-unpack-unreachable --no-sparse --no-thin --no-shallow --no-honor-pack-keep --no-keep-pack --no-compression --no-keep-true-parents --no-use-bitmap-index --no-write-bitmap-index --no-filter --no-exclude-promisor-objects --no-delta-islands --no-uri-protocol"
-__gitcomp_builtin_pack_refs_default=" --all --prune --no-all -- --no-prune"
-__gitcomp_builtin_pickaxe_default=" --incremental --root --show-stats --progress --score-debug --show-name --show-number --porcelain --line-porcelain --show-email --ignore-rev= --ignore-revs-file= --color-lines --color-by-age --minimal --contents= --abbrev --no-incremental -- --no-root --no-show-stats --no-progress --no-score-debug --no-show-name --no-show-number --no-porcelain --no-line-porcelain --no-show-email --no-ignore-rev --no-ignore-revs-file --no-color-lines --no-color-by-age --no-minimal --no-contents --no-abbrev"
-__gitcomp_builtin_prune_default=" --dry-run --verbose --progress --expire= --exclude-promisor-objects --no-dry-run -- --no-verbose --no-progress --no-expire --no-exclude-promisor-objects"
-__gitcomp_builtin_prune_packed_default=" --dry-run --quiet --no-dry-run -- --no-quiet"
-__gitcomp_builtin_pull_default=" --verbose --quiet --progress --recurse-submodules --rebase --stat --log --signoff --squash --commit --edit --cleanup= --ff --ff-only --verify --verify-signatures --autostash --strategy= --strategy-option= --gpg-sign --allow-unrelated-histories --all --append --upload-pack= --force --tags --prune --jobs --dry-run --keep --depth= --shallow-since= --shallow-exclude= --deepen= --unshallow --update-shallow --refmap= --server-option= --ipv4 --ipv6 --negotiation-tip= --show-forced-updates --set-upstream --no-verbose -- --no-quiet --no-progress --no-recurse-submodules --no-rebase --no-stat --no-log --no-signoff --no-squash --no-commit --no-edit --no-cleanup --no-ff --no-verify --no-verify-signatures --no-autostash --no-strategy --no-strategy-option --no-gpg-sign --no-allow-unrelated-histories --no-all --no-append --no-upload-pack --no-force --no-tags --no-prune --no-jobs --no-dry-run --no-keep --no-depth --no-shallow-since --no-shallow-exclude --no-deepen --no-update-shallow --no-server-option --no-ipv4 --no-ipv6 --no-negotiation-tip --no-show-forced-updates --no-set-upstream"
-__gitcomp_builtin_push_default=" --verbose --quiet --repo= --all --mirror --delete --tags --dry-run --porcelain --force --force-with-lease --force-if-includes --recurse-submodules= --receive-pack= --exec= --set-upstream --progress --prune --no-verify --follow-tags --signed --atomic --push-option= --ipv4 --ipv6 --verify -- --no-verbose --no-quiet --no-repo --no-all --no-mirror --no-delete --no-tags --no-dry-run --no-porcelain --no-force --no-force-with-lease --no-force-if-includes --no-recurse-submodules --no-receive-pack --no-exec --no-set-upstream --no-progress --no-prune --no-follow-tags --no-signed --no-atomic --no-push-option --no-ipv4 --no-ipv6"
-__gitcomp_builtin_range_diff_default=" --creation-factor= --no-dual-color --notes --left-only --right-only --patch --no-patch --unified --function-context --raw --patch-with-raw --patch-with-stat --numstat --shortstat --dirstat --cumulative --dirstat-by-file --check --summary --name-only --name-status --stat --stat-width= --stat-name-width= --stat-graph-width= --stat-count= --compact-summary --binary --full-index --color --ws-error-highlight= --abbrev --src-prefix= --dst-prefix= --line-prefix= --no-prefix --inter-hunk-context= --output-indicator-new= --output-indicator-old= --output-indicator-context= --break-rewrites --find-renames --irreversible-delete --find-copies --find-copies-harder --no-renames --rename-empty --follow --minimal --ignore-all-space --ignore-space-change --ignore-space-at-eol --ignore-cr-at-eol --ignore-blank-lines --ignore-matching-lines= --indent-heuristic --patience --histogram --diff-algorithm= --anchored= --word-diff --word-diff-regex= --color-words --color-moved --color-moved-ws= --relative --text --exit-code --quiet --ext-diff --textconv --ignore-submodules --submodule --ita-invisible-in-index --ita-visible-in-index --pickaxe-all --pickaxe-regex --rotate-to= --skip-to= --find-object= --diff-filter= --output= --dual-color -- --no-creation-factor --no-notes --no-left-only --no-right-only --no-function-context --no-compact-summary --no-full-index --no-color --no-abbrev --no-find-copies-harder --no-rename-empty --no-follow --no-minimal --no-ignore-matching-lines --no-indent-heuristic --no-color-moved --no-color-moved-ws --no-relative --no-text --no-exit-code --no-quiet --no-ext-diff --no-textconv"
-__gitcomp_builtin_read_tree_default=" --index-output= --empty --verbose --trivial --aggressive --reset --prefix= --exclude-per-directory= --dry-run --no-sparse-checkout --debug-unpack --recurse-submodules --quiet --sparse-checkout -- --no-empty --no-verbose --no-trivial --no-aggressive --no-reset --no-dry-run --no-debug-unpack --no-recurse-submodules --no-quiet"
-__gitcomp_builtin_rebase_default=" --onto= --keep-base --no-verify --quiet --verbose --no-stat --signoff --committer-date-is-author-date --reset-author-date --ignore-whitespace --whitespace= --force-rebase --no-ff --continue --skip --abort --quit --edit-todo --show-current-patch --apply --merge --interactive --rerere-autoupdate --empty= --autosquash --gpg-sign --autostash --exec= --rebase-merges --fork-point --strategy= --strategy-option= --root --reschedule-failed-exec --reapply-cherry-picks --verify --stat --ff -- --no-onto --no-keep-base --no-quiet --no-verbose --no-signoff --no-committer-date-is-author-date --no-reset-author-date --no-ignore-whitespace --no-whitespace --no-force-rebase --no-rerere-autoupdate --no-autosquash --no-gpg-sign --no-autostash --no-exec --no-rebase-merges --no-fork-point --no-strategy --no-strategy-option --no-root --no-reschedule-failed-exec --no-reapply-cherry-picks"
-__gitcomp_builtin_receive_pack_default=" --quiet --no-quiet"
-__gitcomp_builtin_reflog_default=""
-__gitcomp_builtin_remote_default=" --verbose --no-verbose"
-__gitcomp_builtin_repack_default=" --quiet --local --write-bitmap-index --delta-islands --unpack-unreachable= --keep-unreachable --window= --window-memory= --depth= --threads= --max-pack-size= --pack-kept-objects --keep-pack= --geometric= --write-midx --no-quiet -- --no-local --no-write-bitmap-index --no-delta-islands --no-unpack-unreachable --no-keep-unreachable --no-window --no-window-memory --no-depth --no-threads --no-max-pack-size --no-pack-kept-objects --no-keep-pack --no-geometric --no-write-midx"
-__gitcomp_builtin_replace_default=" --list --delete --edit --graft --convert-graft-file --raw --format= --no-raw -- --no-format"
-__gitcomp_builtin_rerere_default=" --rerere-autoupdate --no-rerere-autoupdate"
-__gitcomp_builtin_reset_default=" --quiet --no-refresh --mixed --soft --hard --merge --keep --recurse-submodules --patch --intent-to-add --pathspec-from-file= --pathspec-file-nul --refresh -- --no-quiet --no-mixed --no-soft --no-hard --no-merge --no-keep --no-recurse-submodules --no-patch --no-intent-to-add --no-pathspec-from-file --no-pathspec-file-nul"
-__gitcomp_builtin_restore_default=" --source= --staged --worktree --ignore-unmerged --overlay --quiet --recurse-submodules --progress --merge --conflict= --ours --theirs --patch --ignore-skip-worktree-bits --pathspec-from-file= --pathspec-file-nul --no-source -- --no-staged --no-worktree --no-ignore-unmerged --no-overlay --no-quiet --no-recurse-submodules --no-progress --no-merge --no-conflict --no-patch --no-ignore-skip-worktree-bits --no-pathspec-from-file --no-pathspec-file-nul"
-__gitcomp_builtin_revert_default=" --quit --continue --abort --skip --cleanup= --no-commit --edit --signoff --mainline= --rerere-autoupdate --strategy= --strategy-option= --gpg-sign --commit -- --no-cleanup --no-edit --no-signoff --no-mainline --no-rerere-autoupdate --no-strategy --no-strategy-option --no-gpg-sign"
-__gitcomp_builtin_rm_default=" --dry-run --quiet --cached --ignore-unmatch --sparse --pathspec-from-file= --pathspec-file-nul --no-dry-run -- --no-quiet --no-cached --no-ignore-unmatch --no-sparse --no-pathspec-from-file --no-pathspec-file-nul"
-__gitcomp_builtin_send_pack_default=" --verbose --quiet --receive-pack= --exec= --remote= --all --dry-run --mirror --force --signed --push-option= --progress --thin --atomic --stateless-rpc --stdin --helper-status --force-with-lease --force-if-includes --no-verbose -- --no-quiet --no-receive-pack --no-exec --no-remote --no-all --no-dry-run --no-mirror --no-force --no-signed --no-push-option --no-progress --no-thin --no-atomic --no-stateless-rpc --no-stdin --no-helper-status --no-force-with-lease --no-force-if-includes"
-__gitcomp_builtin_shortlog_default=" --committer --numbered --summary --email --group= --no-committer -- --no-numbered --no-summary --no-email --no-group"
-__gitcomp_builtin_show_default=" --quiet --source --use-mailmap --decorate-refs= --decorate-refs-exclude= --decorate --no-quiet -- --no-source --no-use-mailmap --no-mailmap --no-decorate-refs --no-decorate-refs-exclude --no-decorate"
-__gitcomp_builtin_show_branch_default=" --all --remotes --color --more --list --no-name --current --sha1-name --merge-base --independent --topo-order --topics --sparse --date-order --reflog --name -- --no-all --no-remotes --no-color --no-more --no-list --no-current --no-sha1-name --no-merge-base --no-independent --no-topo-order --no-topics --no-sparse --no-date-order"
-__gitcomp_builtin_show_index_default=" --object-format= --no-object-format"
-__gitcomp_builtin_show_ref_default=" --tags --heads --verify --head --dereference --hash --abbrev --quiet --exclude-existing --no-tags -- --no-heads --no-verify --no-head --no-dereference --no-hash --no-abbrev --no-quiet"
-__gitcomp_builtin_sparse_checkout_default=""
-__gitcomp_builtin_stage_default=" --dry-run --verbose --interactive --patch --edit --force --update --renormalize --intent-to-add --all --ignore-removal --refresh --ignore-errors --ignore-missing --sparse --chmod= --pathspec-from-file= --pathspec-file-nul --no-dry-run -- --no-verbose --no-interactive --no-patch --no-edit --no-force --no-update --no-renormalize --no-intent-to-add --no-all --no-ignore-removal --no-refresh --no-ignore-errors --no-ignore-missing --no-sparse --no-chmod --no-pathspec-from-file --no-pathspec-file-nul"
-__gitcomp_builtin_stash_default=""
-__gitcomp_builtin_status_default=" --verbose --short --branch --show-stash --ahead-behind --porcelain --long --null --untracked-files --ignored --ignore-submodules --column --no-renames --find-renames --renames -- --no-verbose --no-short --no-branch --no-show-stash --no-ahead-behind --no-porcelain --no-long --no-null --no-untracked-files --no-ignored --no-ignore-submodules --no-column"
-__gitcomp_builtin_stripspace_default=" --strip-comments --comment-lines"
-__gitcomp_builtin_switch_default=" --create= --force-create= --guess --discard-changes --quiet --recurse-submodules --progress --merge --conflict= --detach --track --orphan= --ignore-other-worktrees --no-create -- --no-force-create --no-guess --no-discard-changes --no-quiet --no-recurse-submodules --no-progress --no-merge --no-conflict --no-detach --no-track --no-orphan --no-ignore-other-worktrees"
-__gitcomp_builtin_symbolic_ref_default=" --quiet --delete --short --no-quiet -- --no-delete --no-short"
-__gitcomp_builtin_tag_default=" --list --delete --verify --annotate --message= --file= --edit --sign --cleanup= --local-user= --force --create-reflog --column --contains --no-contains --merged --no-merged --sort= --points-at --format= --color --ignore-case -- --no-annotate --no-file --no-edit --no-sign --no-cleanup --no-local-user --no-force --no-create-reflog --no-column --no-sort --no-points-at --no-format --no-color --no-ignore-case"
-__gitcomp_builtin_update_index_default=" --ignore-submodules --add --replace --remove --unmerged --refresh --really-refresh --cacheinfo --chmod= --assume-unchanged --no-assume-unchanged --skip-worktree --no-skip-worktree --ignore-skip-worktree-entries --info-only --force-remove --stdin --index-info --unresolve --again --ignore-missing --verbose --clear-resolve-undo --index-version= --split-index --untracked-cache --test-untracked-cache --force-untracked-cache --force-write-index --fsmonitor --fsmonitor-valid --no-fsmonitor-valid -- --no-ignore-submodules --no-add --no-replace --no-remove --no-unmerged --no-ignore-skip-worktree-entries --no-info-only --no-force-remove --no-ignore-missing --no-verbose --no-index-version --no-split-index --no-untracked-cache --no-test-untracked-cache --no-force-untracked-cache --no-force-write-index --no-fsmonitor"
-__gitcomp_builtin_update_ref_default=" --no-deref --stdin --create-reflog --deref -- --no-stdin --no-create-reflog"
-__gitcomp_builtin_update_server_info_default=" --force --no-force"
-__gitcomp_builtin_upload_pack_default=" --stateless-rpc --strict --timeout= --no-stateless-rpc -- --no-strict --no-timeout"
-__gitcomp_builtin_verify_commit_default=" --verbose --raw --no-verbose -- --no-raw"
-__gitcomp_builtin_verify_pack_default=" --verbose --stat-only --object-format= --no-verbose -- --no-stat-only --no-object-format"
-__gitcomp_builtin_verify_tag_default=" --verbose --raw --format= --no-verbose -- --no-raw --no-format"
-__gitcomp_builtin_version_default=" --build-options --no-build-options"
-__gitcomp_builtin_whatchanged_default=" --quiet --source --use-mailmap --decorate-refs= --decorate-refs-exclude= --decorate --no-quiet -- --no-source --no-use-mailmap --no-mailmap --no-decorate-refs --no-decorate-refs-exclude --no-decorate"
-__gitcomp_builtin_write_tree_default=" --missing-ok --prefix= --no-missing-ok -- --no-prefix"
-__gitcomp_builtin_send_email_default="--sender= --from= --smtp-auth= --8bit-encoding= --no-format-patch --no-bcc --no-suppress-from --no-annotate --relogin-delay= --no-cc --no-signed-off-cc --no-signed-off-by-cc --no-chain-reply-to --smtp-debug= --smtp-domain= --chain-reply-to --dry-run --compose --bcc= --smtp-user= --thread --cc-cover --identity= --to= --reply-to= --no-cc-cover --suppress-cc= --to-cmd= --smtp-server= --smtp-ssl-cert-path= --no-thread --smtp-server-option= --quiet --batch-size= --envelope-sender= --smtp-ssl --no-to --validate --format-patch --suppress-from --cc= --compose-encoding= --to-cover --in-reply-to= --annotate --smtp-encryption= --cc-cmd= --smtp-server-port= --smtp-pass= --signed-off-cc --signed-off-by-cc --no-xmailer --subject= --no-to-cover --confirm= --transfer-encoding= --no-smtp-auth --sendmail-cmd= --no-validate --no-identity --dump-aliases --xmailer --force --numbered --no-numbered --signoff --stdout --cover-letter --numbered-files --suffix= --start-number= --reroll-count= --filename-max-length= --rfc --cover-from-description= --subject-prefix= --output-directory= --keep-subject --no-binary --zero-commit --ignore-if-in-upstream --no-stat --add-header= --from --attach --inline --signature= --base= --signature-file= --progress --interdiff= --range-diff= --creation-factor= --binary -- --no-signoff --no-stdout --no-cover-letter --no-numbered-files --no-suffix --no-start-number --no-reroll-count --no-filename-max-length --no-cover-from-description --no-zero-commit --no-ignore-if-in-upstream --no-add-header --no-from --no-in-reply-to --no-attach --no-signature --no-base --no-signature-file --no-quiet --no-progress --no-interdiff --no-range-diff --no-creation-factor"
-
-__gitcomp_builtin_get_default ()
-{
- eval "test -n \"\$${1}_default\" && echo \"\$${1}_default\""
-}
-
# This function is equivalent to
#
# __gitcomp_opts "$(git xxx --git-completion-helper) ..."
@@ -457,11 +355,9 @@ __gitcomp_builtin ()
else
completion_helper="--git-completion-helper"
fi
- completion="$(__git ${cmd/_/ } $completion_helper ||
- __gitcomp_builtin_get_default $var)" || return
# leading and trailing spaces are significant to make
# option removal work correctly.
- options=" $incl $completion "
+ options=" $incl $(__git ${cmd/_/ } $completion_helper) " || return
for i in $excl; do
options="${options/ $i / }"
@@ -604,6 +500,7 @@ __git_heads ()
local pfx="${1-}" cur_="${2-}" sfx="${3-}"
__git for-each-ref --format="${pfx//\%/%%}%(refname:strip=2)$sfx" \
+ ${GIT_COMPLETION_IGNORE_CASE+--ignore-case} \
"refs/heads/$cur_*" "refs/heads/$cur_*/**"
}
@@ -617,6 +514,7 @@ __git_remote_heads ()
local pfx="${1-}" cur_="${2-}" sfx="${3-}"
__git for-each-ref --format="${pfx//\%/%%}%(refname:strip=2)$sfx" \
+ ${GIT_COMPLETION_IGNORE_CASE+--ignore-case} \
"refs/remotes/$cur_*" "refs/remotes/$cur_*/**"
}
@@ -627,6 +525,7 @@ __git_tags ()
local pfx="${1-}" cur_="${2-}" sfx="${3-}"
__git for-each-ref --format="${pfx//\%/%%}%(refname:strip=2)$sfx" \
+ ${GIT_COMPLETION_IGNORE_CASE+--ignore-case} \
"refs/tags/$cur_*" "refs/tags/$cur_*/**"
}
@@ -646,6 +545,7 @@ __git_dwim_remote_heads ()
# but only output if the branch name is unique
__git for-each-ref --format="$fer_pfx%(refname:strip=3)$sfx" \
--sort="refname:strip=3" \
+ ${GIT_COMPLETION_IGNORE_CASE+--ignore-case} \
"refs/remotes/*/$cur_*" "refs/remotes/*/$cur_*/**" | \
uniq -u
}
@@ -670,6 +570,7 @@ __git_refs ()
local format refs
local pfx="${3-}" cur_="${4-$cur}" sfx="${5-}"
local match="${4-}"
+ local umatch="${4-}"
local fer_pfx="${pfx//\%/%%}" # "escape" for-each-ref format specifiers
__git_find_repo_path
@@ -693,12 +594,19 @@ __git_refs ()
fi
fi
+ if test "${GIT_COMPLETION_IGNORE_CASE:+1}" = "1"
+ then
+ # uppercase with tr instead of ${match,^^} for bash 3.2 compatibility
+ umatch=$(echo "$match" | tr a-z A-Z 2>/dev/null || echo "$match")
+ fi
+
if [ "$list_refs_from" = path ]; then
if [[ "$cur_" == ^* ]]; then
pfx="$pfx^"
fer_pfx="$fer_pfx^"
cur_=${cur_#^}
match=${match#^}
+ umatch=${umatch#^}
fi
case "$cur_" in
refs|refs/*)
@@ -709,7 +617,7 @@ __git_refs ()
*)
for i in HEAD FETCH_HEAD ORIG_HEAD MERGE_HEAD REBASE_HEAD CHERRY_PICK_HEAD; do
case "$i" in
- $match*)
+ $match*|$umatch*)
if [ -e "$dir/$i" ]; then
echo "$pfx$i$sfx"
fi
@@ -723,6 +631,7 @@ __git_refs ()
;;
esac
__git_dir="$dir" __git for-each-ref --format="$fer_pfx%($format)$sfx" \
+ ${GIT_COMPLETION_IGNORE_CASE+--ignore-case} \
"${refs[@]}"
if [ -n "$track" ]; then
__git_dwim_remote_heads "$pfx" "$match" "$sfx"
@@ -742,15 +651,16 @@ __git_refs ()
*)
if [ "$list_refs_from" = remote ]; then
case "HEAD" in
- $match*) echo "${pfx}HEAD$sfx" ;;
+ $match*|$umatch*) echo "${pfx}HEAD$sfx" ;;
esac
__git for-each-ref --format="$fer_pfx%(refname:strip=3)$sfx" \
+ ${GIT_COMPLETION_IGNORE_CASE+--ignore-case} \
"refs/remotes/$remote/$match*" \
"refs/remotes/$remote/$match*/**"
else
local query_symref
case "HEAD" in
- $match*) query_symref="HEAD" ;;
+ $match*|$umatch*) query_symref="HEAD" ;;
esac
__git ls-remote "$remote" $query_symref \
"refs/tags/$match*" "refs/heads/$match*" \
@@ -888,7 +798,6 @@ __git_list_merge_strategies ()
}'
}
-__git_merge_strategies_default='octopus ours recursive resolve subtree'
__git_merge_strategies=
# 'git merge -s help' (and thus detection of the merge strategy
# list) fails, unfortunately, if run outside of any git working
@@ -898,8 +807,7 @@ __git_merge_strategies=
__git_compute_merge_strategies ()
{
test -n "$__git_merge_strategies" ||
- { __git_merge_strategies=$(__git_list_merge_strategies);
- __git_merge_strategies="${__git_merge_strategies:-__git_merge_strategies_default}"; }
+ __git_merge_strategies=$(__git_list_merge_strategies)
}
__git_merge_strategy_options="ours theirs subtree subtree= patience
@@ -2281,7 +2189,7 @@ _git_reflog ()
fi
}
-__git_send_email_options="--no-cc-cover --cc= --no-bcc --force --relogin-delay= --to= --suppress-cc= --no-annotate --no-chain-reply-to --sendmail-cmd= --no-identity --transfer-encoding= --validate --no-smtp-auth --confirm= --no-format-patch --reply-to= --smtp-pass= --smtp-server= --annotate --envelope-sender= --no-validate --dry-run --no-thread --smtp-debug= --no-to --thread --no-xmailer --identity= --no-signed-off-cc --no-signed-off-by-cc --smtp-domain= --to-cover --8bit-encoding= --bcc= --smtp-ssl-cert-path= --smtp-user= --cc-cmd= --to-cmd= --no-cc --smtp-server-option= --in-reply-to= --subject= --batch-size= --smtp-auth= --compose --smtp-server-port= --xmailer --no-to-cover --chain-reply-to --smtp-encryption= --dump-aliases --quiet --smtp-ssl --signed-off-cc --signed-off-by-cc --suppress-from --compose-encoding= --no-suppress-from --sender= --from= --format-patch --cc-cover --numbered --no-numbered --signoff --stdout --cover-letter --numbered-files --suffix= --start-number= --reroll-count= --filename-max-length= --rfc --cover-from-description= --subject-prefix= --output-directory= --keep-subject --no-binary --zero-commit --ignore-if-in-upstream --no-stat --add-header= --from --attach --inline --signature= --base= --signature-file= --progress --interdiff= --range-diff= --creation-factor= --binary -- --no-signoff --no-stdout --no-cover-letter --no-numbered-files --no-suffix --no-start-number --no-reroll-count --no-filename-max-length --no-cover-from-description --no-zero-commit --no-ignore-if-in-upstream --no-add-header --no-from --no-in-reply-to --no-attach --no-signature --no-base --no-signature-file --no-quiet --no-progress --no-interdiff --no-range-diff --no-creation-factor"
+__gitcomp_builtin_send_email_default="--8bit-encoding= --add-header= --annotate --attach --base= --batch-size= --bcc= --binary --cc-cmd= --cc-cover --cc= --chain-reply-to --compose --compose-encoding= --confirm= --cover-from-description= --cover-letter --creation-factor= --dry-run --dump-aliases --envelope-sender= --filename-max-length= --force --force-in-body-from --format-patch --from --from= --identity= --ignore-if-in-upstream --in-reply-to= --inline --interdiff= --keep-subject --numbered --numbered-files --output-directory= --progress --quiet --range-diff= --relogin-delay= --reply-to= --reroll-count= --rfc --sender= --sendmail-cmd= --signature-file= --signature= --signed-off-by-cc --signed-off-cc --signoff --smtp-auth= --smtp-debug= --smtp-domain= --smtp-encryption= --smtp-pass= --smtp-server-option= --smtp-server-port= --smtp-server= --smtp-ssl --smtp-ssl-cert-path= --smtp-user= --start-number= --stdout --subject-prefix= --subject= --suffix= --suppress-cc= --suppress-from --thread --to-cmd= --to-cover --to= --transfer-encoding= --v= --validate --xmailer --zero-commit -- --no-add-header --no-annotate --no-attach --no-base --no-bcc --no-binary --no-cc --no-cc-cover --no-chain-reply-to --no-cover-from-description --no-cover-letter --no-creation-factor --no-filename-max-length --no-force-in-body-from --no-format-patch --no-from --no-identity --no-ignore-if-in-upstream --no-in-reply-to --no-interdiff --no-numbered --no-numbered-files --no-progress --no-quiet --no-range-diff --no-reroll-count --no-signature --no-signature-file --no-signed-off-by-cc --no-signed-off-cc --no-signoff --no-smtp-auth --no-start-number --no-stat --no-stdout --no-suffix --no-suppress-from --no-thread --no-to --no-to-cover --no-validate --no-xmailer --no-zero-commit"
__git_send_email_confirm_options="always never auto cc compose"
__git_send_email_suppresscc_options="author self cc bodycc sob cccmd body all"
@@ -2321,7 +2229,11 @@ _git_send_email ()
return
;;
--*)
- __gitcomp_builtin send-email "$__git_send_email_options $__git_format_patch_extra_options"
+ # Older versions of git send-email don't have all the options
+ git send-email --git-completion-helper | grep -q annotate ||
+ __gitcomp_builtin_send_email=$__gitcomp_builtin_send_email_default
+
+ __gitcomp_builtin send-email "$__git_format_patch_extra_options"
return
;;
esac
@@ -2456,7 +2368,25 @@ __git_config_vars=
__git_compute_config_vars ()
{
test -n "$__git_config_vars" ||
- __git_config_vars="$(git help --config-for-completion | sort -u)"
+ __git_config_vars="$(git help --config-for-completion)"
+}
+
+__git_compute_config_sections_old ()
+{
+ __git_compute_config_vars
+ echo "$__git_config_vars" |
+ awk -F . '{ dict[$1] = 1 } END { for (e in dict) print e }'
+}
+
+__git_config_sections=
+__git_compute_config_sections ()
+{
+ test -n "$__git_config_sections" ||
+ __git_config_sections="$(
+ git help --config-sections-for-completion > /dev/null 2>&1 &&
+ git help --config-sections-for-completion ||
+ __git_compute_config_sections_old
+ )"
}
# Completes possible values of various configuration variables.
@@ -2670,16 +2600,8 @@ __git_complete_config_variable_name ()
__gitcomp "$__git_config_vars" "" "$cur_" "$sfx"
;;
*)
- __git_compute_config_vars
- __gitcomp_nl "$(echo "$__git_config_vars" |
- awk -F . '{
- sections[$1] = 1
- }
- END {
- for (s in sections)
- print s "."
- }
- ')" "" "$cur_" ""
+ __git_compute_config_sections
+ __gitcomp_nl "$__git_config_sections" "" "$cur_" "."
;;
esac
}
@@ -3628,43 +3550,6 @@ __git_complete ()
___git_complete $1 $func
}
-if ! git --list-cmds=main >/dev/null 2>&1; then
-
- declare -A __git_cmds
- __git_cmds[list-complete]="apply blame cherry config difftool fsck help instaweb mergetool prune reflog remote repack replace request-pull send-email show-branch stage whatchanged"
- __git_cmds[list-guide]="attributes cli core-tutorial credentials cvs-migration diffcore everyday faq glossary hooks ignore mailmap modules namespaces remote-helpers repository-layout revisions submodules tutorial tutorial-2 workflows"
- __git_cmds[list-mainporcelain]="add am archive bisect branch bundle checkout cherry-pick citool clean clone commit describe diff fetch format-patch gc grep gui init log maintenance merge mv notes pull push range-diff rebase reset restore revert rm shortlog show sparse-checkout stash status submodule switch tag worktree gitk"
- __git_cmds[main]="add add--interactive am annotate apply archimport archive bisect bisect--helper blame branch bugreport bundle cat-file check-attr check-ignore check-mailmap check-ref-format checkout checkout--worker checkout-index cherry cherry-pick citool clean clone column commit commit-graph commit-tree config count-objects credential credential-cache credential-cache--daemon credential-store cvsexportcommit cvsimport cvsserver daemon describe diff diff-files diff-index diff-tree difftool difftool--helper env--helper fast-export fast-import fetch fetch-pack filter-branch fmt-merge-msg for-each-ref for-each-repo format-patch fsck fsck-objects fsmonitor--daemon gc get-tar-commit-id grep gui gui--askpass hash-object help hook http-backend http-fetch http-push imap-send index-pack init init-db instaweb interpret-trailers legacy-rebase legacy-stash log ls-files ls-remote ls-tree mailinfo mailsplit maintenance merge merge-base merge-file merge-index merge-octopus merge-one-file merge-ours merge-recursive merge-recursive-ours merge-recursive-theirs merge-resolve merge-subtree merge-tree mergetool mktag mktree multi-pack-index mv name-rev notes p4 pack-objects pack-redundant pack-refs patch-id pickaxe prune prune-packed pull push quiltimport range-diff read-tree rebase rebase--helper receive-pack reflog relink remote remote-ext remote-fd remote-ftp remote-ftps remote-http remote-https remote-testsvn repack replace request-pull rerere reset restore rev-list rev-parse revert rm send-email send-pack serve sh-i18n--envsubst shell shortlog show show-branch show-index show-ref sparse-checkout stage stash status stripspace submodule submodule--helper svn switch symbolic-ref tag unpack-file unpack-objects update-index update-ref update-server-info upload-archive upload-archive--writer upload-pack var verify-commit verify-pack verify-tag version web--browse whatchanged worktree write-tree"
- __git_cmds[others]=""
- __git_cmds[parseopt]="add am apply archive bisect--helper blame branch bugreport cat-file check-attr check-ignore check-mailmap checkout checkout--worker checkout-index cherry cherry-pick clean clone column commit commit-graph config count-objects credential-cache credential-cache--daemon credential-store describe difftool env--helper fast-export fetch fmt-merge-msg for-each-ref for-each-repo format-patch fsck fsck-objects fsmonitor--daemon gc grep hash-object help hook init init-db interpret-trailers log ls-files ls-remote ls-tree merge merge-base merge-file mktree multi-pack-index mv name-rev notes pack-objects pack-refs pickaxe prune prune-packed pull push range-diff read-tree rebase receive-pack reflog remote repack replace rerere reset restore revert rm send-pack shortlog show show-branch show-index show-ref sparse-checkout stage stash status stripspace switch symbolic-ref tag update-index update-ref update-server-info upload-pack verify-commit verify-pack verify-tag version whatchanged write-tree "
-
- # Override __git
- __git ()
- {
- case "$1" in
- --list-cmds=*)
- while read -r -d ',' x; do
- case "$x" in
- nohelpers)
- ;;
- alias)
- ;;
- config)
- ;;
- *)
- echo ${__git_cmds[$x]}
- ;;
- esac
- done <<< "${1##--list-cmds=},"
- return
- ;;
- esac
- git ${__git_C_args:+"${__git_C_args[@]}"} \
- ${__git_dir:+--git-dir="$__git_dir"} "$@" 2>/dev/null
- }
-
-fi
-
___git_complete git __git_main
___git_complete gitk __gitk_main
diff --git a/plugins/gitfast/git-prompt.sh b/plugins/gitfast/git-prompt.sh
index 1435548e0..76ee4ab1e 100644
--- a/plugins/gitfast/git-prompt.sh
+++ b/plugins/gitfast/git-prompt.sh
@@ -84,6 +84,10 @@
# single '?' character by setting GIT_PS1_COMPRESSSPARSESTATE, or omitted
# by setting GIT_PS1_OMITSPARSESTATE.
#
+# If you would like to see a notification on the prompt when there are
+# unresolved conflicts, set GIT_PS1_SHOWCONFLICTSTATE to "yes". The
+# prompt will include "|CONFLICT".
+#
# If you would like to see more information about the identity of
# commits checked out as a detached HEAD, set GIT_PS1_DESCRIBE_STYLE
# to one of these values:
@@ -96,9 +100,7 @@
#
# If you would like a colored hint about the current dirty state, set
# GIT_PS1_SHOWCOLORHINTS to a nonempty value. The colors are based on
-# the colored output of "git status -sb" and are available only when
-# using __git_ps1 for PROMPT_COMMAND or precmd in Bash,
-# but always available in Zsh.
+# the colored output of "git status -sb".
#
# If you would like __git_ps1 to do nothing in the case when the current
# directory is set up to be ignored by git, then set
@@ -255,12 +257,12 @@ __git_ps1_colorize_gitstring ()
local c_lblue='%F{blue}'
local c_clear='%f'
else
- # Using \[ and \] around colors is necessary to prevent
+ # Using \001 and \002 around colors is necessary to prevent
# issues with command line editing/browsing/completion!
- local c_red='\[\e[31m\]'
- local c_green='\[\e[32m\]'
- local c_lblue='\[\e[1;34m\]'
- local c_clear='\[\e[0m\]'
+ local c_red=$'\001\e[31m\002'
+ local c_green=$'\001\e[32m\002'
+ local c_lblue=$'\001\e[1;34m\002'
+ local c_clear=$'\001\e[0m\002'
fi
local bad_color=$c_red
local ok_color=$c_green
@@ -508,6 +510,12 @@ __git_ps1 ()
r="$r $step/$total"
fi
+ local conflict="" # state indicator for unresolved conflicts
+ if [[ "${GIT_PS1_SHOWCONFLICTSTATE}" == "yes" ]] &&
+ [[ $(git ls-files --unmerged 2>/dev/null) ]]; then
+ conflict="|CONFLICT"
+ fi
+
local w=""
local i=""
local s=""
@@ -564,15 +572,12 @@ __git_ps1 ()
b="\${__git_ps1_branch_name}"
fi
- # NO color option unless in PROMPT_COMMAND mode or it's Zsh
if [ -n "${GIT_PS1_SHOWCOLORHINTS-}" ]; then
- if [ $pcmode = yes ] || [ -n "${ZSH_VERSION-}" ]; then
- __git_ps1_colorize_gitstring
- fi
+ __git_ps1_colorize_gitstring
fi
local f="$h$w$i$s$u$p"
- local gitstring="$c$b${f:+$z$f}${sparse}$r${upstream}"
+ local gitstring="$c$b${f:+$z$f}${sparse}$r${upstream}${conflict}"
if [ $pcmode = yes ]; then
if [ "${__git_printf_supports_v-}" != yes ]; then
diff --git a/plugins/gitfast/gitfast.plugin.zsh b/plugins/gitfast/gitfast.plugin.zsh
index a6db0c6bd..c456eff7f 100644
--- a/plugins/gitfast/gitfast.plugin.zsh
+++ b/plugins/gitfast/gitfast.plugin.zsh
@@ -1,6 +1,6 @@
# Handle $0 according to the standard:
# https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html
-0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
+0="${ZERO:-${${0:#$ZSH_ARGZERO}:-${(%):-%N}}}"
0="${${(M)0:#/*}:-$PWD/$0}"
source "${0:A:h}/git-prompt.sh"
diff --git a/plugins/gitfast/update b/plugins/gitfast/update
deleted file mode 100755
index feb13ff7e..000000000
--- a/plugins/gitfast/update
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/sh
-
-url="https://raw.githubusercontent.com/felipec/git-completion"
-version="1.3.7"
-
-curl -s -o _git "${url}/v${version}/git-completion.zsh" &&
-curl -s -o git-completion.bash "${url}/v${version}/git-completion.bash" &&
-curl -s -o git-prompt.sh "${url}/v${version}/git-prompt.sh"
diff --git a/plugins/gnu-utils/gnu-utils.plugin.zsh b/plugins/gnu-utils/gnu-utils.plugin.zsh
index 6023bf2b4..adc2bd3bb 100644
--- a/plugins/gnu-utils/gnu-utils.plugin.zsh
+++ b/plugins/gnu-utils/gnu-utils.plugin.zsh
@@ -14,7 +14,7 @@ __gnu_utils() {
local -a gcmds
local gcmd
- # coreutils
+ # coreutils
gcmds=('g[' 'gbase64' 'gbasename' 'gcat' 'gchcon' 'gchgrp' 'gchmod'
'gchown' 'gchroot' 'gcksum' 'gcomm' 'gcp' 'gcsplit' 'gcut' 'gdate'
'gdd' 'gdf' 'gdir' 'gdircolors' 'gdirname' 'gdu' 'gecho' 'genv' 'gexpand'
@@ -41,7 +41,7 @@ __gnu_utils() {
for gcmd in "${gcmds[@]}"; do
# Do nothing if the command isn't found
(( ${+commands[$gcmd]} )) || continue
-
+
# This method allows for builtin commands to be primary but it's
# lost if hash -r or rehash is executed, or if $PATH is updated.
# Thus, a preexec hook is needed, which will only run if whoami
diff --git a/plugins/golang/README.md b/plugins/golang/README.md
index 128cc7fbb..80f8cf3b5 100644
--- a/plugins/golang/README.md
+++ b/plugins/golang/README.md
@@ -25,6 +25,7 @@ plugins=(... golang)
| goi | `go install` | Compiles and installs packages to $GOPATH |
| gol | `go list` | Lists Go packages |
| gom | `go mod` | Access to operations on modules |
+| gomt | `go mod tidy` | Tidies up the go.mod file |
| gopa | `cd $GOPATH` | Takes you to `$GOPATH` |
| gopb | `cd $GOPATH/bin` | Takes you to `$GOPATH/bin` |
| gops | `cd $GOPATH/src` | Takes you to `$GOPATH/src` |
diff --git a/plugins/golang/golang.plugin.zsh b/plugins/golang/golang.plugin.zsh
index 45ccd3a1c..dc4d91845 100644
--- a/plugins/golang/golang.plugin.zsh
+++ b/plugins/golang/golang.plugin.zsh
@@ -22,6 +22,7 @@ alias goga='go get ./...'
alias goi='go install'
alias gol='go list'
alias gom='go mod'
+alias gomt='go mod tidy'
alias gopa='cd $GOPATH'
alias gopb='cd $GOPATH/bin'
alias gops='cd $GOPATH/src'
diff --git a/plugins/gpg-agent/README.md b/plugins/gpg-agent/README.md
index 8eeb94f92..d66c37a5b 100644
--- a/plugins/gpg-agent/README.md
+++ b/plugins/gpg-agent/README.md
@@ -1,6 +1,11 @@
# gpg-agent
-Enables [GPG's gpg-agent](https://www.gnupg.org/documentation/manuals/gnupg/) if it is not running.
+Applies some fixes for some common issues encountered with [GPG's gpg-agent](https://www.gnupg.org/documentation/manuals/gnupg/).
+
+More specifically, this plugin:
+
+- Updates the `GPG_TTY` environment variable before each shell execution.
+- Updates the `SSH_AUTH_SOCK` environment variable if `enable-ssh-support` is turned on.
To use it, add `gpg-agent` to the plugins array of your zshrc file:
diff --git a/plugins/gradle/LICENSE b/plugins/gradle/LICENSE
new file mode 100644
index 000000000..06edf4af2
--- /dev/null
+++ b/plugins/gradle/LICENSE
@@ -0,0 +1,19 @@
+Copyright (c) 2017 Eric Wendelin
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/plugins/gradle/_gradle b/plugins/gradle/_gradle
index f8df928b4..bbb7353cc 100644
--- a/plugins/gradle/_gradle
+++ b/plugins/gradle/_gradle
@@ -1,28 +1,4 @@
#compdef gradle gradlew gw
-# THE LINE ABOVE MUST BE THE FIRST LINE OF THIS FILE IN ORDER FOR COMPLETION TO WORK
-
-#
-# Taken from https://github.com/gradle/gradle-completion
-# Copyright (c) 2017 Eric Wendelin
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy of
-# this software and associated documentation files (the "Software"), to deal in
-# the Software without restriction, including without limitation the rights to
-# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-# of the Software, and to permit persons to whom the Software is furnished to do
-# so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in all
-# copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-# SOFTWARE.
-# Terms
__gradle-set-project-root-dir() {
local dir=`pwd`
@@ -38,23 +14,23 @@ __gradle-set-project-root-dir() {
}
__gradle-init-cache-dir() {
- cache_dir="$HOME/.gradle/completion"
+ cache_dir="${GRADLE_USER_HOME:-$HOME/.gradle}/completion"
mkdir -p $cache_dir
}
__gradle-set-settings-file() {
- # In order of precedence: --settings-file=filename, settings.gradle, settings.gradle.kts
+ # In order of precedence: settings.gradle, settings.gradle.kts
local default_gradle_settings_file="$project_root_dir/settings.gradle"
if [[ ! -f $default_gradle_settings_file ]]; then
default_gradle_settings_file="$project_root_dir/settings.gradle.kts"
fi
- gradle_settings_file=${${(v)opt_args[(i)-c|--settings-file]}:-$default_gradle_settings_file}
+ gradle_settings_file=$default_gradle_settings_file
}
__gradle-set-build-file() {
__gradle-set-settings-file
- # In order of precedence: --build-file=filename, rootProject.buildFileName, build.gradle, build.gradle.kts
+ # In order of precedence: rootProject.buildFileName, build.gradle, build.gradle.kts
local default_gradle_build_file_name="build.gradle"
if [[ -r $gradle_settings_file ]]; then
@@ -69,8 +45,7 @@ __gradle-set-build-file() {
default_gradle_build_file="$project_root_dir/build.gradle.kts"
fi
- # If a build file is specified after '-b' or '--build-file', use this file.
- gradle_build_file=${${(v)opt_args[(i)-b|--build-file]}:-$default_gradle_build_file}
+ gradle_build_file=$default_gradle_build_file
}
__gradle-set-cache-name() {
@@ -98,7 +73,7 @@ __gradle-generate-script-cache() {
zle -R "Generating Gradle build script cache"
# Cache all Gradle scripts
local -a gradle_build_scripts
- gradle_build_scripts=( $(find $project_root_dir -type f -name "*.gradle" -o -name "*.gradle.kts" 2>/dev/null | egrep -v "$script_exclude_pattern") )
+ gradle_build_scripts=( $(find $project_root_dir -type f -name "*.gradle" -o -name "*.gradle.kts" 2>/dev/null | grep -E -v "$script_exclude_pattern") )
printf "%s\n" "${gradle_build_scripts[@]}" >| $cache_dir/$cache_name
fi
}
@@ -118,14 +93,15 @@ __gradle-generate-tasks-cache() {
# Reuse Gradle Daemon if IDLE but don't start a new one.
local gradle_tasks_output
if [[ ! -z "$($gradle_cmd --status 2>/dev/null | grep IDLE)" ]]; then
- gradle_tasks_output="$($gradle_cmd --daemon --no-scan --build-file $gradle_build_file --console=plain -q tasks --all 2>/dev/null)"
+ gradle_tasks_output="$(cd "$project_root_dir" && "$gradle_cmd" --daemon --no-scan --console=plain -q tasks --all 2>/dev/null)"
else
- gradle_tasks_output="$($gradle_cmd --no-daemon --no-scan --build-file $gradle_build_file --console=plain -q tasks --all 2>/dev/null)"
+ gradle_tasks_output="$(cd "$project_root_dir" && "$gradle_cmd" --no-daemon --no-scan --console=plain -q tasks --all 2>/dev/null)"
fi
+
local gradle_all_tasks="" root_tasks="" subproject_tasks="" output_line
local -a match
for output_line in ${(f)"$(printf "%s\n" "${gradle_tasks_output[@]}")"}; do
- if [[ $output_line =~ ^([[:lower:]][[:alnum:][:punct:]]*)([[:space:]]-[[:space:]]([[:print:]]*))? ]]; then
+ if [[ $output_line =~ ^([[:alpha:]][[:alnum:][:punct:]]*)([[:space:]]-[[:space:]]([[:print:]]*))? ]]; then
local task_name="${match[1]}"
local task_description="${match[3]}"
# Completion for subproject tasks with ':' prefix
@@ -223,106 +199,158 @@ __gradle_subcommand() {
;;
(dependencyInsight)
_arguments \
+ '--all-variants[Show all variants of each dependency]' \
+ '--configuration=[Looks for the dependency in given configuration.]:dependency configuration:_gradle_dependency_configurations' \
'--dependency=[Shows the details of given dependency.]' \
- '--configuration=[Looks for the dependency in given configuration.]:dependency configuration:_gradle_dependency_configurations' && ret=0
+ '--single-path[Show at most one path to each dependency]' && ret=0
;;
(help)
_arguments \
- '--task[The task to show help for.]' && ret=0
+ '--task=[The task to show help for.]' && ret=0
;;
(init)
_arguments \
- '--dsl=[DSL to be used in generated scripts.]:dsl:(groovy kotlin)' \
- '--package=[Package for the generated source.]' \
- '--project-name=[Name of the generated project.]' \
- '--test-framework=[Test framework to be used.]:test framework:(junit kotlintest scalatest spock testng)' \
- '--type=[Project type to generate.]:project type:(basic cpp-application cpp-library groovy-application groovy-library java-application java-library kotlin-application kotlin-library pom scala-library)' && ret=0
+ '--comments[Include clarifying comments in files.]' \
+ '--dsl=[Set the build script DSL to be used in generated scripts.]' \
+ '--incubating[Allow the generated build to use new features and APIs.]' \
+ '--insecure-protocol=[How to handle insecure URLs used for Maven Repositories.]' \
+ '--java-version=[Provides java version to use in the project.]' \
+ '--overwrite[Allow existing files in the build directory to be overwritten?]' \
+ '--package=[Set the package for source files.]' \
+ '--project-name=[Set the project name.]' \
+ '--split-project[Split functionality across multiple subprojects?]' \
+ '--test-framework=[Set the test framework to be used.]' \
+ '--type=[Set the type of project to generate.]' \
+ '--use-defaults[Use default values for options not configured explicitly]' && ret=0
;;
(tasks)
_arguments \
- '--all[List all tasks, including subproject tasks.]' \
- '--group=[Show tasks only from given task group.]' && ret=0
+ '--all[Show additional tasks and detail.]' \
+ '--group=[Show tasks for a specific group.]' \
+ '--groups=[Show tasks for specific groups (can be used multiple times to specify multiple groups).]' \
+ '--types[Show task class types]' && ret=0
;;
(test)
_arguments -C \
- '--debug-jvm[Enable debugging for the test process. The process is started suspended and listening on port 5005. Requires the "java" plugin.]' \
- '--fail-fast[Stops test execution after the first failed test. Requires the "java" plugin.]' \
- '--tests=[Sets test class or method name to be included, * is supported. Requires the "java" plugin.]' \
+ '--debug-jvm[Enable debugging for the test process. The process is started suspended and listening on port 5005.]' \
+ '--fail-fast[Stops test execution after the first failed test.]' \
+ '--test-dry-run[Simulate test execution.]' \
+ '--tests=[Sets test class or method name to be included (in addition to the test task filters), '*' is supported.]' \
'(-)*:: :->task-or-option' && ret=0
;;
(wrapper)
_arguments \
- '--distribution-type=[Binary-only or all with docs and sources]:*:distribution type:(bin all)' \
- '--gradle-version=[Set Gradle version for wrapper]' \
- '--gradle-distribution-sha256-sum=[SHA-256 checksum]' \
- '--gradle-distribution-url=[Set Gradle distribution URL]' && ret=0
+ '--distribution-type=[The type of the Gradle distribution to be used by the wrapper.]:*:distribution type:(bin all)' \
+ '--gradle-distribution-sha256-sum=[The SHA-256 hash sum of the gradle distribution.]' \
+ '--gradle-distribution-url=[The URL to download the Gradle distribution from.]' \
+ '--gradle-version=[The version of the Gradle distribution required by the wrapper. The following labels are allowed: latest, release-candidate, release-milestone, release-nightly, and nightly.]' \
+ '--network-timeout=[Timeout in ms to use when the wrapper is performing network operations.]' \
+ '--validate-url[Sets task to validate the configured distribution url.]' && ret=0
;;
(*)
_arguments -C \
- {-a,--no-rebuild}'[Do not rebuild project dependencies.]' \
- '(--no-build-cache)--build-cache[Enable the Gradle build cache.]' \
- {-b,--build-file}'[Specifies the build file.]:build script:_files -g \*.gradle' \
- {-C,--cache}'[Specifies how compiled build scripts should be cached.]:cache policy:(on rebuild)' \
- {-c,--settings-file}'[Specifies the settings file.]:settings file:_files -g \*.gradle' \
- '(--configuration-cache)--no-configuration-cache[Disables the configuration cache. Gradle will not reuse the build configuration from previous builds.]' \
- '--configuration-cache-problems=[Configures how the configuration cache handles problems]:problem handling:(fail warn)' \
- '(--no-configure-on-demand)--configure-on-demand[Only relevant projects are configured in this build run.]' \
- '(--no-configuration-cache)--configuration-cache[Enables the configuration cache. Gradle will try to reuse the build configuration from previous builds.]' \
- '--console=[Specifies which type of console output to generate.]:console output type:(plain auto rich verbose)' \
- '--continue[Continues task execution after a task failure.]' \
- '-Dorg.gradle.cache.reserved.mb=[Reserve Gradle Daemon memory for operations.]' \
- '-Dorg.gradle.caching=[Set true to enable Gradle build cache.]:enable build cache:(true false)' \
- '-Dorg.gradle.console=[Set type of console output to generate.]:console output type:(plain auto rich verbose)' \
- '-Dorg.gradle.daemon.debug=[Set true to debug Gradle Daemon.]:enable daemon debug:(true false)' \
- '-Dorg.gradle.daemon.idletimeout=[Kill Gradle Daemon after # idle millis.]' \
- '-Dorg.gradle.debug=[Set true to debug Gradle Client.]' \
- '-Dorg.gradle.jvmargs=[Set JVM arguments.]' \
- '-Dorg.gradle.java.home=[Set JDK home dir.]' \
- '-Dorg.gradle.logging.level=[Set default Gradle log level.]:log level:(quiet warn lifecycle info debug)' \
- '-Dorg.gradle.parallel=[Set true to enable parallel project builds.]:enable parallel build:(true false)' \
- '-Dorg.gradle.priority=[Set priority for Gradle worker processes.]:priority:(low normal)' \
- '-Dorg.gradle.unsafe.watch-fs=[Set true to enable Gradle file watcher.]:enable watcher:(true false)' \
- '-Dorg.gradle.warning.mode=[Set types of warnings to log.]:warning level:(all summary none)' \
- '-Dorg.gradle.workers.max=[Set the number of workers Gradle is allowed to use.]' \
- '(-i --info -w --warn -q --quiet)'{-d,--debug}'[Log in debug mode (includes normal stacktrace).]' \
- '(--no-daemon)--daemon[Uses the Gradle daemon to run the build. Starts the daemon if not running.]' \
+ '-Dgradle.user.home=[Specifies the Gradle user home directory. Defaults to ~/.gradle]:gradle.user.home:_directories' \
+ '-Dorg.gradle.caching.debug=[]' \
+ '-Dorg.gradle.caching=[Enables the Gradle build cache. Gradle will try to reuse outputs from previous builds.]:org.gradle.caching:(true false)' \
+ '-Dorg.gradle.configuration-cache.entries-per-key=[]' \
+ '-Dorg.gradle.configuration-cache.fine-grained-property-tracking=[]' \
+ '-Dorg.gradle.configuration-cache.heap-dump-dir=[]:org.gradle.configuration cache.heap dump dir:_directories' \
+ '-Dorg.gradle.configuration-cache.inputs.unsafe.ignore.file-system-checks=[]' \
+ '-Dorg.gradle.configuration-cache.inputs.unsafe.ignore.in-serialization=[]' \
+ '-Dorg.gradle.configuration-cache.integrity-check=[]' \
+ '-Dorg.gradle.configuration-cache.max-problems=[]' \
+ '-Dorg.gradle.configuration-cache.parallel=[]' \
+ '-Dorg.gradle.configuration-cache.problems=[Configures how the configuration cache handles problems (fail or warn). Defaults to fail.]:org.gradle.configuration cache.problems:(fail warn)' \
+ '-Dorg.gradle.configuration-cache.read-only=[]' \
+ '-Dorg.gradle.configuration-cache.unsafe.ignore.unsupported-build-events-listeners=[]' \
+ '-Dorg.gradle.configuration-cache=[Enables the configuration cache. Gradle will try to reuse the build configuration from previous builds.]' \
+ '-Dorg.gradle.configureondemand=[Configure necessary projects only. Gradle will attempt to reduce configuration time for large multi-project builds.]' \
+ '-Dorg.gradle.console=[Specifies which type of console output to generate. Values are 'plain', 'colored', 'auto' (default), 'rich' or 'verbose'.]:org.gradle.console:(plain auto rich verbose)' \
+ '-Dorg.gradle.continue=[Continue task execution after a task failure.]' \
+ '-Dorg.gradle.continuous.quietperiod=[]' \
+ '-Dorg.gradle.daemon.healthcheckinterval=[]' \
+ '-Dorg.gradle.daemon.idletimeout=[]' \
+ '-Dorg.gradle.daemon.registry.base=[]:org.gradle.daemon.registry.base:_directories' \
+ '-Dorg.gradle.daemon=[Uses the Gradle daemon to run the build. Starts the daemon if not running.]' \
+ '-Dorg.gradle.debug.host=[]' \
+ '-Dorg.gradle.debug.port=[]' \
+ '-Dorg.gradle.debug.server=[]' \
+ '-Dorg.gradle.debug.suspend=[]' \
+ '-Dorg.gradle.debug=[]:org.gradle.debug:(true false)' \
+ '-Dorg.gradle.dependency.verification=[Configures the dependency verification mode. Values are 'strict', 'lenient' or 'off'.]:org.gradle.dependency.verification:(strict lenient off)' \
+ '-Dorg.gradle.java.home=[]:org.gradle.java.home:_directories' \
+ '-Dorg.gradle.java.installations.auto-detect=[]' \
+ '-Dorg.gradle.java.installations.auto-download=[]' \
+ '-Dorg.gradle.java.installations.fromEnv=[]' \
+ '-Dorg.gradle.java.installations.idea-jdks-directory=[]:org.gradle.java.installations.idea jdks directory:_directories' \
+ '-Dorg.gradle.java.installations.paths=[]:org.gradle.java.installations.paths:_directories' \
+ '-Dorg.gradle.jvmargs=[]' \
+ '-Dorg.gradle.logging.level=[]:org.gradle.logging.level:(quiet warn info debug)' \
+ '-Dorg.gradle.logging.stacktrace=[]' \
+ '-Dorg.gradle.native=[]' \
+ '-Dorg.gradle.parallel=[Build projects in parallel. Gradle will attempt to determine the optimal number of executor threads to use.]:org.gradle.parallel:(true false)' \
+ '-Dorg.gradle.priority=[Specifies the scheduling priority for the Gradle daemon and all processes launched by it. Values are 'normal' (default) or 'low']:org.gradle.priority:(normal low)' \
+ '-Dorg.gradle.problems.report=[(Experimental) enables HTML problems report]' \
+ '-Dorg.gradle.projectcachedir=[Specify the project-specific cache directory. Defaults to .gradle in the root project directory.]:org.gradle.projectcachedir:_directories' \
+ '-Dorg.gradle.unsafe.isolated-projects=[]' \
+ '-Dorg.gradle.vfs.verbose=[]' \
+ '-Dorg.gradle.vfs.watch=[Enables watching the file system for changes, allowing data about the file system to be re-used for the next build.]:org.gradle.vfs.watch:(true false)' \
+ '-Dorg.gradle.warning.mode=[Specifies which mode of warnings to generate. Values are 'all', 'fail', 'summary'(default) or 'none']' \
+ '-Dorg.gradle.welcome=[]:org.gradle.welcome:(once never)' \
+ '-Dorg.gradle.workers.max=[Configure the number of concurrent workers Gradle is allowed to use.]' \
+ (--no-build-cache)'--build-cache[Enables the Gradle build cache. Gradle will try to reuse outputs from previous builds.]' \
+ (--no-configuration-cache)'--configuration-cache[Enables the configuration cache. Gradle will try to reuse the build configuration from previous builds.]' \
+ '--configuration-cache-problems[Configures how the configuration cache handles problems (fail or warn). Defaults to fail.]:configuration cache problems:(fail warn)' \
+ (--no-configure-on-demand)'--configure-on-demand[Configure necessary projects only. Gradle will attempt to reduce configuration time for large multi-project builds. (incubating)]' \
+ '--console[Specifies which type of console output to generate. Values are 'plain', 'colored', 'auto' (default), 'rich' or 'verbose'.]:console:(plain auto rich verbose)' \
+ (--no-continue)'--continue[Continue task execution after a task failure.]' \
+ {-t,--continuous}'[Enables continuous build. Gradle does not exit and will re-execute tasks when task file inputs change.]' \
+ (--no-daemon)'--daemon[Uses the Gradle daemon to run the build. Starts the daemon if not running.]' \
+ (--quiet,-q,--warn,-w,--info,-i){-d,--debug}'[Log in debug mode (includes normal stacktrace).]' \
+ {-F,--dependency-verification}'[Configures the dependency verification mode. Values are 'strict', 'lenient' or 'off'.]:dependency verification:(strict lenient off)' \
+ {-m,--dry-run}'[Run the builds with all task actions disabled.]' \
+ \*{-x,--exclude-task}'[Specify a task to be excluded from execution.]' \
+ '--export-keys[Exports the public keys used for dependency verification.]' \
'--foreground[Starts the Gradle daemon in the foreground.]' \
- {-g,--gradle-user-home}'[Specifies the gradle user home directory.]:file:_directories' \
- \*--include-build'[Includes the specified build in the composite.]:file:_directories' \
- \*{-I,--init-script}'[Specifies an initialization script.]:init script:_files -g \*.gradle' \
- '(-d --debug -w --warn -q --quiet)'{-i,--info}'[Set log level to info.]' \
- '--max-workers[Set the maximum number of concurrent workers that Gradle may use.]:number workers' \
- {-m,--dry-run}'[Runs the builds with all task actions disabled.]' \
- '--no-color[Do not use color in the console output. (Removed in Gradle 3.0)]' \
- '(--build-cache)--no-build-cache[Do not use the Gradle build cache.]' \
- '(--configure-on-demand)--no-configure-on-demand[Disables configuration on demand.]' \
- '(--daemon)--no-daemon[Do not use the Gradle daemon to run the build.]' \
- '(--parallel)--no-parallel[Disables parallel execution to build projects.]' \
- '(--scan)--no-scan[Do not create a build scan.]' \
- '--offline[The build should operate without accessing network resources.]' \
- \*{-P+,--project-prop}'[Set project property for the build script (e.g. -Pmyprop=myvalue).]:project property (prop=val):' \
- {-p,--project-dir}'[Specifies the start directory for Gradle.]:start directory:_directories' \
- '(--no-parallel)--parallel[Build projects in parallel. Gradle will attempt to determine the optimal number of executor threads to use.]' \
- '--profile[Profiles build execution time and generates a report in the <build_dir>/reports/profile directory.]' \
- '--priority[Set priority for Gradle worker processes.]:priority:(low normal)' \
- '--project-cache-dir[Specifies the project-specific cache directory.]:cache directory:_directories' \
- '(-d --debug -w --warn -i --info)'{-q,--quiet}'[Log errors only.]' \
- '--recompile-scripts[Force build script recompiling.]' \
- '--refresh[Refresh the state of resources of the type(s) specified.]:refresh policy:(dependencies)' \
- '--refresh-dependencies[Refresh the state of dependencies.]' \
+ (--stacktrace,-s){-S,--full-stacktrace}'[Print out the full (very verbose) stacktrace for all exceptions.]' \
+ {-g,--gradle-user-home}'[Specifies the Gradle user home directory. Defaults to ~/.gradle]:gradle user home:_directories' \
+ \*'--include-build[Include the specified build in the composite.]:include build:_directories' \
+ (--quiet,-q,--warn,-w,--debug,-d){-i,--info}'[Set log level to info.]' \
+ \*{-I,--init-script}'[Specify an initialization script.]:init script:_files -g \*.gradle(|.kts)' \
+ '--max-workers[Configure the number of concurrent workers Gradle is allowed to use.]' \
+ (--build-cache)'--no-build-cache[Disables the Gradle build cache.]' \
+ (--configuration-cache)'--no-configuration-cache[Disables the configuration cache.]' \
+ (--configure-on-demand)'--no-configure-on-demand[Disables the use of configuration on demand. (incubating)]' \
+ (--continue)'--no-continue[Stop task execution after a task failure.]' \
+ (--daemon)'--no-daemon[Do not use the Gradle daemon to run the build. Useful occasionally if you have configured Gradle to always run with the daemon by default.]' \
+ (--parallel)'--no-parallel[Disables parallel execution to build projects.]' \
+ (--problems-report)'--no-problems-report[(Experimental) disables HTML problems report]' \
+ {-a,--no-rebuild}'[Do not rebuild project dependencies.]' \
+ (--scan)'--no-scan[Disables the creation of a Build Scan.]' \
+ (--watch-fs)'--no-watch-fs[Disables watching the file system.]' \
+ '--offline[Execute the build without accessing network resources.]' \
+ (--no-parallel)'--parallel[Build projects in parallel. Gradle will attempt to determine the optimal number of executor threads to use.]' \
+ '--priority[Specifies the scheduling priority for the Gradle daemon and all processes launched by it. Values are 'normal' (default) or 'low']' \
+ (--no-problems-report)'--problems-report[(Experimental) enables HTML problems report]' \
+ '--profile[Profile build execution time and generates a report in the <build_dir>/reports/profile directory.]' \
+ '--project-cache-dir[Specify the project-specific cache directory. Defaults to .gradle in the root project directory.]:project cache dir:_directories' \
+ {-p,--project-dir}'[Specifies the start directory for Gradle. Defaults to current directory.]:project dir:_directories' \
+ '--property-upgrade-report[(Experimental) Runs build with experimental property upgrade report.]' \
+ (--warn,-w,--info,-i,--debug,-d){-q,--quiet}'[Log errors only.]' \
+ {-U,--refresh-dependencies}'[Refresh the state of dependencies.]' \
+ '--refresh-keys[Refresh the public keys used for dependency verification.]' \
+ '--rerun[Causes the task to be re-run even if up-to-date.]' \
'--rerun-tasks[Ignore previously cached task results.]' \
- '(--no-scan)--scan[Create a build scan.]' \
- '(-S --full-stacktrace)'{-s,--stacktrace}'[Print out the stacktrace for all exceptions.]' \
- '(-s --stacktrace)'{-S,--full-stacktrace}'[Print out the full (very verbose) stacktrace for all exceptions.]' \
- '--system-prop[system property (prop=val)]' \
- {-t,--continuous}'[Enables continuous build. Gradle does not exit and will re-execute tasks when task file inputs change.]' \
- {-u,--no-search-upward}"[Don't search in parent folders for a settings.gradle file.]" \
- '(--write-locks)--update-locks[Perform a partial update of the dependency lock.]' \
- '(-d --debug -q --quiet -i --info)'{-w,--warn}'[Log warnings and errors only.]' \
- '--warning-mode=[Set types of warnings to log.]:warning mode:(all summary none)' \
- '(--no-watch-fs)--watch-fs[Gradle watches filesystem for incremental builds.]' \
- '(--update-locks)--write-locks[Persists dependency resolution for locked configurations.]' \
- {-x,--exclude-task}'[Specify a task to be excluded from execution.]' && ret=0
+ (--no-scan)'--scan[Generate a Build Scan (powered by Develocity).]' \
+ {-V,--show-version}'[Print version info and continue.]' \
+ (--full-stacktrace,-S){-s,--stacktrace}'[Print out the stacktrace for all exceptions.]' \
+ '--task-graph[(Experimental) Print task graph instead of executing tasks.]' \
+ \*'--update-locks[Perform a partial update of the dependency lock, letting passed in module notations change version. (incubating)]' \
+ (--quiet,-q,--info,-i,--debug,-d){-w,--warn}'[Set log level to warn.]' \
+ '--warning-mode[Specifies which mode of warnings to generate. Values are 'all', 'fail', 'summary'(default) or 'none']:warning mode:(all summary none)' \
+ (--no-watch-fs)'--watch-fs[Enables watching the file system for changes, allowing data about the file system to be re-used for the next build.]' \
+ '--write-locks[Persists dependency resolution for locked configurations, ignoring existing locking information if it exists]' \
+ {-M,--write-verification-metadata}'[Generates checksums for dependencies used in the project (comma-separated list)]' && ret=0
;;
esac
@@ -348,76 +376,113 @@ _gradle() {
typeset -A opt_args
_arguments -C \
- '(-)'{-\?,-h,--help}'[Shows a help message.]' \
- {-a,--no-rebuild}'[Do not rebuild project dependencies.]' \
- '(--no-build-cache)--build-cache[Enable the Gradle build cache.]' \
- {-b,--build-file}'[Specifies the build file.]:build script:_files -g \*.gradle' \
- {-C,--cache}'[Specifies how compiled build scripts should be cached.]:cache policy:(on rebuild)' \
- {-c,--settings-file}'[Specifies the settings file.]:settings file:_files -g \*.gradle:->argument-expected' \
- '(--no-configuration-cache)--configuration-cache[Enables the configuration cache. Gradle will try to reuse the build configuration from previous builds.]' \
- '(--configuration-cache)--no-configuration-cache[Disables the configuration cache. Gradle will not reuse the build configuration from previous builds.]' \
- '--configuration-cache-problems=[Configures how the configuration cache handles problems]:problem handling:(fail warn)' \
- '(--no-configure-on-demand)--configure-on-demand[Only relevant projects are configured in this build run.]' \
- '--console=[Specifies which type of console output to generate.]:console output type:(plain auto rich verbose)' \
- '--continue[Continues task execution after a task failure.]' \
- '-Dorg.gradle.cache.reserved.mb=[Reserve Gradle Daemon memory for operations.]' \
- '-Dorg.gradle.caching=[Set true to enable Gradle build cache.]' \
- '-Dorg.gradle.console=[Set type of console output to generate.]:console output type:(plain auto rich verbose)' \
- '-Dorg.gradle.daemon.debug=[Set true to debug Gradle Daemon.]' \
- '-Dorg.gradle.daemon.idletimeout=[Kill Gradle Daemon after # idle millis.]' \
- '-Dorg.gradle.debug=[Set true to debug Gradle Client.]' \
- '-Dorg.gradle.jvmargs=[Set JVM arguments.]' \
- '-Dorg.gradle.java.home=[Set JDK home dir.]' \
- '-Dorg.gradle.logging.level=[Set default Gradle log level.]:log level:(quiet warn lifecycle info debug)' \
- '-Dorg.gradle.parallel=[Set true to enable parallel project builds.]:(true false)' \
- '-Dorg.gradle.priority=[Set priority for Gradle worker processes.]:priority:(low normal)' \
- '-Dorg.gradle.unsafe.watch-fs=[Set true to enable Gradle file watcher.]:enable watcher:(true false)' \
- '-Dorg.gradle.warning.mode=[Set types of warnings to log.]:warning level:(all summary none)' \
- '-Dorg.gradle.workers.max=[Set the number of workers Gradle is allowed to use.]' \
- '(-i --info -w --warn -q --quiet)'{-d,--debug}'[Log in debug mode (includes normal stacktrace).]' \
- '(--no-daemon)--daemon[Uses the Gradle daemon to run the build. Starts the daemon if not running.]' \
+'-Dgradle.user.home=[Specifies the Gradle user home directory. Defaults to ~/.gradle]:gradle.user.home:_directories:->argument-expected' \
+ '-Dorg.gradle.caching.debug=[]:->argument-expected' \
+ '-Dorg.gradle.caching=[Enables the Gradle build cache. Gradle will try to reuse outputs from previous builds.]:org.gradle.caching:(true false):->argument-expected' \
+ '-Dorg.gradle.configuration-cache.entries-per-key=[]:->argument-expected' \
+ '-Dorg.gradle.configuration-cache.fine-grained-property-tracking=[]:->argument-expected' \
+ '-Dorg.gradle.configuration-cache.heap-dump-dir=[]:org.gradle.configuration cache.heap dump dir:_directories:->argument-expected' \
+ '-Dorg.gradle.configuration-cache.inputs.unsafe.ignore.file-system-checks=[]:->argument-expected' \
+ '-Dorg.gradle.configuration-cache.inputs.unsafe.ignore.in-serialization=[]:->argument-expected' \
+ '-Dorg.gradle.configuration-cache.integrity-check=[]:->argument-expected' \
+ '-Dorg.gradle.configuration-cache.max-problems=[]:->argument-expected' \
+ '-Dorg.gradle.configuration-cache.parallel=[]:->argument-expected' \
+ '-Dorg.gradle.configuration-cache.problems=[Configures how the configuration cache handles problems (fail or warn). Defaults to fail.]:org.gradle.configuration cache.problems:(fail warn):->argument-expected' \
+ '-Dorg.gradle.configuration-cache.read-only=[]:->argument-expected' \
+ '-Dorg.gradle.configuration-cache.unsafe.ignore.unsupported-build-events-listeners=[]:->argument-expected' \
+ '-Dorg.gradle.configuration-cache=[Enables the configuration cache. Gradle will try to reuse the build configuration from previous builds.]:->argument-expected' \
+ '-Dorg.gradle.configureondemand=[Configure necessary projects only. Gradle will attempt to reduce configuration time for large multi-project builds.]:->argument-expected' \
+ '-Dorg.gradle.console=[Specifies which type of console output to generate. Values are 'plain', 'colored', 'auto' (default), 'rich' or 'verbose'.]:org.gradle.console:(plain auto rich verbose):->argument-expected' \
+ '-Dorg.gradle.continue=[Continue task execution after a task failure.]:->argument-expected' \
+ '-Dorg.gradle.continuous.quietperiod=[]:->argument-expected' \
+ '-Dorg.gradle.daemon.healthcheckinterval=[]:->argument-expected' \
+ '-Dorg.gradle.daemon.idletimeout=[]:->argument-expected' \
+ '-Dorg.gradle.daemon.registry.base=[]:org.gradle.daemon.registry.base:_directories:->argument-expected' \
+ '-Dorg.gradle.daemon=[Uses the Gradle daemon to run the build. Starts the daemon if not running.]:->argument-expected' \
+ '-Dorg.gradle.debug.host=[]:->argument-expected' \
+ '-Dorg.gradle.debug.port=[]:->argument-expected' \
+ '-Dorg.gradle.debug.server=[]:->argument-expected' \
+ '-Dorg.gradle.debug.suspend=[]:->argument-expected' \
+ '-Dorg.gradle.debug=[]:org.gradle.debug:(true false):->argument-expected' \
+ '-Dorg.gradle.dependency.verification=[Configures the dependency verification mode. Values are 'strict', 'lenient' or 'off'.]:org.gradle.dependency.verification:(strict lenient off):->argument-expected' \
+ '-Dorg.gradle.java.home=[]:org.gradle.java.home:_directories:->argument-expected' \
+ '-Dorg.gradle.java.installations.auto-detect=[]:->argument-expected' \
+ '-Dorg.gradle.java.installations.auto-download=[]:->argument-expected' \
+ '-Dorg.gradle.java.installations.fromEnv=[]:->argument-expected' \
+ '-Dorg.gradle.java.installations.idea-jdks-directory=[]:org.gradle.java.installations.idea jdks directory:_directories:->argument-expected' \
+ '-Dorg.gradle.java.installations.paths=[]:org.gradle.java.installations.paths:_directories:->argument-expected' \
+ '-Dorg.gradle.jvmargs=[]:->argument-expected' \
+ '-Dorg.gradle.logging.level=[]:org.gradle.logging.level:(quiet warn info debug):->argument-expected' \
+ '-Dorg.gradle.logging.stacktrace=[]:->argument-expected' \
+ '-Dorg.gradle.native=[]:->argument-expected' \
+ '-Dorg.gradle.parallel=[Build projects in parallel. Gradle will attempt to determine the optimal number of executor threads to use.]:org.gradle.parallel:(true false):->argument-expected' \
+ '-Dorg.gradle.priority=[Specifies the scheduling priority for the Gradle daemon and all processes launched by it. Values are 'normal' (default) or 'low']:org.gradle.priority:(normal low):->argument-expected' \
+ '-Dorg.gradle.problems.report=[(Experimental) enables HTML problems report]:->argument-expected' \
+ '-Dorg.gradle.projectcachedir=[Specify the project-specific cache directory. Defaults to .gradle in the root project directory.]:org.gradle.projectcachedir:_directories:->argument-expected' \
+ '-Dorg.gradle.unsafe.isolated-projects=[]:->argument-expected' \
+ '-Dorg.gradle.vfs.verbose=[]:->argument-expected' \
+ '-Dorg.gradle.vfs.watch=[Enables watching the file system for changes, allowing data about the file system to be re-used for the next build.]:org.gradle.vfs.watch:(true false):->argument-expected' \
+ '-Dorg.gradle.warning.mode=[Specifies which mode of warnings to generate. Values are 'all', 'fail', 'summary'(default) or 'none']:->argument-expected' \
+ '-Dorg.gradle.welcome=[]:org.gradle.welcome:(once never):->argument-expected' \
+ '-Dorg.gradle.workers.max=[Configure the number of concurrent workers Gradle is allowed to use.]:->argument-expected' \
+ (--no-build-cache)'--build-cache[Enables the Gradle build cache. Gradle will try to reuse outputs from previous builds.]' \
+ (--no-configuration-cache)'--configuration-cache[Enables the configuration cache. Gradle will try to reuse the build configuration from previous builds.]' \
+ '--configuration-cache-problems[Configures how the configuration cache handles problems (fail or warn). Defaults to fail.]:configuration cache problems:(fail warn):->argument-expected' \
+ (--no-configure-on-demand)'--configure-on-demand[Configure necessary projects only. Gradle will attempt to reduce configuration time for large multi-project builds. (incubating)]' \
+ '--console[Specifies which type of console output to generate. Values are 'plain', 'colored', 'auto' (default), 'rich' or 'verbose'.]:console:(plain auto rich verbose):->argument-expected' \
+ (--no-continue)'--continue[Continue task execution after a task failure.]' \
+ {-t,--continuous}'[Enables continuous build. Gradle does not exit and will re-execute tasks when task file inputs change.]' \
+ (--no-daemon)'--daemon[Uses the Gradle daemon to run the build. Starts the daemon if not running.]' \
+ (--quiet,-q,--warn,-w,--info,-i){-d,--debug}'[Log in debug mode (includes normal stacktrace).]' \
+ {-F,--dependency-verification}'[Configures the dependency verification mode. Values are 'strict', 'lenient' or 'off'.]:dependency verification:(strict lenient off):->argument-expected' \
+ {-m,--dry-run}'[Run the builds with all task actions disabled.]' \
+ \*{-x,--exclude-task}'[Specify a task to be excluded from execution.]' \
+ '--export-keys[Exports the public keys used for dependency verification.]' \
'--foreground[Starts the Gradle daemon in the foreground.]' \
- {-g,--gradle-user-home}'[Specifies the gradle user home directory.]:home directory:_directories:->argument-expected' \
- '(-)--gui[Launches the Gradle GUI. (Removed in Gradle 4.0)]' \
- \*--include-build'[Includes the specified build in the composite.]:file:_directories:->argument-expected' \
- \*{-I,--init-script}'[Specifies an initialization script.]:init script:_files -g \*.gradle:->argument-expected' \
- '(-d --debug -w --warn -q --quiet)'{-i,--info}'[Set log level to info.]' \
- '--max-workers[Set the maximum number of concurrent workers that Gradle may use.]:number workers:->argument-expected' \
- {-m,--dry-run}'[Runs the builds with all task actions disabled.]' \
- '--no-color[Do not use color in the console output. (Removed in Gradle 3.0)]' \
- '(--build-cache)--no-build-cache[Do not use the Gradle build cache.]' \
- '(--configure-on-demand)--no-configure-on-demand[Disables configuration on demand.]' \
- '(--daemon)--no-daemon[Do not use the Gradle daemon to run the build.]' \
- '(--parallel)--no-parallel[Disables parallel execution to build projects.]' \
- '(--scan)--no-scan[Do not create a build scan.]' \
- '--offline[The build should operate without accessing network resources.]' \
- \*{-P+,--project-prop}'[Set project property for the build script (e.g. -Pmyprop=myvalue).]:project property (prop=val):->argument-expected' \
- {-p,--project-dir}'[Specifies the start directory for Gradle.]:start directory:_directories:->argument-expected' \
- '(--no-parallel)--parallel[Build projects in parallel. Gradle will attempt to determine the optimal number of executor threads to use.]' \
- '--priority=[Set priority for Gradle worker processes.]:priority:(low normal)' \
- '--profile[Profiles build execution time and generates a report in the <build_dir>/reports/profile directory.]' \
- '--project-cache-dir=[Specifies the project-specific cache directory.]:cache directory:_directories:->argument-expected' \
- '(-d --debug -w --warn -i --info)'{-q,--quiet}'[Log errors only.]' \
- '--recompile-scripts[Force build script recompiling.]' \
- '--refresh[Refresh the state of resources of the type(s) specified.]:refresh policy:(dependencies)' \
- '--refresh-dependencies[Refresh the state of dependencies.]' \
+ (--stacktrace,-s){-S,--full-stacktrace}'[Print out the full (very verbose) stacktrace for all exceptions.]' \
+ {-g,--gradle-user-home}'[Specifies the Gradle user home directory. Defaults to ~/.gradle]:gradle user home:_directories:->argument-expected' \
+ {-h,--help}'[Shows a help message.]' \
+ \*'--include-build[Include the specified build in the composite.]:include build:_directories:->argument-expected' \
+ (--quiet,-q,--warn,-w,--debug,-d){-i,--info}'[Set log level to info.]' \
+ \*{-I,--init-script}'[Specify an initialization script.]:init script:_files -g \*.gradle(|.kts):->argument-expected' \
+ '--max-workers[Configure the number of concurrent workers Gradle is allowed to use.]:->argument-expected' \
+ (--build-cache)'--no-build-cache[Disables the Gradle build cache.]' \
+ (--configuration-cache)'--no-configuration-cache[Disables the configuration cache.]' \
+ (--configure-on-demand)'--no-configure-on-demand[Disables the use of configuration on demand. (incubating)]' \
+ (--continue)'--no-continue[Stop task execution after a task failure.]' \
+ (--daemon)'--no-daemon[Do not use the Gradle daemon to run the build. Useful occasionally if you have configured Gradle to always run with the daemon by default.]' \
+ (--parallel)'--no-parallel[Disables parallel execution to build projects.]' \
+ (--problems-report)'--no-problems-report[(Experimental) disables HTML problems report]' \
+ {-a,--no-rebuild}'[Do not rebuild project dependencies.]' \
+ (--scan)'--no-scan[Disables the creation of a Build Scan.]' \
+ (--watch-fs)'--no-watch-fs[Disables watching the file system.]' \
+ '--offline[Execute the build without accessing network resources.]' \
+ (--no-parallel)'--parallel[Build projects in parallel. Gradle will attempt to determine the optimal number of executor threads to use.]' \
+ '--priority[Specifies the scheduling priority for the Gradle daemon and all processes launched by it. Values are 'normal' (default) or 'low']:->argument-expected' \
+ (--no-problems-report)'--problems-report[(Experimental) enables HTML problems report]' \
+ '--profile[Profile build execution time and generates a report in the <build_dir>/reports/profile directory.]' \
+ '--project-cache-dir[Specify the project-specific cache directory. Defaults to .gradle in the root project directory.]:project cache dir:_directories:->argument-expected' \
+ {-p,--project-dir}'[Specifies the start directory for Gradle. Defaults to current directory.]:project dir:_directories:->argument-expected' \
+ '--property-upgrade-report[(Experimental) Runs build with experimental property upgrade report.]' \
+ (--warn,-w,--info,-i,--debug,-d){-q,--quiet}'[Log errors only.]' \
+ {-U,--refresh-dependencies}'[Refresh the state of dependencies.]' \
+ '--refresh-keys[Refresh the public keys used for dependency verification.]' \
+ '--rerun[Causes the task to be re-run even if up-to-date.]' \
'--rerun-tasks[Ignore previously cached task results.]' \
- '(--no-scan)--scan[Create a build scan.]' \
- '(-S --full-stacktrace)'{-s,--stacktrace}'[Print out the stacktrace for all exceptions.]' \
- '(-s --stacktrace)'{-S,--full-stacktrace}'[Print out the full (very verbose) stacktrace for all exceptions.]' \
- '(-)--status[Shows status of running and recently stopped Gradle Daemons.]' \
- '(-)--stop[Stops all Gradle daemons.]' \
- '--system-prop[system property (prop=val)]' \
- {-t,--continuous}'[Enables continuous build. Gradle does not exit and will re-execute tasks when task file inputs change.]' \
- {-u,--no-search-upward}"[Don't search in parent folders for a settings.gradle file.]" \
- '(--write-locks)--update-locks[Perform a partial update of the dependency lock.]' \
- '(-)'{-v,--version}'[Print version info.]' \
- '(-d --debug -q --quiet -i --info)'{-w,--warn}'[Log warnings and errors only.]' \
- '--warning-mode=[Set types of warnings to log.]:warning mode:(all summary none)' \
- '(--update-locks)--write-locks[Persists dependency resolution for locked configurations.]' \
- '(--no-watch-fs)--watch-fs[Gradle watches filesystem for incremental builds.]' \
- {-x,--exclude-task}'[Specify a task to be excluded from execution.]' \
- '(-)*:: :->task-or-option' && ret=0
+ (--no-scan)'--scan[Generate a Build Scan (powered by Develocity).]' \
+ {-V,--show-version}'[Print version info and continue.]' \
+ (--full-stacktrace,-S){-s,--stacktrace}'[Print out the stacktrace for all exceptions.]' \
+ '--status[Shows status of running and recently stopped Gradle daemon(s).]' \
+ '--stop[Stops the Gradle daemon if it is running.]' \
+ '--task-graph[(Experimental) Print task graph instead of executing tasks.]' \
+ \*'--update-locks[Perform a partial update of the dependency lock, letting passed in module notations change version. (incubating)]' \
+ {-v,--version}'[Print version info and exit.]' \
+ (--quiet,-q,--info,-i,--debug,-d){-w,--warn}'[Set log level to warn.]' \
+ '--warning-mode[Specifies which mode of warnings to generate. Values are 'all', 'fail', 'summary'(default) or 'none']:warning mode:(all summary none):->argument-expected' \
+ (--no-watch-fs)'--watch-fs[Enables watching the file system for changes, allowing data about the file system to be re-used for the next build.]' \
+ '--write-locks[Persists dependency resolution for locked configurations, ignoring existing locking information if it exists]' \
+ {-M,--write-verification-metadata}'[Generates checksums for dependencies used in the project (comma-separated list)]:->argument-expected' \
+'(-)*:: :->task-or-option' && ret=0
if [[ $words[CURRENT] != -* && $state != "argument-expected" ]]; then
__gradle_tasks && ret=0
diff --git a/plugins/grails/grails.plugin.zsh b/plugins/grails/grails.plugin.zsh
index ddc257428..e5dceb530 100644
--- a/plugins/grails/grails.plugin.zsh
+++ b/plugins/grails/grails.plugin.zsh
@@ -7,7 +7,7 @@ _enumerateGrailsScripts() {
then
directories+=(plugins/*/scripts)
fi
-
+
# Enumerate all of the Groovy files
files=()
for dir in $directories;
@@ -17,13 +17,13 @@ _enumerateGrailsScripts() {
files+=($dir/[^_]*.groovy)
fi
done
-
+
# Don't try to basename ()
if [ ${#files} -eq 0 ];
then
return
fi
-
+
scripts=()
for file in $files
do
@@ -42,19 +42,19 @@ _enumerateGrailsScripts() {
done
echo $scripts
}
-
+
_grails() {
if (( CURRENT == 2 )); then
scripts=( $(_enumerateGrailsScripts) )
-
+
if [ ${#scripts} -ne 0 ];
then
_multi_parts / scripts
return
fi
fi
-
+
_files
}
-
+
compdef _grails grails
diff --git a/plugins/grc/grc.plugin.zsh b/plugins/grc/grc.plugin.zsh
index 55ffc1a1e..fc6ecc8ac 100644
--- a/plugins/grc/grc.plugin.zsh
+++ b/plugins/grc/grc.plugin.zsh
@@ -5,6 +5,7 @@ files=(
/etc/grc.zsh # default
/usr/local/etc/grc.zsh # homebrew darwin-x64
/opt/homebrew/etc/grc.zsh # homebrew darwin-arm64
+ /home/linuxbrew/.linuxbrew/etc/grc.zsh # linuxbrew
/usr/share/grc/grc.zsh # Gentoo Linux (app-misc/grc)
)
diff --git a/plugins/helm/README.md b/plugins/helm/README.md
index 8be024bfb..dcbb30b6c 100644
--- a/plugins/helm/README.md
+++ b/plugins/helm/README.md
@@ -10,9 +10,10 @@ plugins=(... helm)
## Aliases
-| Alias | Full command |
-| ----- | ------------ |
-| h | helm |
-| hin | helm install |
-| hse | helm search |
-| hup | helm upgrade |
+| Alias | Full command |
+| ----- | -------------- |
+| h | helm |
+| hin | helm install |
+| hun | helm uninstall |
+| hse | helm search |
+| hup | helm upgrade |
diff --git a/plugins/helm/helm.plugin.zsh b/plugins/helm/helm.plugin.zsh
index 7fc05be98..e754a6541 100644
--- a/plugins/helm/helm.plugin.zsh
+++ b/plugins/helm/helm.plugin.zsh
@@ -14,5 +14,6 @@ fi
alias h='helm'
alias hin='helm install'
+alias hun='helm uninstall'
alias hse='helm search'
alias hup='helm upgrade'
diff --git a/plugins/heroku-alias/README.md b/plugins/heroku-alias/README.md
index 4b7b953fd..4ecb07a23 100644
--- a/plugins/heroku-alias/README.md
+++ b/plugins/heroku-alias/README.md
@@ -1,127 +1,140 @@
# heroku-alias
-🧬 Full alias for heroku cli
-|🚀 last maj|📡 source|
-|---|---|
-|02/06/2020|[heroku cli doc](https://devcenter.heroku.com/articles/heroku-cli-commands)|
+Full alias list for Heroku CLI.
-# Alias list
+To use it, add `heroku-alias` to the plugins array in your zshrc file:
-## general
-| Alias | Command |
-| ------------- | ------------- |
-| h | heroku |
+```zsh
+plugins=(... heroku-alias)
+```
+
+## Requirements
+
+- [Heroku CLI](https://devcenter.heroku.com/articles/heroku-cli)
+
+| 🚀 last maj | 📡 source |
+| ---------- | --------------------------------------------------------------------------- |
+| 02/06/2020 | [heroku cli doc](https://devcenter.heroku.com/articles/heroku-cli-commands) |
+
+## Aliases
+
+### general
+
+| Alias | Command |
+| ----- | ---------------------------------- |
+| h | heroku |
| hauto | heroku autocomplete $(echo $SHELL) |
-| hl | heroku local |
+| hl | heroku local |
-## config
-| Alias | Command |
-| ------------- | ------------- |
-| hc | heroku config |
-| hca | heroku config -a |
-| hcr | heroku config -r |
-| hcs | heroku config:set |
-| hcu | heroku config:unset |
-| hcfile | function hcfile bellow |
+### config
-```sh
-hcfile() {
- echo " Which platform [-r/a name] ? "
- read platform
- echo " Which file ? "
- read file
- while read line;
- do heroku config:set "$platform" "$line";
- done < "$file"
-}
-```
+| Alias | Command |
+| ------ | ---------------------- |
+| hc | heroku config |
+| hca | heroku config -a |
+| hcr | heroku config -r |
+| hcs | heroku config:set |
+| hcu | heroku config:unset |
+
+Also, you can use the `hcfile` function to set multiple config variables from a file,
+which asks you for a platform and a config file to read the configuration from.
+
+### apps and favorites
-## apps and favorites
-| Alias | Command |
-| ------------- | ------------- |
-| ha | heroku apps |
-| hpop | heroku create |
-| hkill | heroku apps:destroy |
-| hlog | heroku apps:errors |
-| hfav | heroku apps:favorites |
-| hfava | heroku apps:favorites:add |
+| Alias | Command |
+| ----- | ---------------------------- |
+| ha | heroku apps |
+| hpop | heroku create |
+| hkill | heroku apps:destroy |
+| hlog | heroku apps:errors |
+| hfav | heroku apps:favorites |
+| hfava | heroku apps:favorites:add |
| hfavr | heroku apps:favorites:remove |
-| hai | heroku apps:info |
-| hair | heroku apps:info -r |
-| haia | heroku apps:info -a |
+| hai | heroku apps:info |
+| hair | heroku apps:info -r |
+| haia | heroku apps:info -a |
-# auth
-| Alias | Command |
-| ------------- | ------------- |
-| h2fa | heroku auth:2fa |
+## auth
+
+| Alias | Command |
+| ----- | ----------------------- |
+| h2fa | heroku auth:2fa |
| h2far | heroku auth:2fa:disable |
-# access
-| Alias | Command |
-| ------------- | ------------- |
-| hac | heroku access |
-| hacr | heroku access -r |
-| haca | heroku access -a |
-| hadd | heroku access:add |
-| hdel | heroku access:remove |
-| hup | heroku access:update |
+## access
+
+| Alias | Command |
+| ----- | -------------------- |
+| hac | heroku access |
+| hacr | heroku access -r |
+| haca | heroku access -a |
+| hadd | heroku access:add |
+| hdel | heroku access:remove |
+| hup | heroku access:update |
+
+### addons
-## addons
-| Alias | Command |
-| ------------- | ------------- |
-| hads | heroku addons -A |
-| hada | heroku addons -a |
-| hadr | heroku addons -r |
-| hadat | heroku addons:attach |
-| hadc | heroku addons:create |
+| Alias | Command |
+| ----- | --------------------- |
+| hads | heroku addons -A |
+| hada | heroku addons -a |
+| hadr | heroku addons -r |
+| hadat | heroku addons:attach |
+| hadc | heroku addons:create |
| hadel | heroku addons:destroy |
-| hadde | heroku addons:detach |
-| hadoc | heroku addons:docs |
+| hadde | heroku addons:detach |
+| hadoc | heroku addons:docs |
+
+### login
+
+| Alias | Command |
+| ----- | ------------------ |
+| hin | heroku login |
+| hout | heroku logout |
+| hi | heroku login -i |
+| hwho | heroku auth:whoami |
-## login
-| Alias | Command |
-| ------------- | ------------- |
-| hin | heroku login |
-| hout | heroku logout |
-| hi | heroku login -i |
-| hwho | heroku auth:whoami |
+### authorizations
-## authorizations
-| Alias | Command |
-| ------------- | ------------- |
-| hth | heroku authorizations |
+| Alias | Command |
+| ------ | ---------------------------- |
+| hth | heroku authorizations |
| hthadd | heroku authorizations:create |
-| hthif | heroku authorizations:info |
+| hthif | heroku authorizations:info |
| hthdel | heroku authorizations:revoke |
| hthrot | heroku authorizations:rotate |
-| hthup | heroku authorizations:update |
+| hthup | heroku authorizations:update |
+
+### plugins
+
+| Alias | Command |
+| ----- | -------------- |
+| hp | heroku plugins |
+
+### log
+
+| Alias | Command |
+| ----- | --------------- |
+| hg | heroku logs |
+| hgt | heroku log tail |
-## plugins
-| Alias | Command |
-| ------------- | ------------- |
-| hp | heroku plugins |
+### database
-# log
-| Alias | Command |
-| ------------- | ------------- |
-|hg | heroku logs|
-| hgt | heroku log tail |
+| Alias | Command |
+| ----- | -------------------------- |
+| hpg | heroku pg |
+| hpsql | heroku pg:psql |
+| hpb | heroku pg:backups |
+| hpbc | heroku pg:backups:capture |
+| hpbd | heroku pg:backups:download |
+| hpbr | heroku pg:backups:restore |
-# database
-| Alias | Command |
-| ------------- | ------------- |
-| hpg | heroku pg |
-| hpsql | heroku pg:psql |
-| hpb | heroku pg:backups |
-| hpbc | heroku pg:backups:capture |
-| hpbd | heroku pg:backups:download |
-| hpbr | heroku pg:backups:restore |
+### certs
-# certs
-| Alias | Command |
-| ------------- | ------------- |
-| hssl | heroku certs |
-| hssli | heroku certs:info |
-| hssla | heroku certs:add |
+| Alias | Command |
+| ----- | ------------------- |
+| hssl | heroku certs |
+| hssli | heroku certs:info |
+| hssla | heroku certs:add |
| hsslu | heroku certs:update |
| hsslr | heroku certs:remove |
diff --git a/plugins/heroku-alias/heroku.alias.sh b/plugins/heroku-alias/heroku-alias.plugin.zsh
index 7daf715b5..7daf715b5 100644
--- a/plugins/heroku-alias/heroku.alias.sh
+++ b/plugins/heroku-alias/heroku-alias.plugin.zsh
diff --git a/plugins/history-substring-search/README.md b/plugins/history-substring-search/README.md
index 6d8b56425..71a389535 100644
--- a/plugins/history-substring-search/README.md
+++ b/plugins/history-substring-search/README.md
@@ -23,7 +23,15 @@ Install
Using the [Homebrew]( https://brew.sh ) package manager:
brew install zsh-history-substring-search
- echo 'source /usr/local/share/zsh-history-substring-search/zsh-history-substring-search.zsh' >> ~/.zshrc
+ echo 'source $(brew --prefix)/share/zsh-history-substring-search/zsh-history-substring-search.zsh' >> ~/.zshrc
+
+Using [Fig](https://fig.io):
+
+Fig adds apps, shortcuts, and autocomplete to your existing terminal.
+
+Install `zsh-history-substring-search` in just one click.
+
+<a href="https://fig.io/plugins/other/zsh-history-substring-search" target="_blank"><img src="https://fig.io/badges/install-with-fig.svg" /></a>
Using [Oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh):
@@ -33,24 +41,63 @@ Using [Oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh):
2. Activate the plugin in `~/.zshrc`:
- plugins=( [plugins...] history-substring-search)
+ plugins=( [plugins...] zsh-history-substring-search)
+
+3. Run `exec zsh` to take changes into account:
+
+ exec zsh
+
+Using [zplug](https://github.com/zplug/zplug):
+
+1. Add this repo to `~/.zshrc`:
+
+ zplug "zsh-users/zsh-history-substring-search", as: plugin
+
+Using [antigen](https://github.com/zsh-users/antigen):
+
+1. Add the `antigen bundle` command just before `antigen apply`, like this:
+
+```
+antigen bundle zsh-users/zsh-history-substring-search
+antigen apply
+```
+
+2. Then, **after** `antigen apply`, add the key binding configurations, like this:
+
+```
+# zsh-history-substring-search configuration
+bindkey '^[[A' history-substring-search-up # or '\eOA'
+bindkey '^[[B' history-substring-search-down # or '\eOB'
+HISTORY_SUBSTRING_SEARCH_ENSURE_UNIQUE=1
+```
+
+Using [Zinit](https://github.com/zdharma-continuum/zinit):
-3. Source `~/.zshrc` to take changes into account:
+1. Use the `Oh-my-zsh` Zinit snippet in `~/.zshrc`:
- source ~/.zshrc
+ zinit snippet OMZ::plugins/git/git.plugin.zsh`
+
+2. Load the plugin in `~/.zshrc`:
+
+ zinit load 'zsh-users/zsh-history-substring-search
+ zinit ice wait atload'_history_substring_search_config'
+
+3. Run `exec zsh` to take changes into account:
+
+ exec zsh
Usage
------------------------------------------------------------------------------
1. Load this script into your interactive ZSH session:
- % source zsh-history-substring-search.zsh
+ source zsh-history-substring-search.zsh
If you want to use [zsh-syntax-highlighting][6] along with this script,
then make sure that you load it *before* you load this script:
- % source zsh-syntax-highlighting.zsh
- % source zsh-history-substring-search.zsh
+ source zsh-syntax-highlighting.zsh
+ source zsh-history-substring-search.zsh
2. Bind keyboard shortcuts to this script's functions.
@@ -73,6 +120,10 @@ Usage
bindkey "$terminfo[kcuu1]" history-substring-search-up
bindkey "$terminfo[kcud1]" history-substring-search-down
+ Users have also observed that `[OA` and `[OB` are correct values,
+ _even if_ these were not the observed values. If you are having trouble
+ with the observed values, give these a try.
+
You might also want to bind the Control-P/N keys for use in EMACS mode:
bindkey -M emacs '^P' history-substring-search-up
@@ -115,7 +166,7 @@ Configuration
------------------------------------------------------------------------------
This script defines the following global variables. You may override their
-default values only after having loaded this script into your ZSH session.
+default values.
* `HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND` is a global variable that defines
how the query should be highlighted inside a matching command. Its default
@@ -141,6 +192,12 @@ default values only after having loaded this script into your ZSH session.
value, causes this script to perform a fuzzy search by words, matching in
given order e.g. `ab c` will match `*ab*c*`
+* `HISTORY_SUBSTRING_SEARCH_PREFIXED` is a global variable that defines how
+ the command history will be searched for your query. If set to a non-empty
+ value, your query will be matched against the start of each history entry.
+ For example, if this variable is empty, `ls` will match `ls -l` and `echo
+ ls`; if it is non-empty, `ls` will only match `ls -l`.
+
* `HISTORY_SUBSTRING_SEARCH_ENSURE_UNIQUE` is a global variable that defines
whether all search results returned are _unique_. If set to a non-empty
value, then only unique search results are presented. This behaviour is off
@@ -155,6 +212,9 @@ default values only after having loaded this script into your ZSH session.
receive globally unique search results only once, then use this
configuration variable, or use `setopt HIST_IGNORE_ALL_DUPS`.
+* `HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_TIMEOUT` is a global variable that
+ defines a timeout in seconds for clearing the search highlight.
+
History
------------------------------------------------------------------------------
@@ -175,24 +235,17 @@ History
* March 2016: Geza Lore (@gezalore) greatly refactored it in pull request #55.
-------------------------------------------------------------------------------
-Oh My Zsh Distribution Notes
-------------------------------------------------------------------------------
-
-What you are looking at now is Oh My Zsh's repackaging of zsh-history-substring-search
-as an OMZ module inside the Oh My Zsh distribution.
+---
-The upstream repo, zsh-users/zsh-history-substring-search, can be found on GitHub at
-https://github.com/zsh-users/zsh-history-substring-search.
-
-This downstream copy was last updated from the following upstream commit:
+## Oh My Zsh Distribution Notes
- SHA: 0f80b8eb3368b46e5e573c1d91ae69eb095db3fb
- Commit date: 2019-05-12 17:35:54 -0700
+What you are looking at now is Oh My Zsh's repackaging of zsh-history-substring-search as an OMZ module inside
+the Oh My Zsh distribution.
-Everything above this section is a copy of the original upstream's README, so things
-may differ slightly when you're using this inside OMZ. In particular, you do not
-need to set up key bindings for the up and down arrows yourself in `~/.zshrc`; the OMZ
-plugin does that for you. You may still want to set up additional emacs- or vi-specific
-bindings as mentioned above.
+The upstream repo, zsh-users/zsh-history-substring-search, can be found on GitHub at
+https://github.com/zsh-users/zsh-history-substring-search.
+Everything above this section is a copy of the original upstream's README, so things may differ slightly when
+you're using this inside OMZ. In particular, you do not need to set up key bindings for the up and down arrows
+yourself in `~/.zshrc`; the OMZ plugin does that for you. You may still want to set up additional emacs- or
+vi-specific bindings as mentioned above.
diff --git a/plugins/history-substring-search/dependencies/OMZ-README.md b/plugins/history-substring-search/dependencies/OMZ-README.md
new file mode 100644
index 000000000..c5967bb7d
--- /dev/null
+++ b/plugins/history-substring-search/dependencies/OMZ-README.md
@@ -0,0 +1,15 @@
+
+---
+
+## Oh My Zsh Distribution Notes
+
+What you are looking at now is Oh My Zsh's repackaging of zsh-history-substring-search as an OMZ module inside
+the Oh My Zsh distribution.
+
+The upstream repo, zsh-users/zsh-history-substring-search, can be found on GitHub at
+https://github.com/zsh-users/zsh-history-substring-search.
+
+Everything above this section is a copy of the original upstream's README, so things may differ slightly when
+you're using this inside OMZ. In particular, you do not need to set up key bindings for the up and down arrows
+yourself in `~/.zshrc`; the OMZ plugin does that for you. You may still want to set up additional emacs- or
+vi-specific bindings as mentioned above.
diff --git a/plugins/history-substring-search/history-substring-search.plugin.zsh b/plugins/history-substring-search/history-substring-search.plugin.zsh
index 63f0bdd42..077105ea3 100644
--- a/plugins/history-substring-search/history-substring-search.plugin.zsh
+++ b/plugins/history-substring-search/history-substring-search.plugin.zsh
@@ -16,4 +16,3 @@ if [[ -n "$terminfo[kcud1]" ]]; then
bindkey -M emacs "$terminfo[kcud1]" history-substring-search-down
bindkey -M viins "$terminfo[kcud1]" history-substring-search-down
fi
-
diff --git a/plugins/history-substring-search/history-substring-search.zsh b/plugins/history-substring-search/history-substring-search.zsh
index c326778d4..db516f580 100644
--- a/plugins/history-substring-search/history-substring-search.zsh
+++ b/plugins/history-substring-search/history-substring-search.zsh
@@ -43,11 +43,19 @@
# declare global configuration variables
#-----------------------------------------------------------------------------
-typeset -g HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND='bg=magenta,fg=white,bold'
-typeset -g HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND='bg=red,fg=white,bold'
-typeset -g HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS='i'
-typeset -g HISTORY_SUBSTRING_SEARCH_ENSURE_UNIQUE=''
-typeset -g HISTORY_SUBSTRING_SEARCH_FUZZY=''
+: ${HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND='bg=magenta,fg=white,bold'}
+: ${HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND='bg=red,fg=white,bold'}
+
+# Respect CASE_SENSITIVE setting for case sensitivity
+if [[ "$CASE_SENSITIVE" = true ]]; then
+ : ${HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS=''}
+else
+ : ${HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS='i'}
+fi
+
+: ${HISTORY_SUBSTRING_SEARCH_ENSURE_UNIQUE=''}
+: ${HISTORY_SUBSTRING_SEARCH_FUZZY=''}
+: ${HISTORY_SUBSTRING_SEARCH_PREFIXED=''}
#-----------------------------------------------------------------------------
# declare internal global variables
@@ -64,6 +72,7 @@ typeset -g -i _history_substring_search_raw_match_index
typeset -g -a _history_substring_search_matches
typeset -g -i _history_substring_search_match_index
typeset -g -A _history_substring_search_unique_filter
+typeset -g -i _history_substring_search_zsh_5_9
#-----------------------------------------------------------------------------
# the main ZLE widgets
@@ -97,6 +106,11 @@ zle -N history-substring-search-down
#-----------------------------------------------------------------------------
zmodload -F zsh/parameter
+autoload -Uz is-at-least
+
+if is-at-least 5.9 $ZSH_VERSION; then
+ _history_substring_search_zsh_5_9=1
+fi
#
# We have to "override" some keys and widgets if the
@@ -117,80 +131,125 @@ if [[ $+functions[_zsh_highlight] -eq 0 ]]; then
}
#
- # The following snippet was taken from the zsh-syntax-highlighting project:
- #
- # https://github.com/zsh-users/zsh-syntax-highlighting/blob/56b134f5d62ae3d4e66c7f52bd0cc2595f9b305b/zsh-syntax-highlighting.zsh#L126-161
- #
- # Copyright (c) 2010-2011 zsh-syntax-highlighting contributors
- # All rights reserved.
+ # Check if $1 denotes the name of a callable function, i.e. it is fully
+ # defined or it is marked for autoloading and autoloading it at the first
+ # call to it will succeed. In particular, if $1 has been marked for
+ # autoloading but is not available in $fpath, then it will return 1 (false).
#
- # Redistribution and use in source and binary forms, with or without
- # modification, are permitted provided that the following conditions are
- # met:
+ # This is based on the zsh-syntax-highlighting plugin.
#
- # * 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-syntax-highlighting contributors nor the
- # names of its contributors may be used to endorse or promote products
- # derived from this software without specific prior written permission.
+ _history-substring-search-function-callable() {
+ if (( ${+functions[$1]} )) && ! [[ "$functions[$1]" == *"builtin autoload -X"* ]]; then
+ return 0 # already fully loaded
+ else
+ # "$1" is either an autoload stub, or not a function at all.
+ # We expect 'autoload +X' to return non-zero if it fails to fully load
+ # the function.
+ ( autoload -U +X -- "$1" 2>/dev/null )
+ return $?
+ fi
+ }
+
#
- # 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 THE COPYRIGHT HOLDER OR
- # CONTRIBUTORS 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.
+ # The zsh-syntax-highlighting plugin uses zle-line-pre-redraw hook instead
+ # of the legacy "bind all widgets" if 1) zsh has the memo= feature (added in
+ # version 5.9) and 2) add-zle-hook-widget is available.
#
- #--------------8<-------------------8<-------------------8<-----------------
- # Rebind all ZLE widgets to make them invoke _zsh_highlights.
- _zsh_highlight_bind_widgets()
- {
- # Load ZSH module zsh/zleparameter, needed to override user defined widgets.
- zmodload zsh/zleparameter 2>/dev/null || {
- echo 'zsh-syntax-highlighting: failed loading zsh/zleparameter.' >&2
- return 1
+ if [[ $_history_substring_search_zsh_5_9 -eq 1 ]] && _history-substring-search-function-callable add-zle-hook-widget; then
+ #
+ # The following code is based on the zsh-syntax-highlighting plugin.
+ #
+ autoload -U add-zle-hook-widget
+
+ _history-substring-search-zle-line-finish() {
+ #
+ # Reset $WIDGET since the 'main' highlighter depends on it.
+ #
+ # Since $WIDGET is declared by zle as read-only in this function's scope,
+ # a nested function is required in order to shadow its built-in value;
+ # see "User-defined widgets" in zshall.
+ #
+ () {
+ local -h -r WIDGET=zle-line-finish
+ _zsh_highlight
+ }
+ }
+
+ _history-substring-search-zle-line-pre-redraw() {
+ #
+ # If the zsh-syntax-highlighting plugin has been loaded (after our plugin
+ # plugin, otherwise this hook wouldn't be called), remove our hooks.
+ #
+ if [[ $+ZSH_HIGHLIGHT_VERSION -eq 1 ]]; then
+ autoload -U add-zle-hook-widget
+ add-zle-hook-widget -d zle-line-pre-redraw _history-substring-search-zle-line-pre-redraw
+ add-zle-hook-widget -d zle-line-finish _history-substring-search-zle-line-finish
+ return 0
+ fi
+ #
+ # Set $? to 0 for _zsh_highlight. Without this, subsequent
+ # zle-line-pre-redraw hooks won't run, since add-zle-hook-widget happens to
+ # call us with $? == 1 in the common case.
+ #
+ true && _zsh_highlight "$@"
}
- # Override ZLE widgets to make them invoke _zsh_highlight.
- local cur_widget
- for cur_widget in ${${(f)"$(builtin zle -la)"}:#(.*|_*|orig-*|run-help|which-command|beep|yank*)}; do
- case $widgets[$cur_widget] in
+ if [[ -o zle ]]; then
+ add-zle-hook-widget zle-line-pre-redraw _history-substring-search-zle-line-pre-redraw
+ add-zle-hook-widget zle-line-finish _history-substring-search-zle-line-finish
+ fi
+ else
+ #
+ # The following snippet was taken from the zsh-syntax-highlighting project:
+ # https://github.com/zsh-users/zsh-syntax-highlighting/blob/56b134f5d62ae3d4e66c7f52bd0cc2595f9b305b/zsh-syntax-highlighting.zsh#L126-161
+ #
+ # SPDX-SnippetBegin
+ # SPDX-License-Identifier: BSD-3-Clause
+ # SPDX-SnippetCopyrightText: 2010-2011 zsh-syntax-highlighting contributors
+ #--------------8<-------------------8<-------------------8<-----------------
+ # Rebind all ZLE widgets to make them invoke _zsh_highlights.
+ _zsh_highlight_bind_widgets()
+ {
+ # Load ZSH module zsh/zleparameter, needed to override user defined widgets.
+ zmodload zsh/zleparameter 2>/dev/null || {
+ echo 'zsh-syntax-highlighting: failed loading zsh/zleparameter.' >&2
+ return 1
+ }
- # Already rebound event: do nothing.
- user:$cur_widget|user:_zsh_highlight_widget_*);;
+ # Override ZLE widgets to make them invoke _zsh_highlight.
+ local cur_widget
+ for cur_widget in ${${(f)"$(builtin zle -la)"}:#(.*|_*|orig-*|run-help|which-command|beep|yank*)}; do
+ case $widgets[$cur_widget] in
- # User defined widget: override and rebind old one with prefix "orig-".
- user:*) eval "zle -N orig-$cur_widget ${widgets[$cur_widget]#*:}; \
- _zsh_highlight_widget_$cur_widget() { builtin zle orig-$cur_widget -- \"\$@\" && _zsh_highlight }; \
- zle -N $cur_widget _zsh_highlight_widget_$cur_widget";;
+ # Already rebound event: do nothing.
+ user:$cur_widget|user:_zsh_highlight_widget_*);;
- # Completion widget: override and rebind old one with prefix "orig-".
- completion:*) eval "zle -C orig-$cur_widget ${${widgets[$cur_widget]#*:}/:/ }; \
- _zsh_highlight_widget_$cur_widget() { builtin zle orig-$cur_widget -- \"\$@\" && _zsh_highlight }; \
- zle -N $cur_widget _zsh_highlight_widget_$cur_widget";;
+ # User defined widget: override and rebind old one with prefix "orig-".
+ user:*) eval "zle -N orig-$cur_widget ${widgets[$cur_widget]#*:}; \
+ _zsh_highlight_widget_$cur_widget() { builtin zle orig-$cur_widget -- \"\$@\" && _zsh_highlight }; \
+ zle -N $cur_widget _zsh_highlight_widget_$cur_widget";;
- # Builtin widget: override and make it call the builtin ".widget".
- builtin) eval "_zsh_highlight_widget_$cur_widget() { builtin zle .$cur_widget -- \"\$@\" && _zsh_highlight }; \
- zle -N $cur_widget _zsh_highlight_widget_$cur_widget";;
+ # Completion widget: override and rebind old one with prefix "orig-".
+ completion:*) eval "zle -C orig-$cur_widget ${${widgets[$cur_widget]#*:}/:/ }; \
+ _zsh_highlight_widget_$cur_widget() { builtin zle orig-$cur_widget -- \"\$@\" && _zsh_highlight }; \
+ zle -N $cur_widget _zsh_highlight_widget_$cur_widget";;
- # Default: unhandled case.
- *) echo "zsh-syntax-highlighting: unhandled ZLE widget '$cur_widget'" >&2 ;;
- esac
- done
- }
- #-------------->8------------------->8------------------->8-----------------
+ # Builtin widget: override and make it call the builtin ".widget".
+ builtin) eval "_zsh_highlight_widget_$cur_widget() { builtin zle .$cur_widget -- \"\$@\" && _zsh_highlight }; \
+ zle -N $cur_widget _zsh_highlight_widget_$cur_widget";;
- _zsh_highlight_bind_widgets
+ # Default: unhandled case.
+ *) echo "zsh-syntax-highlighting: unhandled ZLE widget '$cur_widget'" >&2 ;;
+ esac
+ done
+ }
+ #-------------->8------------------->8------------------->8-----------------
+ # SPDX-SnippetEnd
+
+ _zsh_highlight_bind_widgets
+ fi
+
+ unfunction _history-substring-search-function-callable
fi
_history-substring-search-begin() {
@@ -246,7 +305,14 @@ _history-substring-search-begin() {
# Escape and join query parts with wildcard character '*' as separator
# `(j:CHAR:)` join array to string with CHAR as separator
#
- local search_pattern="*${(j:*:)_history_substring_search_query_parts[@]//(#m)[\][()|\\*?#<>~^]/\\$MATCH}*"
+ local search_pattern="${(j:*:)_history_substring_search_query_parts[@]//(#m)[\][()|\\*?#<>~^]/\\$MATCH}*"
+
+ #
+ # Support anchoring history search to the beginning of the command
+ #
+ if [[ -z $HISTORY_SUBSTRING_SEARCH_PREFIXED ]]; then
+ search_pattern="*${search_pattern}"
+ fi
#
# Find all occurrences of the search pattern in the history file.
@@ -304,12 +370,21 @@ _history-substring-search-begin() {
_history-substring-search-end() {
setopt localoptions extendedglob
+ local highlight_memo=
_history_substring_search_result=$BUFFER
+ if [[ $_history_substring_search_zsh_5_9 -eq 1 ]]; then
+ highlight_memo='memo=history-substring-search'
+ fi
+
# the search was successful so display the result properly by clearing away
# existing highlights and moving the cursor to the end of the result buffer
if [[ $_history_substring_search_refresh_display -eq 1 ]]; then
- region_highlight=()
+ if [[ -n $highlight_memo ]]; then
+ region_highlight=( "${(@)region_highlight:#*${highlight_memo}*}" )
+ else
+ region_highlight=()
+ fi
CURSOR=${#BUFFER}
fi
@@ -329,14 +404,33 @@ _history-substring-search-end() {
if [[ $query_part_match_index -le ${#BUFFER:$highlight_start_index} ]]; then
highlight_start_index=$(( $highlight_start_index + $query_part_match_index ))
highlight_end_index=$(( $highlight_start_index + ${#query_part} ))
- region_highlight+=("$(($highlight_start_index - 1)) $(($highlight_end_index - 1)) $_history_substring_search_query_highlight")
+ region_highlight+=(
+ "$(($highlight_start_index - 1)) $(($highlight_end_index - 1)) ${_history_substring_search_query_highlight}${highlight_memo:+,$highlight_memo}"
+ )
fi
done
fi
# For debugging purposes:
# zle -R "mn: "$_history_substring_search_match_index" m#: "${#_history_substring_search_matches}
- # read -k -t 200 && zle -U $REPLY
+ # read -k -t 200 && zle -U -- "$REPLY"
+
+ #
+ # When this function returns, z-sy-h runs its line-pre-redraw hook. It has no
+ # logic for determining highlight priority, when two different memo= marked
+ # region highlights overlap; instead, it always prioritises itself. Below is
+ # a workaround for dealing with it.
+ #
+ if [[ $_history_substring_search_zsh_5_9 -eq 1 ]]; then
+ zle -R
+ #
+ # After line redraw with desired highlight, wait for timeout or user input
+ # before removing search highlight and exiting. This ensures no highlights
+ # are left lingering after search is finished.
+ #
+ read -k -t ${HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_TIMEOUT:-1} && zle -U -- "$REPLY"
+ region_highlight=( "${(@)region_highlight:#*${highlight_memo}*}" )
+ fi
# Exit successfully from the history-substring-search-* widgets.
return 0
diff --git a/plugins/history-substring-search/update-from-upstream.zsh b/plugins/history-substring-search/update-from-upstream.zsh
deleted file mode 100755
index 81e1942a5..000000000
--- a/plugins/history-substring-search/update-from-upstream.zsh
+++ /dev/null
@@ -1,129 +0,0 @@
-#!/usr/bin/env zsh
-#
-# update-from-upstream.zsh
-#
-# This script updates the Oh My Zsh version of the zsh-history-substring-search
-# plugin from the independent upstream repo. This is to be run by OMZ developers
-# when they want to pull in new changes from upstream to OMZ. It is not run
-# during normal use of the plugin.
-#
-# The official upstream repo is zsh-users/zsh-history-substring-search
-# https://github.com/zsh-users/zsh-history-substring-search
-#
-# This is a zsh script, not a function. Call it with `zsh update-from-upstream.zsh`
-# from the command line, running it from within the plugin directory.
-#
-# You can set the environment variable REPO_PATH to point it at an upstream
-# repo you have already prepared. Otherwise, it will do a clean checkout of
-# upstream's HEAD to a temporary local repo and use that.
-
-
-# Just bail on any error so we don't have to do extra checking.
-# This is a developer-use script, so terse output like that should
-# be fine.
-set -e
-
-
-upstream_basename=zsh-history-substring-search
-plugin_basename=history-substring-search
-UPSTREAM_REPO=zsh-users/$upstream_basename
-need_repo_cleanup=false
-upstream_github_url="https://github.com/$UPSTREAM_REPO"
-
-if [[ -z "$UPSTREAM_REPO_PATH" ]]; then
- # Do a clean checkout
- my_tempdir=$(mktemp -d -t omz-update-histsubstrsrch)
- UPSTREAM_REPO_PATH="$my_tempdir/$upstream_basename"
- git clone "$upstream_github_url" "$UPSTREAM_REPO_PATH"
- need_repo_cleanup=true
- print "Checked out upstream repo to $UPSTREAM_REPO_PATH"
-else
- print "Using existing $upstream_basename repo at $UPSTREAM_REPO_PATH"
-fi
-
-upstream="$UPSTREAM_REPO_PATH"
-
-# Figure out what we're pulling in
-upstream_sha=$(cd $upstream && git rev-parse HEAD)
-upstream_commit_date=$(cd $upstream && git log -1 --pretty=format:%ci)
-upstream_just_date=${${=upstream_commit_date}[1]}
-print "upstream SHA: $upstream_sha"
-print "upstream commit time: $upstream_commit_date"
-print "upstream commit date: $upstream_just_date"
-print
-
-# Copy the files over, using the OMZ plugin's names where needed
-cp -v "$upstream"/* .
-mv -v zsh-history-substring-search.zsh $plugin_basename.zsh
-mv -v zsh-history-substring-search.plugin.zsh $plugin_basename.plugin.zsh
-
-if [[ $need_repo_cleanup == true ]]; then
- print "Removing temporary repo at $my_tempdir"
- rm -rf "$my_tempdir"
-fi
-
-# Do OMZ-specific edits
-
-print
-print "Updating files with OMZ-specific stuff"
-print
-
-# OMZ binds the keys as part of the plugin loading
-
-cat >> $plugin_basename.plugin.zsh <<EOF
-
-
-# Bind terminal-specific up and down keys
-
-if [[ -n "\$terminfo[kcuu1]" ]]; then
- bindkey -M emacs "\$terminfo[kcuu1]" history-substring-search-up
- bindkey -M viins "\$terminfo[kcuu1]" history-substring-search-up
-fi
-if [[ -n "\$terminfo[kcud1]" ]]; then
- bindkey -M emacs "\$terminfo[kcud1]" history-substring-search-down
- bindkey -M viins "\$terminfo[kcud1]" history-substring-search-down
-fi
-
-EOF
-
-# Tack OMZ-specific notes on to readme
-
-thin_line="------------------------------------------------------------------------------"
-cat >> README.md <<EOF
-
-$thin_line
-Oh My Zsh Distribution Notes
-$thin_line
-
-What you are looking at now is Oh My Zsh's repackaging of zsh-history-substring-search
-as an OMZ module inside the Oh My Zsh distribution.
-
-The upstream repo, $UPSTREAM_REPO, can be found on GitHub at
-$upstream_github_url.
-
-This downstream copy was last updated from the following upstream commit:
-
- SHA: $upstream_sha
- Commit date: $upstream_commit_date
-
-Everything above this section is a copy of the original upstream's README, so things
-may differ slightly when you're using this inside OMZ. In particular, you do not
-need to set up key bindings for the up and down arrows yourself in \`~/.zshrc\`; the OMZ
-plugin does that for you. You may still want to set up additional emacs- or vi-specific
-bindings as mentioned above.
-
-EOF
-
-# Announce success and generate git commit messages
-
-cat <<EOF
-Done OK
-
-Now you can check the results and commit like this:
-
- git add *
- git commit -m "history-substring-search: update to upstream version $upstream_just_date" \\
- -m "Updates OMZ's copy to commit $upstream_sha from $UPSTREAM_REPO"
-
-EOF
-
diff --git a/plugins/hitchhiker/fortunes/hitchhiker b/plugins/hitchhiker/fortunes/hitchhiker
index 94cc1c835..6620a2a4f 100644
--- a/plugins/hitchhiker/fortunes/hitchhiker
+++ b/plugins/hitchhiker/fortunes/hitchhiker
@@ -42,7 +42,7 @@
- Zaphod.
%
-"`In those days spirits were brave, the stakes were high, men were REAL men, women were REAL women, and small furry creatures from Alpha Centauri were REAL small furry creatures from Aplha Centauri.'"
+"`In those days spirits were brave, the stakes were high, men were REAL men, women were REAL women, and small furry creatures from Alpha Centauri were REAL small furry creatures from Alpha Centauri.'"
- The Book getting all nostalgic.
%
diff --git a/plugins/httpie/_httpie b/plugins/httpie/_httpie
index 11bc8e1f8..2c0db229f 100644
--- a/plugins/httpie/_httpie
+++ b/plugins/httpie/_httpie
@@ -1,4 +1,4 @@
-#compdef http
+#compdef http https
# ------------------------------------------------------------------------------
# Copyright (c) 2015 GitHub zsh-users - http://github.com/zsh-users
# All rights reserved.
diff --git a/plugins/ionic/ionic.plugin.zsh b/plugins/ionic/ionic.plugin.zsh
index cf388af1b..e3913b549 100644
--- a/plugins/ionic/ionic.plugin.zsh
+++ b/plugins/ionic/ionic.plugin.zsh
@@ -3,13 +3,13 @@ alias ih="ionic --help"
alias ist="ionic start"
alias ii="ionic info"
alias is="ionic serve"
-alias icba="ionic cordova build android"
-alias icbi="ionic cordova build ios"
-alias icra="ionic cordova run android"
-alias icri="ionic cordova run ios"
-alias icrsa="ionic cordova resources android"
+alias icba="ionic cordova build android"
+alias icbi="ionic cordova build ios"
+alias icra="ionic cordova run android"
+alias icri="ionic cordova run ios"
+alias icrsa="ionic cordova resources android"
alias icrsi="ionic cordova resources ios"
-alias icpaa="ionic cordova platform add android"
+alias icpaa="ionic cordova platform add android"
alias icpai="ionic cordova platform add ios"
alias icpra="ionic cordova platform rm android"
alias icpri="ionic cordova platform rm ios"
diff --git a/plugins/ipfs/_ipfs b/plugins/ipfs/_ipfs
index 8771bc4ba..5b8b05b98 100644
--- a/plugins/ipfs/_ipfs
+++ b/plugins/ipfs/_ipfs
@@ -202,7 +202,7 @@ _ipfs_subcommand(){
_arguments \
'--resolve[Check if the given path can be resolved before publishing. Default: true.]' \
'(-t --lifetime)'{-t,--lifetime}'[Time duration that the record will be valid for. Default: 24h.]' \
- '--allow-offline[When offline, save the IPNS record to the the local datastore without broadcasting to the network instead of simply failing.]' \
+ '--allow-offline[When offline, save the IPNS record to the local datastore without broadcasting to the network instead of simply failing.]' \
'--ttl[Time duration this record should be cached for. Uses the same syntax as the lifetime option. (caution: experimental).]' \
'(-k --key)'{-k,--key}"[Name of the key to be used or a valid PeerID, as listed by 'ipfs key list -l'. Default: self.]" \
'(-Q --quieter)'{-Q,--quieter}'[Write only final hash.]' \
diff --git a/plugins/isodate/README.md b/plugins/isodate/README.md
index 1ec75b2d4..5329310c2 100644
--- a/plugins/isodate/README.md
+++ b/plugins/isodate/README.md
@@ -1,7 +1,5 @@
# Isodate plugin
-**Maintainer:** [@Frani](https://github.com/frani)
-
This plugin adds completion for the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601),
as well as some aliases for common Date commands.
@@ -11,6 +9,8 @@ To use it, add `isodate` to the plugins array in your zshrc file:
plugins=(... isodate)
```
+**Maintainer:** [@Frani](https://github.com/frani)
+
## Aliases
| Alias | Command | Description |
diff --git a/plugins/iterm2/README.md b/plugins/iterm2/README.md
index 3d11622df..86bd77f1d 100644
--- a/plugins/iterm2/README.md
+++ b/plugins/iterm2/README.md
@@ -9,7 +9,7 @@ plugins=(... iterm2)
```
Optionally, the plugin also applies the [Shell Integration Script for iTerm2](https://iterm2.com/documentation-shell-integration.html).
-You can enable the integration with zstyle. It's important to add this line
+You can enable the integration with zstyle. It's important to add this line
before the line sourcing oh-my-zsh:
```
diff --git a/plugins/iterm2/iterm2.plugin.zsh b/plugins/iterm2/iterm2.plugin.zsh
index d00232a30..03a63a70c 100644
--- a/plugins/iterm2/iterm2.plugin.zsh
+++ b/plugins/iterm2/iterm2.plugin.zsh
@@ -8,7 +8,7 @@
if [[ "$OSTYPE" == darwin* ]] && [[ -n "$ITERM_SESSION_ID" ]] ; then
# maybe make it the default in the future and allow opting out?
- if zstyle -t ':omz:plugins:iterm2' shell-integration; then
+ if zstyle -t ':omz:plugins:iterm2' shell-integration; then
# Handle $0 according to the standard:
# https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html
0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
diff --git a/plugins/iterm2/iterm2_shell_integration.zsh b/plugins/iterm2/iterm2_shell_integration.zsh
index 7871ddded..281332e0d 100644
--- a/plugins/iterm2/iterm2_shell_integration.zsh
+++ b/plugins/iterm2/iterm2_shell_integration.zsh
@@ -2,12 +2,12 @@
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
diff --git a/plugins/jira/README.md b/plugins/jira/README.md
index d78ea15a4..f6e2e26f4 100644
--- a/plugins/jira/README.md
+++ b/plugins/jira/README.md
@@ -1,46 +1,68 @@
-# Jira plugin #
+# Jira plugin
-CLI support for JIRA interaction
+This plugin provides command line tools for interacting with Atlassian's [JIRA](https://www.atlassian.com/software/jira) bug tracking software.
-## Description ##
+To use it, add `jira` to the plugins array in your zshrc file:
-This plugin provides command line tools for interacting with Atlassian's [JIRA](https://www.atlassian.com/software/jira) bug tracking software.
+```zsh
+plugins=(... jira)
+```
The interaction is all done through the web. No local installation of JIRA is necessary.
In this document, "JIRA" refers to the JIRA issue tracking server, and `jira` refers to the command this plugin supplies.
-## Usage ##
+## Usage
This plugin supplies one command, `jira`, through which all its features are exposed. Most forms of this command open a JIRA page in your web browser.
## Commands
-| Command | Description |
-| :------------ | :-------------------------------------------------------- |
-| `jira` | Performs the default action |
-| `jira new` | Opens a new Jira issue dialogue |
-| `jira ABC-123` | Opens an existing issue |
-| `jira ABC-123 m` | Opens an existing issue for adding a comment |
-| `jira dashboard [rapid_view]` | # opens your JIRA dashboard |
-| `jira mine` | Queries for your own issues |
-| `jira tempo` | Opens your JIRA Tempo |
-| `jira reported [username]` | Queries for issues reported by a user |
-| `jira assigned [username]` | Queries for issues assigned to a user |
-| `jira branch` | Opens an existing issue matching the current branch name |
+`jira help` or `jira usage` will print the below usage instructions
+
+| Command | Description |
+| :---------------------------- | :------------------------------------------------------- |
+| `jira` | Performs the default action |
+| `jira new` | Opens a new Jira issue dialogue |
+| `jira ABC-123` | Opens an existing issue |
+| `jira ABC-123 m` | Opens an existing issue for adding a comment |
+| `jira project ABC` | Opens JIRA project summary |
+| `jira dashboard [rapid_view]` | Opens your JIRA dashboard |
+| `jira mine` | Queries for your own issues |
+| `jira tempo` | Opens your JIRA Tempo |
+| `jira reported [username]` | Queries for issues reported by a user |
+| `jira assigned [username]` | Queries for issues assigned to a user |
+| `jira branch` | Opens an existing issue matching the current branch name |
+| `jira help` | Prints usage instructions |
### Jira Branch usage notes
-The branch name may have prefixes ending in "/": "feature/MP-1234", and also suffixes
+The branch name may have prefixes ending in "/": "feature/MP-1234", and also suffixes
starting with "_": "MP-1234_fix_dashboard". In both these cases, the issue opened will be "MP-1234"
This is also checks if the prefix is in the name, and adds it if not, so: "MP-1234" opens the issue "MP-1234",
"mp-1234" opens the issue "mp-1234", and "1234" opens the issue "MP-1234".
+If your branch naming convention deviates, you can overwrite the jira_branch function to determine and echo the Jira issue key yourself.
+Define a function `jira_branch` after sourcing `oh-my-zsh.sh` in your `.zshrc`.
+Example:
+```zsh
+# Determine branch name from naming convention 'type/KEY-123/description'.
+function jira_branch() {
+ # Get name of the branch
+ issue_arg=$(git rev-parse --abbrev-ref HEAD)
+ # Strip prefixes like feature/ or bugfix/
+ issue_arg=${issue_arg#*/}
+ # Strip suffixes like /some-branch-description
+ issue_arg=${issue_arg%%/*}
+ # Return the value
+ echo $issue_arg
+}
+```
-#### Debugging usage ####
+#### Debugging usage
These calling forms are for developers' use, and may change at any time.
@@ -48,7 +70,7 @@ These calling forms are for developers' use, and may change at any time.
jira dumpconfig # displays the effective configuration
```
-## Setup ##
+## Setup
The URL for your JIRA instance is set by `$JIRA_URL` or a `.jira_url` file.
@@ -65,7 +87,7 @@ echo "https://jira.atlassian.com" >> .jira-url
(Note: The current implementation only looks in the current directory for `.jira-url` and `.jira-prefix`, not up the path, so if you are in a subdirectory of your project, it will fall back to your default JIRA URL. This will probably change in the future though.)
-### Variables ###
+### Variables
* `$JIRA_URL` - Your JIRA instance's URL
* `$JIRA_NAME` - Your JIRA username; used as the default user for `assigned`/`reported` searches
@@ -76,6 +98,6 @@ echo "https://jira.atlassian.com" >> .jira-url
* `$JIRA_TEMPO_PATH` - Your JIRA tempo url path; defaults to "/secure/Tempo.jspa"
-### Browser ###
+### Browser
Your default web browser, as determined by how `open_command` handles `http://` URLs, is used for interacting with the JIRA instance. If you change your system's URL handler associations, it will change the browser that `jira` uses.
diff --git a/plugins/jira/_jira b/plugins/jira/_jira
index 0e37b7e9d..617a3e501 100644
--- a/plugins/jira/_jira
+++ b/plugins/jira/_jira
@@ -5,12 +5,14 @@ local -a _1st_arguments
_1st_arguments=(
'new:create a new issue'
'mine:open my issues'
+ 'project:open the project'
'dashboard:open the dashboard'
'tempo:open the tempo'
'reported:search for issues reported by a user'
'assigned:search for issues assigned to a user'
'branch:open the issue named after the git branch of the current directory'
'dumpconfig:display effective jira configuration'
+ 'help:print usage help to stdout'
)
_arguments -C \
diff --git a/plugins/jira/jira.plugin.zsh b/plugins/jira/jira.plugin.zsh
index b6ee9f100..0c90544d5 100644
--- a/plugins/jira/jira.plugin.zsh
+++ b/plugins/jira/jira.plugin.zsh
@@ -2,6 +2,46 @@
#
# See README.md for details
+function _jira_usage() {
+cat <<EOF
+jira Performs the default action
+jira new Opens a new Jira issue dialogue
+jira ABC-123 Opens an existing issue
+jira ABC-123 m Opens an existing issue for adding a comment
+jira project ABC Opens JIRA project summary
+jira dashboard [rapid_view] Opens your JIRA dashboard
+jira mine Queries for your own issues
+jira tempo Opens your JIRA Tempo
+jira reported [username] Queries for issues reported by a user
+jira assigned [username] Queries for issues assigned to a user
+jira branch Opens an existing issue matching the current branch name
+EOF
+}
+
+# If your branch naming convention deviates, you can partially override this plugin function
+# to determine the jira issue key based on your formatting.
+# See https://github.com/ohmyzsh/ohmyzsh/wiki/Customization#partially-overriding-an-existing-plugin
+function jira_branch() {
+ # Get name of the branch
+ issue_arg=$(git rev-parse --abbrev-ref HEAD)
+ # Strip prefixes like feature/ or bugfix/
+ issue_arg=${issue_arg##*/}
+ # Strip suffixes starting with _
+ issue_arg=(${(s:_:)issue_arg})
+ # If there is only one part, it means that there is a different delimiter. Try with -
+ if [[ ${#issue_arg[@]} = 1 && ${issue_arg} == *-* ]]; then
+ issue_arg=(${(s:-:)issue_arg})
+ issue_arg="${issue_arg[1]}-${issue_arg[2]}"
+ else
+ issue_arg=${issue_arg[1]}
+ fi
+ if [[ "${issue_arg:l}" = ${jira_prefix:l}* ]]; then
+ echo "${issue_arg}"
+ else
+ echo "${jira_prefix}${issue_arg}"
+ fi
+}
+
function jira() {
emulate -L zsh
local action jira_url jira_prefix
@@ -44,9 +84,14 @@ function jira() {
open_command "${jira_url}/secure/CreateIssue!default.jspa"
elif [[ "$action" == "assigned" || "$action" == "reported" ]]; then
_jira_query ${@:-$action}
+ elif [[ "$action" == "help" || "$action" == "usage" ]]; then
+ _jira_usage
elif [[ "$action" == "mine" ]]; then
echo "Opening my issues"
open_command "${jira_url}/issues/?filter=-1"
+ elif [[ "$action" == "project" ]]; then
+ echo "Opening project"
+ open_command "${jira_url}/jira/software/c/projects/${2}/summary"
elif [[ "$action" == "dashboard" ]]; then
echo "Opening dashboard"
if [[ "$JIRA_RAPID_BOARD" == "true" ]]; then
@@ -74,24 +119,7 @@ function jira() {
# but `branch` is a special case that will parse the current git branch
local issue_arg issue
if [[ "$action" == "branch" ]]; then
- # Get name of the branch
- issue_arg=$(git rev-parse --abbrev-ref HEAD)
- # Strip prefixes like feature/ or bugfix/
- issue_arg=${issue_arg##*/}
- # Strip suffixes starting with _
- issue_arg=(${(s:_:)issue_arg})
- # If there is only one part, it means that there is a different delimiter. Try with -
- if [[ ${#issue_arg[@]} = 1 && ${issue_arg} == *-* ]]; then
- issue_arg=(${(s:-:)issue_arg})
- issue_arg="${issue_arg[1]}-${issue_arg[2]}"
- else
- issue_arg=${issue_arg[1]}
- fi
- if [[ "${issue_arg:l}" = ${jira_prefix:l}* ]]; then
- issue="${issue_arg}"
- else
- issue="${jira_prefix}${issue_arg}"
- fi
+ issue=$(jira_branch)
else
issue_arg=${(U)action}
issue="${jira_prefix}${issue_arg}"
diff --git a/plugins/jj/README.md b/plugins/jj/README.md
new file mode 100644
index 000000000..fd964e309
--- /dev/null
+++ b/plugins/jj/README.md
@@ -0,0 +1,107 @@
+# jj - Jujutsu CLI
+
+This plugin provides autocompletion for [jj](https://martinvonz.github.io/jj).
+
+To use it, add `jj` to the plugins array of your zshrc file:
+
+```zsh
+plugins=(... jj)
+```
+
+## Aliases
+
+| Alias | Command |
+| ------ | ----------------------------- |
+| jjb | `jj bookmark` |
+| jjbc | `jj bookmark create` |
+| jjbd | `jj bookmark delete` |
+| jjbf | `jj bookmark forget` |
+| jjbl | `jj bookmark list` |
+| jjbm | `jj bookmark move` |
+| jjbr | `jj bookmark rename` |
+| jjbs | `jj bookmark set` |
+| jjbt | `jj bookmark track` |
+| jjbu | `jj bookmark untrack` |
+| jjc | `jj commit` |
+| jjcmsg | `jj commit --message` |
+| jjd | `jj diff` |
+| jjdmsg | `jj desc --message` |
+| jjds | `jj desc` |
+| jje | `jj edit` |
+| jjgcl | `jj git clone` |
+| jjgf | `jj git fetch` |
+| jjgfa | `jj git fetch --all-remotes` |
+| jjgp | `jj git push` |
+| jjgpa | `jj git push --all` |
+| jjgpd | `jj git push --deleted` |
+| jjgpt | `jj git push --tracked` |
+| jjl | `jj log` |
+| jjla | `jj log -r "all()"` |
+| jjn | `jj new` |
+| jjnt | `jj new "trunk()"` |
+| jjrb | `jj rebase` |
+| jjrbm | `jj rebase -d "trunk()"` |
+| jjrs | `jj restore` |
+| jjrt | `cd "$(jj root \|\| echo .)"` |
+| jjsp | `jj split` |
+| jjsq | `jj squash` |
+| jjst | `jj status` |
+
+## Prompt usage
+
+Because `jj` has a very powerful [template syntax](https://martinvonz.github.io/jj/latest/templates/), this
+plugin only exposes a convenience function `jj_prompt_template` to read information from the current change.
+It is basically the same as `jj log --no-graph -r @ -T $1`:
+
+```sh
+_my_theme_jj_info() {
+ jj_prompt_template 'self.change_id().shortest(3)'
+}
+
+PROMPT='$(_my_theme_jj_info) $'
+```
+
+`jj_prompt_template` escapes `%` signs in the output. Use `jj_prompt_template_raw` if you don't want that
+(e.g. to colorize the output).
+
+However, because `jj` can be used inside a Git repository, some themes might clash with it. Generally, you can
+fix it with a wrapper function that tries `jj` first and then falls back to `git` if it didn't work:
+
+```sh
+_my_theme_vcs_info() {
+ jj_prompt_template 'self.change_id().shortest(3)' \
+ || git_prompt_info
+}
+
+PROMPT='$(_my_theme_vcs_info) $'
+```
+
+You can find an example
+[here](https://github.com/nasso/omzsh/blob/e439e494f22f4fd4ef1b6cb64626255f4b341c1b/themes/sunakayu.zsh-theme).
+
+### Performance
+
+Sometimes `jj` can be slower than `git`.
+
+If you feel slowdowns, consider using the following:
+
+```
+zstyle :omz:plugins:jj ignore-working-copy yes
+```
+
+This will add `--ignore-working-copy` to all `jj` commands executed by your prompt. The downside here is that
+your prompt might be out-of-sync until the next time `jj` gets a chance to _not_ ignore the working copy (i.e.
+you manually run a `jj` command).
+
+If you prefer to keep your prompt always up-to-date but still don't want to _feel_ the slowdown, you can make
+your prompt asynchronous. This plugin doesn't do this automatically so you'd have to hack your theme a bit for
+that.
+
+## See Also
+
+- [martinvonz/jj](https://github.com/martinvonz/jj)
+
+## Contributors
+
+- [nasso](https://github.com/nasso) - Plugin Author
+- [imp](https://github.com/imp) - Occasional Alias Contributor
diff --git a/plugins/jj/jj.plugin.zsh b/plugins/jj/jj.plugin.zsh
new file mode 100644
index 000000000..696bc380b
--- /dev/null
+++ b/plugins/jj/jj.plugin.zsh
@@ -0,0 +1,70 @@
+# if jj is not found, don't do the rest of the script
+if (( ! $+commands[jj] )); then
+ return
+fi
+
+# If the completion file doesn't exist yet, we need to autoload it and
+# bind it to `jj`. Otherwise, compinit will have already done that.
+if [[ ! -f "$ZSH_CACHE_DIR/completions/_jj" ]]; then
+ typeset -g -A _comps
+ autoload -Uz _jj
+ _comps[jj]=_jj
+fi
+
+COMPLETE=zsh jj >| "$ZSH_CACHE_DIR/completions/_jj" &|
+
+function __jj_prompt_jj() {
+ local -a flags
+ flags=("--no-pager")
+ if zstyle -t ':omz:plugins:jj' ignore-working-copy; then
+ flags+=("--ignore-working-copy")
+ fi
+ command jj $flags "$@"
+}
+
+# convenience functions for themes
+function jj_prompt_template_raw() {
+ __jj_prompt_jj log --no-graph -r @ -T "$@" 2> /dev/null
+}
+
+function jj_prompt_template() {
+ local out
+ out=$(jj_prompt_template_raw "$@") || return 1
+ echo "${out:gs/%/%%}"
+}
+
+# Aliases (sorted alphabetically)
+alias jjb='jj bookmark'
+alias jjbc='jj bookmark create'
+alias jjbd='jj bookmark delete'
+alias jjbf='jj bookmark forget'
+alias jjbl='jj bookmark list'
+alias jjbm='jj bookmark move'
+alias jjbr='jj bookmark rename'
+alias jjbs='jj bookmark set'
+alias jjbt='jj bookmark track'
+alias jjbu='jj bookmark untrack'
+alias jjc='jj commit'
+alias jjcmsg='jj commit --message'
+alias jjd='jj diff'
+alias jjdmsg='jj desc --message'
+alias jjds='jj desc'
+alias jje='jj edit'
+alias jjgcl='jj git clone'
+alias jjgf='jj git fetch'
+alias jjgfa='jj git fetch --all-remotes'
+alias jjgp='jj git push'
+alias jjgpa='jj git push --all'
+alias jjgpd='jj git push --deleted'
+alias jjgpt='jj git push --tracked'
+alias jjl='jj log'
+alias jjla='jj log -r "all()"'
+alias jjn='jj new'
+alias jjnt='jj new "trunk()"'
+alias jjrb='jj rebase'
+alias jjrbm='jj rebase -d "trunk()"'
+alias jjrs='jj restore'
+alias jjrt='cd "$(jj root || echo .)"'
+alias jjsp='jj split'
+alias jjsq='jj squash'
+alias jjst='jj status'
diff --git a/plugins/jsontools/README.md b/plugins/jsontools/README.md
index 6a2740014..804edba40 100644
--- a/plugins/jsontools/README.md
+++ b/plugins/jsontools/README.md
@@ -8,6 +8,17 @@ To use it, add `jsontools` to the plugins array in your zshrc file:
plugins=(... jsontools)
```
+## Requirements
+
+The plugin uses one of these tools to process JSON data, in the following order:
+
+- `node`
+- `python3`
+- `ruby`
+
+Any of these must be in `$PATH` before the plugin is loaded, otherwise the plugin exits
+prematurely and the functions will not be available.
+
## Usage
Usage is simple... just take your json data and pipe it into the appropriate jsontool:
@@ -19,7 +30,7 @@ Usage is simple... just take your json data and pipe it into the appropriate jso
### Supports NDJSON (Newline Delimited JSON)
-The plugin also supports [NDJSON](http://ndjson.org/) input, which means all functions
+The plugin also supports [NDJSON](https://github.com/ndjson/ndjson-spec) input, which means all functions
have an alternative function that reads and processes the input line by line. These
functions have the same name except using `ndjson` instead of `json`:
diff --git a/plugins/juju/juju.plugin.zsh b/plugins/juju/juju.plugin.zsh
index a82ebaf84..3c159da22 100644
--- a/plugins/juju/juju.plugin.zsh
+++ b/plugins/juju/juju.plugin.zsh
@@ -184,7 +184,7 @@ jmodel() {
fi
local model="$(yq e ".controllers.$(jcontroller).current-model" < ~/.local/share/juju/models.yaml | cut -d/ -f2)"
-
+
if [[ -z "$model" ]]; then
echo "--"
return 1
diff --git a/plugins/jump/jump.plugin.zsh b/plugins/jump/jump.plugin.zsh
index 829c9d9cb..c2b21e92e 100644
--- a/plugins/jump/jump.plugin.zsh
+++ b/plugins/jump/jump.plugin.zsh
@@ -8,8 +8,10 @@
#
export MARKPATH=$HOME/.marks
+
jump() {
- builtin cd -P "$MARKPATH/$1" 2>/dev/null || {echo "No such mark: $1"; return 1}
+ local markpath="$(readlink $MARKPATH/$1)" || {echo "No such mark: $1"; return 1}
+ builtin cd "$markpath" 2>/dev/null || {echo "Destination does not exist for mark [$1]: $markpath"; return 2}
}
mark() {
diff --git a/plugins/k9s/README.md b/plugins/k9s/README.md
new file mode 100644
index 000000000..275048cdb
--- /dev/null
+++ b/plugins/k9s/README.md
@@ -0,0 +1,9 @@
+# k9s plugin
+
+This plugin adds completion support for the [k9s](https://k9scli.io).
+
+To use it, add `k9s` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... k9s)
+```
diff --git a/plugins/k9s/k9s.plugin.zsh b/plugins/k9s/k9s.plugin.zsh
new file mode 100644
index 000000000..630d4f7d3
--- /dev/null
+++ b/plugins/k9s/k9s.plugin.zsh
@@ -0,0 +1,14 @@
+if (( ! $+commands[k9s] )); then
+ return
+fi
+
+# If the completion file does not exist, fake it and load it
+if [[ ! -f "$ZSH_CACHE_DIR/completions/_k9s" ]]; then
+ typeset -g -A _comps
+ autoload -Uz _k9s
+ _comps[k9s]=_k9s
+fi
+
+# and then generate it in the background. On first completion,
+# the actual completion file will be loaded.
+k9s completion zsh >| "$ZSH_CACHE_DIR/completions/_k9s" &|
diff --git a/plugins/kamal/README.md b/plugins/kamal/README.md
new file mode 100644
index 000000000..af5716826
--- /dev/null
+++ b/plugins/kamal/README.md
@@ -0,0 +1,16 @@
+# Kamal
+
+This plugin provides completion for [Kamal](https://kamal-deploy.org/) as well as some
+aliases for frequent Kamal commands.
+
+To use it, add kamal to the plugins array of your zshrc file:
+
+```zsh
+plugins=(... kamal)
+```
+
+## Aliase
+
+| Alias | Command | Description |
+|-----------|----------------------------------|----------------------------------------------------------------------------------|
+| kad | `kamal deploy` | Deploy app to servers |
diff --git a/plugins/kamal/_kamal b/plugins/kamal/_kamal
new file mode 100644
index 000000000..52b29e814
--- /dev/null
+++ b/plugins/kamal/_kamal
@@ -0,0 +1,691 @@
+#compdef kamal
+
+# Description
+# -----------
+# zsh completion for Kamal (https://kamal-deploy.org/)
+# -------------------------------------------------------------------------
+# Authors
+# -------
+# * Igor Aleksandrov <igor.alexandrov@gmail.com>
+# -------------------------------------------------------------------------
+# Inspiration
+# -----------
+# * docker-compose ohmyzsh completion script by @sdurrheimer Steve Durrheimer
+# -------------------------------------------------------------------------
+
+# _kamal_commands() {
+# # Only initialize if empty
+# if (( ${#kamal_commands} == 0 )); then
+# kamal_commands=(
+# accessory
+# app
+# audit
+# build
+# config
+# deploy
+# details
+# docs
+# help
+# init
+# lock
+# proxy
+# prune
+# redeploy
+# registry
+# remove
+# rollback
+# secrets
+# server
+# setup
+# upgrade
+# version
+# )
+# fi
+
+# _values 'Kamal commands' $kamal_commands
+# }
+
+typeset -gr _kamal_commands=(
+ 'accessory:Control accessory services'
+ 'app:Control application deployment'
+ 'audit:Audit security of deployment'
+ 'build:Build and manage app images'
+ 'config:Show effective configuration'
+ 'deploy:Deploy app to servers'
+ 'details:Show details about deployment'
+ 'docs:Open documentation in browser'
+ 'help:Show command help'
+ 'init:Initialize new Kamal project'
+ 'lock:Manage deployment locks'
+ 'proxy:Control reverse proxy'
+ 'prune:Clean up containers and images'
+ 'redeploy:Redeploy current version'
+ 'registry:Manage Docker registry access'
+ 'remove:Remove app from servers'
+ 'rollback:Rollback to a previous version'
+ 'secrets:Manage deployment secrets'
+ 'server:Control server configuration'
+ 'setup:Setup initial deployment'
+ 'upgrade:Upgrade deployment'
+ 'version:Show Kamal version'
+)
+
+# Helper function to display messages
+_kamal_message() {
+ local msg="$1"
+ _kamal_message "==> $msg"
+}
+
+# Helper function to extract destination names from ./config/deploy.*.yml
+_kamal_destinations() {
+ local -a dests
+ local file
+
+ # Check if config directory exists
+ if [[ ! -d "config" ]]; then
+ _kamal_message "Cannot find Kamal configuration directory at ./config" && return 1
+ fi
+
+ for file in config/deploy.*.yml(N); do
+ [[ $file =~ config/deploy\.(.+)\.yml ]] && dests+=("${match[1]}")
+ done
+
+ _values 'Destination' $dests
+}
+
+# Define global _kamal_flags array
+typeset -ga _kamal_flags
+_kamal_flags=(
+ '(-v --verbose )'{-v,--verbose}'[Detailed logging]'
+ '(--no-verbose --skip-verbose)'{--no-verbose,--skip-verbose}'[No detailed logging]'
+ '(-q --quiet --no-quiet --skip-quiet)'{-q,--quiet}'[Minimal logging]'
+ '(-q --quiet --no-quiet --skip-quiet)'{--no-quiet,--skip-quiet}'[No minimal logging]'
+ '--version=[Run commands against a specific app version]:version'
+ '(-p --primary --no-primary --skip-primary)'{-p,--primary}'[Run commands only on primary host instead of all]'
+ '(-p --primary --no-primary --skip-primary)'{--no-primary,--skip-primary}'[Do not run commands only on primary host]'
+ '(-h --hosts)'{-h,--hosts=}'[Run commands on these hosts instead of all]:hosts'
+ '(-r --roles)'{-r,--roles=}'[Run commands on these roles instead of all]:roles'
+ '(-c --config-file)'{-c,--config-file=}'[Path to config file]:config file:_files'
+ '(-d --destination)'{-d,--destination=}'[Specify destination to be used for config file]:destination:_kamal_destinations'
+ '(-H --skip-hooks)'{-H,--skip-hooks}'[Do not run hooks]'
+)
+
+_kamal() {
+ local context state state_descr line curcontext="$curcontext"
+ typeset -A opt_args
+
+ local ret=1
+
+ _arguments -C \
+ $_kamal_flags \
+ '1: :->command' \
+ '*:: :->args' && ret=0
+
+ case $state in
+ (command)
+ # First argument - show available commands
+ _describe -t kamal-commands "Kamal commands" _kamal_commands && ret=0
+ ;;
+ (args)
+ # Subsequent arguments - handle based on the command
+ case $words[1] in
+ (accessory)
+ _kamal_accessory && ret=0
+ ;;
+ (app)
+ _kamal_app && ret=0
+ ;;
+ (audit)
+ _arguments $_kamal_flags && ret=0
+ ;;
+ (build)
+ _kamal_build && ret=0
+ ;;
+ (config)
+ _arguments $_kamal_flags && ret=0
+ ;;
+ (deploy)
+ _arguments $_kamal_flags && ret=0
+ ;;
+ (details)
+ _arguments $_kamal_flags && ret=0
+ ;;
+ (docs)
+ _arguments $_kamal_flags && ret=0
+ ;;
+ (help)
+ _kamal_help && ret=0
+ ;;
+ (init)
+ local -a init_flags
+ init_flags=(
+ $_kamal_flags
+ '(--bundle --no-bundle --skip-bundle)--bundle[Add Kamal to the Gemfile and create a bin/kamal binstub]'
+ '(--bundle --no-bundle --skip-bundle)--no-bundle[Do not add Kamal to the Gemfile and create a bin/kamal binstub]'
+ '(--bundle --no-bundle --skip-bundle)--skip-bundle[Skip add Kamal to the Gemfile and create a bin/kamal binstub]'
+ )
+ _arguments $init_flags && ret=0
+ ;;
+ (lock)
+ _kamal_lock && ret=0
+ ;;
+ (proxy)
+ _kamal_proxy && ret=0
+ ;;
+ (prune)
+ _kamal_prune && ret=0
+ ;;
+ (redeploy)
+ _arguments $_kamal_flags && ret=0
+ ;;
+ (registry)
+ _kamal_registry && ret=0
+ ;;
+ (remove)
+ local -a remove_flags
+ remove_flags=(
+ $_kamal_flags
+ '(-y --confirmed --no-confirmed --skip-confirmed)'{-y,--confirmed}'[Proceed without confirmation question]'
+ '(-y --confirmed --no-confirmed --skip-confirmed)--no-confirmed[Proceed without confirmation question]'
+ '(-y --confirmed --no-confirmed --skip-confirmed)--skip-confirmed[Proceed without confirmation question]'
+ )
+ _arguments $remove_flags && ret=0
+ ;;
+ (rollback)
+ if (( CURRENT == 2 )); then
+ _kamal_message "Enter the version to rollback to" && ret=0
+ else
+ _values $_kamal_flags && ret=0
+ fi
+ ;;
+ (secrets)
+ _kamal_secrets && ret=0
+ ;;
+ (server)
+ _kamal_server && ret=0
+ ;;
+ (setup)
+ local -a setup_flags
+ setup_flags=(
+ $_kamal_flags
+ '(-P --skip-push)'{-P,--skip-push}'[Skip image build and push]'
+ )
+ _arguments $setup_flags && ret=0
+ ;;
+ (upgrade)
+ local -a upgrade_flags
+ upgrade_flags=(
+ $_kamal_flags
+ '(-y --confirmed --no-confirmed --skip-confirmed)'{-y,--confirmed}'[Proceed without confirmation question]'
+ '(-y --confirmed --no-confirmed --skip-confirmed)--no-confirmed[Do not proceed without confirmation question]'
+ '(-y --confirmed --no-confirmed --skip-confirmed)--skip-confirmed[Skip confirmation question]'
+ '(--rolling --no-rolling --skip-rolling)--rolling[Upgrade one host at a time]'
+ '(--rolling --no-rolling --skip-rolling)--no-rolling[Do not upgrade one host at a time]'
+ '(--rolling --no-rolling --skip-rolling)--skip-rolling[Skip rolling upgrade]'
+ )
+ _arguments $upgrade_flags && ret=0
+ ;;
+ (version)
+ _arguments $_kamal_flags && ret=0
+ esac
+ ;;
+ esac
+
+ return ret
+}
+
+_kamal_accessory() {
+ local context state line
+ typeset -A opt_args
+ local ret=1
+
+ # Define accessory subcommands
+ local -a accessory_subcommands
+ accessory_subcommands=(
+ "boot:Boot new accessory service on host (use NAME=all to boot all accessories)"
+ "details:Show details about accessory on host (use NAME=all to show all accessories)"
+ "exec:Execute a custom command on servers within the accessory container (use --help to show options)"
+ "help:Describe subcommands or one specific subcommand"
+ "logs:Show log lines from accessory on host (use --help to show options)"
+ "reboot:Reboot existing accessory on host (stop container, remove container, start new container; use NAME=all to boot all accessories)"
+ "remove:Remove accessory container, image and data directory from host (use NAME=all to remove all accessories)"
+ "restart:Restart existing accessory container on host"
+ "start:Start existing accessory container on host"
+ "stop:Stop existing accessory container on host"
+ "upgrade:Upgrade accessories from Kamal 1.x to 2.0 (restart them in 'kamal' network)"
+ )
+
+ _arguments -C \
+ '1: :->subcmd' \
+ '*:: :->args' && ret=0
+
+ case $state in
+ (subcmd)
+ _describe -t accessory-commands "Kamal accessory commands" accessory_subcommands && ret=0
+ ;;
+ (args)
+ case $words[1] in
+ (boot|details|exec|logs|reboot|remove|restart|start|stop)
+ # These commands require a NAME parameter
+ if (( CURRENT == 2 )); then
+ # At the NAME position - we could add accessory name completion here
+ # if we had a way to list available accessories
+ _kamal_message "Specify an accessory name (or 'all' for all accessories)" && ret=0
+ elif [[ "$words[1]" == "exec" && CURRENT == 3 ]]; then
+ # For exec, the 3rd argument is a command
+ _kamal_message "Enter a command to execute" && ret=0
+ elif (( CURRENT > 2 )) && [[ "$words[1]" != "exec" || CURRENT > 3 ]]; then
+ _values $_kamal_flags && ret=0
+ fi
+ ;;
+ (help)
+ # Remove help itself from the list of commands
+ accessory_subcommands=("${(@)accessory_subcommands:#help*}")
+ _describe -t accessory-help-commands "Kamal accessory help commands" accessory_subcommands
+ ;;
+ (upgrade)
+ # For upgrade, show flags immediately
+ _arguments $_kamal_flags && ret=0
+ ;;
+ esac
+ ;;
+ esac
+
+ return ret
+}
+
+_kamal_app() {
+ local context state line
+ typeset -A opt_args
+ local ret=1
+
+ local -a app_subcommands
+ app_subcommands=(
+ "boot:Boot app on servers (or reboot app if already running)"
+ "containers:Show app containers on servers"
+ "details:Show details about app containers"
+ "exec:Execute a custom command on servers within the app container (use --help to show options)"
+ "help:Describe subcommands or one specific subcommand"
+ "images:Show app images on servers"
+ "logs:Show log lines from app on servers (use --help to show options)"
+ "remove:Remove app containers and images from servers"
+ "stale_containers:Detect app stale containers"
+ "start:Start existing app container on servers"
+ "stop:Stop app container on servers"
+ "version:Show app version currently running on servers"
+ )
+
+ _arguments -C \
+ '1: :->subcmd' \
+ '*:: :->args' && ret=0
+
+ case $state in
+ (subcmd)
+ _describe -t app-commands "Kamal app commands" app_subcommands && ret=0
+ ;;
+ (args)
+ case $words[1] in
+ (boot|containers|details|images|logs|remove|stale_containers|start|stop)
+ _arguments $_kamal_flags && ret=0
+ ;;
+ (exec)
+ # For exec, the next argument is a command
+ if (( CURRENT == 2 )); then
+ _kamal_message "Enter a command to execute" && ret=0
+ else
+ _values $_kamal_flags && ret=0
+ fi
+ ;;
+ (help)
+ # Remove help itself from the list of commands
+ app_subcommands=("${(@)app_subcommands:#help*}")
+ _describe -t app-help-commands "Kamal app help commands" app_subcommands
+ ;;
+ esac
+ ;;
+ esac
+
+ return ret
+}
+
+_kamal_build() {
+ local context state line
+ typeset -A opt_args
+ local ret=1
+
+ local -a build_subcommands
+ build_subcommands=(
+ "create:Create a build setup"
+ "deliver:Build app and push app image to registry then pull image on servers"
+ "details:Show build setup"
+ "dev:Build using the working directory, tag it as dirty, and push to local image store."
+ "help:Describe subcommands or one specific subcommand"
+ "pull:Pull app image from registry onto servers"
+ "push:Build and push app image to registry"
+ "remove:Remove build setup"
+ )
+
+ _arguments -C \
+ '1: :->subcmd' \
+ '*:: :->args' && ret=0
+
+ case $state in
+ (subcmd)
+ _describe -t build-commands "Kamal build commands" build_subcommands && ret=0
+ ;;
+ (args)
+ case $words[1] in
+ (create|deliver|details|dev|pull|push|remove)
+ _arguments $_kamal_flags && ret=0
+ ;;
+ (help)
+ # Remove help itself from the list of commands
+ build_subcommands=("${(@)build_subcommands:#help*}")
+ _describe -t build-help-commands "Kamal build help commands" build_subcommands
+ ;;
+ esac
+ ;;
+ esac
+
+ return ret
+}
+
+_kamal_help() {
+ local ret=1
+
+ # Make sure kamal_commands is initialized properly
+ # if (( ${#kamal_commands} == 0 )); then
+ # _kamal_commands >/dev/null
+ # fi
+
+ # If we already have a command after "help", return without suggestions
+ if (( CURRENT > 2 )); then
+ ret=0
+ else
+ local -a help_commands
+ # Filter out help from the list of commands
+ help_commands=("${(@)_kamal_commands:#help}")
+
+ _values 'Kamal help' $help_commands && ret=0
+ fi
+
+ return ret
+}
+
+_kamal_lock() {
+ local context state line
+ typeset -A opt_args
+ local ret=1
+
+ local -a lock_subcommands
+ lock_subcommands=(
+ "acquire:Acquire the deploy lock"
+ "help:Describe subcommands or one specific subcommand"
+ "release:Release the deploy lock"
+ "status:Report lock status"
+ )
+
+ _arguments -C \
+ '1: :->subcmd' \
+ '*:: :->args' && ret=0
+
+ case $state in
+ (subcmd)
+ _describe -t lock-commands "Kamal lock commands" lock_subcommands && ret=0
+ ;;
+ (args)
+ case $words[1] in
+ (acquire)
+ local -a acquire_flags
+ acquire_flags=(
+ $_kamal_flags
+ '(-m --message)'{-m,--message=}'[A lock message]:message:' # Required flag
+ )
+ _arguments $acquire_flags && ret=0
+ ;;
+ (release|status)
+ _arguments $_kamal_flags && ret=0
+ ;;
+ (help)
+ # Remove help itself from the list of commands
+ lock_subcommands=("${(@)lock_subcommands:#help*}")
+ _describe -t lock-help-commands "Kamal lock help commands" lock_subcommands
+ ;;
+ esac
+ ;;
+ esac
+
+ return ret
+}
+
+_kamal_proxy() {
+ local context state line
+ typeset -A opt_args
+ local ret=1
+
+ local -a proxy_subcommands
+ proxy_subcommands=(
+ "boot:Boot proxy on servers"
+ "boot_config:Manage kamal-proxy boot configuration"
+ "details:Show details about proxy container from servers"
+ "help:Describe subcommands or one specific subcommand"
+ "logs:Show log lines from proxy on servers"
+ "reboot:Reboot proxy on servers (stop container, remove container, start new container)"
+ "remove:Remove proxy container and image from servers"
+ "restart:Restart existing proxy container on servers"
+ "start:Start existing proxy container on servers"
+ "stop:Stop existing proxy container on servers"
+ )
+
+ _arguments -C \
+ '1: :->subcmd' \
+ '*:: :->args' && ret=0
+
+ case $state in
+ (subcmd)
+ _describe -t proxy-commands "Kamal proxy commands" proxy_subcommands && ret=0
+ ;;
+ (args)
+ case $words[1] in
+ (boot|details|logs|reboot|remove|restart|start|stop)
+ _arguments $_kamal_flags && ret=0
+ ;;
+ (boot_config)
+ if (( CURRENT == 2 )); then
+ local -a boot_config_commands=(
+ "set:Set boot configuration"
+ "get:Get boot configuration"
+ "reset:Reset boot configuration"
+ )
+ _describe -t boot-config-commands "Boot config commands" boot_config_commands && ret=0
+ else
+ _values $_kamal_flags && ret=0
+ fi
+ ;;
+ (help)
+ # Remove help itself from the list of commands
+ proxy_subcommands=("${(@)proxy_subcommands:#help*}")
+ _describe -t proxy-help-commands "Kamal proxy help commands" proxy_subcommands
+ ;;
+ esac
+ ;;
+ esac
+
+ return ret
+}
+
+_kamal_prune() {
+ local context state line
+ typeset -A opt_args
+ local ret=1
+
+ local -a prune_subcommands
+ prune_subcommands=(
+ "all:Prune unused images and stopped containers"
+ "containers:Prune all stopped containers, except the last n (default 5)"
+ "help:Describe subcommands or one specific subcommand"
+ "images:Prune unused images"
+ )
+
+ _arguments -C \
+ '1: :->subcmd' \
+ '*:: :->args' && ret=0
+
+ case $state in
+ (subcmd)
+ _describe -t prune-commands "Kamal prune commands" prune_subcommands && ret=0
+ ;;
+ (args)
+ case $words[1] in
+ (all|containers|images)
+ _arguments $_kamal_flags && ret=0
+ ;;
+ (help)
+ # Remove help itself from the list of commands
+ prune_subcommands=("${(@)prune_subcommands:#help*}")
+ _describe -t prune-help-commands "Kamal prune help commands" prune_subcommands
+ ;;
+ esac
+ ;;
+ esac
+
+ return ret
+}
+
+_kamal_registry() {
+ local context state line
+ typeset -A opt_args
+ local ret=1
+
+ local -a registry_subcommands
+ registry_subcommands=(
+ "help:Describe subcommands or one specific subcommand"
+ "login:Log in to registry locally and remotely"
+ "logout:Log out of registry locally and remotely"
+ )
+
+ _arguments -C \
+ '1: :->subcmd' \
+ '*:: :->args' && ret=0
+
+ case $state in
+ (subcmd)
+ _describe -t registry-commands "Kamal registry commands" registry_subcommands && ret=0
+ ;;
+ (args)
+ case $words[1] in
+ (help)
+ # Remove help itself from the list of commands
+ registry_subcommands=("${(@)registry_subcommands:#help*}")
+ _describe -t registry-help-commands "Kamal registry help commands" registry_subcommands
+ ;;
+ (login|logout)
+ _arguments $_kamal_flags && ret=0
+ ;;
+ esac
+ ;;
+ esac
+
+ return ret
+}
+
+_kamal_secrets() {
+ local context state line
+ typeset -A opt_args
+ local ret=1
+
+ local -a secrets_subcommands
+ secrets_subcommands=(
+ "extract:Extract a single secret from the results of a fetch call"
+ "fetch:Fetch secrets from a vault"
+ "help:Describe subcommands or one specific subcommand"
+ "print:Print the secrets (for debugging)"
+ )
+
+ _arguments -C \
+ '1: :->subcmd' \
+ '*:: :->args' && ret=0
+
+ case $state in
+ (subcmd)
+ _describe -t secrets-commands "Kamal secrets commands" secrets_subcommands && ret=0
+ ;;
+ (args)
+ case $words[1] in
+ (fetch)
+ local -a fetch_flags
+ fetch_flags=(
+ $_kamal_flags
+ '(-a --adapter)'{-a,--adapter=}'[Secret storage adapter]:adapter:(aws-parameter-store)'
+ )
+ _arguments $fetch_flags && ret=0
+ ;;
+ (extract|print)
+ _arguments $_kamal_flags && ret=0
+ ;;
+ (help)
+ # Remove help itself from the list of commands
+ secrets_subcommands=("${(@)secrets_subcommands:#help*}")
+ _describe -t secrets-help-commands "Kamal secrets help commands" secrets_subcommands
+ ;;
+ esac
+ ;;
+ esac
+
+ return ret
+}
+
+_kamal_server() {
+ local context state line
+ typeset -A opt_args
+ local ret=1
+
+ local -a server_subcommands
+ server_subcommands=(
+ "bootstrap:Set up Docker to run Kamal apps"
+ "exec:Run a custom command on the server (use --help to show options)"
+ "help:Describe subcommands or one specific subcommand"
+ )
+
+ local -a server_flags
+ server_flags=(
+ $_kamal_flags
+ '(-i --interactive --no-interactive --skip-interactive)'{-i,--interactive}'[Run the command interactively]'
+ '(-i --interactive --no-interactive --skip-interactive)--no-interactive[Do not run the command interactively]'
+ '(-i --interactive --no-interactive --skip-interactive)--skip-interactive[Skip interactive mode]'
+ )
+
+ _arguments -C \
+ '1: :->subcmd' \
+ '*:: :->args' && ret=0
+
+ case $state in
+ (subcmd)
+ _describe -t server-commands "Kamal server commands" server_subcommands && ret=0
+ ;;
+ (args)
+ case $words[1] in
+ (bootstrap)
+ _arguments $server_flags && ret=0
+ ;;
+ (exec)
+ if (( CURRENT == 2 )); then
+ # For exec, the next argument is a command
+ _kamal_message "Enter a command to execute" && ret=0
+ else
+ _values $server_flags && ret=0
+ fi
+ ;;
+ (help)
+ # Remove help itself from the list of commands
+ server_subcommands=("${(@)server_subcommands:#help*}")
+ _describe -t server-help-commands "Kamal server help commands" server_subcommands
+ ;;
+ esac
+ ;;
+ esac
+
+ return ret
+}
+
+_kamal "$@" \ No newline at end of file
diff --git a/plugins/kamal/kamal.plugin.zsh b/plugins/kamal/kamal.plugin.zsh
new file mode 100644
index 000000000..e21ab4f92
--- /dev/null
+++ b/plugins/kamal/kamal.plugin.zsh
@@ -0,0 +1,25 @@
+# Find kamal binary (local ./bin/kamal or global)
+function _kamal_command () {
+ if [ -x "./bin/kamal" ]; then
+ ./bin/kamal "$@"
+ else
+ command kamal "$@"
+ fi
+}
+
+function which-kamal() {
+ if [ -x "./bin/kamal" ]; then
+ echo "Using local ./bin/kamal"
+ else
+ echo "Using global $(command -v kamal)"
+ fi
+}
+
+# Use `_kamal_command`` function for `kamal` command
+alias kamal='_kamal_command'
+
+# Aliases
+alias kad='kamal deploy'
+
+# Hook up completion
+compdef _kamal_command=kamal
diff --git a/plugins/keychain/keychain.plugin.zsh b/plugins/keychain/keychain.plugin.zsh
index f122f7982..23cf1af9a 100644
--- a/plugins/keychain/keychain.plugin.zsh
+++ b/plugins/keychain/keychain.plugin.zsh
@@ -19,8 +19,16 @@ function {
# load additional options
zstyle -a :omz:plugins:keychain options options
- # start keychain...
- keychain ${^options:-} --agents ${agents:-gpg} ${^identities} --host $SHORT_HOST
+ # Check keychain version to decide whether to use --agents
+ local version_string=$(keychain --version 2>&1)
+ # start keychain, only use --agents for versions below 2.9.0
+ autoload -Uz is-at-least
+ if [[ "$version_string" =~ 'keychain ([0-9]+\.[0-9]+)' ]] && \
+ is-at-least 2.9 "$match[1]"; then
+ keychain ${^options:-} ${^identities} --host $SHORT_HOST
+ else
+ keychain ${^options:-} --agents ${agents:-gpg} ${^identities} --host $SHORT_HOST
+ fi
# Get the filenames to store/lookup the environment from
_keychain_env_sh="$HOME/.keychain/$SHORT_HOST-sh"
diff --git a/plugins/kitty/README.md b/plugins/kitty/README.md
new file mode 100644
index 000000000..ec9e375de
--- /dev/null
+++ b/plugins/kitty/README.md
@@ -0,0 +1,23 @@
+# Kitty plugin
+
+This plugin adds a few aliases and functions that are useful for users of the [Kitty](https://sw.kovidgoyal.net/kitty/) terminal.
+
+To use it, add _kitty_ to the plugins array of your zshrc file:
+```
+plugins=(... kitty)
+```
+
+## Plugin commands
+
+* `kssh`
+ Runs a kitten ssh session that ensures your terminfo settings are copied
+ correctly to the remote hose.
+* `kssh-slow`
+ A slower form of `kssh` that should always work. Use this if `kssh` fails
+ to set terminfo correctly for you on the remote host.
+* `kitty-theme`
+ Browse and change the theme of your Kitty terminal.
+
+## Contributors
+
+- [Ian Chesal](https://github.com/ianchesal)
diff --git a/plugins/kitty/kitty.plugin.zsh b/plugins/kitty/kitty.plugin.zsh
new file mode 100644
index 000000000..1094236a7
--- /dev/null
+++ b/plugins/kitty/kitty.plugin.zsh
@@ -0,0 +1,16 @@
+#####################################################
+# Kitty plugin for oh-my-zsh #
+#####################################################
+
+if [[ "$TERM" == 'xterm-kitty' ]]; then
+ ## kssh
+ # Use this when your terminfo isn't recognized on remote hosts.
+ # See: https://sw.kovidgoyal.net/kitty/faq/#i-get-errors-about-the-terminal-being-unknown-or-opening-the-terminal-failing-when-sshing-into-a-different-computer
+ alias kssh="kitty +kitten ssh"
+ compdef kssh='ssh'
+ # Use this if kssh fails
+ alias kssh-slow="infocmp -a xterm-kitty | ssh myserver tic -x -o \~/.terminfo /dev/stdin"
+
+ # Change the colour theme
+ alias kitty-theme="kitty +kitten themes"
+fi
diff --git a/plugins/kn/kn.plugin.zsh b/plugins/kn/kn.plugin.zsh
index f60177dd9..483d1d68c 100644
--- a/plugins/kn/kn.plugin.zsh
+++ b/plugins/kn/kn.plugin.zsh
@@ -4,5 +4,5 @@
if [ $commands[kn] ]; then
source <(kn completion zsh)
- compdef _kn kn
+ compdef _kn kn
fi
diff --git a/plugins/kompose/README.md b/plugins/kompose/README.md
new file mode 100644
index 000000000..e86d9263b
--- /dev/null
+++ b/plugins/kompose/README.md
@@ -0,0 +1,12 @@
+# kompose
+
+This plugin provides completion for [kompose](https://github.com/kubernetes/kompose),
+to migrate from docker compose to Kubernetes resource definitions.
+
+To use it, add `kompose` to the plugins array in your zshrc file.
+
+```
+plugins=(... kompose)
+```
+
+**Author:** [@kevinkirkup](https://github.com/kevinkirkup)
diff --git a/plugins/kompose/kompose.plugin.zsh b/plugins/kompose/kompose.plugin.zsh
new file mode 100644
index 000000000..764e724e6
--- /dev/null
+++ b/plugins/kompose/kompose.plugin.zsh
@@ -0,0 +1,3 @@
+if [ $commands[kompose] ]; then
+ source <(kompose completion zsh)
+fi
diff --git a/plugins/kube-ps1/README.md b/plugins/kube-ps1/README.md
index 1ed3e4438..be3c184be 100644
--- a/plugins/kube-ps1/README.md
+++ b/plugins/kube-ps1/README.md
@@ -1,5 +1,4 @@
-kube-ps1: Kubernetes prompt for bash and zsh
-============================================
+# kube-ps1: Kubernetes prompt for bash and zsh
A script that lets you add the current Kubernetes context and namespace
configured on `kubectl` to your Bash/Zsh prompt strings (i.e. the `$PS1`).
@@ -136,6 +135,7 @@ the following environment variables:
| `KUBE_PS1_SUFFIX` | `)` | Prompt closing character |
| `KUBE_PS1_CLUSTER_FUNCTION` | No default, must be user supplied | Function to customize how cluster is displayed |
| `KUBE_PS1_NAMESPACE_FUNCTION` | No default, must be user supplied | Function to customize how namespace is displayed |
+| `KUBE_PS1_KUBECONFIG_SYMLINK` | `false` | Treat `KUBECONFIG` and `~/.kube/config` files as symbolic links |
For terminals that do not support UTF-8, the symbol will be replaced with the
string `k8s`.
diff --git a/plugins/kube-ps1/kube-ps1.plugin.zsh b/plugins/kube-ps1/kube-ps1.plugin.zsh
index 894e0f7f0..7edc62de8 100644
--- a/plugins/kube-ps1/kube-ps1.plugin.zsh
+++ b/plugins/kube-ps1/kube-ps1.plugin.zsh
@@ -40,6 +40,7 @@ KUBE_PS1_NS_COLOR="${KUBE_PS1_NS_COLOR-cyan}"
KUBE_PS1_BG_COLOR="${KUBE_PS1_BG_COLOR}"
KUBE_PS1_KUBECONFIG_CACHE="${KUBECONFIG}"
+KUBE_PS1_KUBECONFIG_SYMLINK="${KUBE_PS1_KUBECONFIG_SYMLINK:-false}"
KUBE_PS1_DISABLE_PATH="${HOME}/.kube/kube-ps1/disabled"
KUBE_PS1_LAST_TIME=0
KUBE_PS1_CLUSTER_FUNCTION="${KUBE_PS1_CLUSTER_FUNCTION}"
@@ -190,14 +191,26 @@ _kube_ps1_file_newer_than() {
local file=$1
local check_time=$2
- if [[ "${KUBE_PS1_SHELL}" == "zsh" ]]; then
- mtime=$(zstat +mtime "${file}")
- elif stat -c "%s" /dev/null &> /dev/null; then
- # GNU stat
- mtime=$(stat -L -c %Y "${file}")
+ if [[ "${KUBE_PS1_KUBECONFIG_SYMLINK}" == "true" ]]; then
+ if [[ "${KUBE_PS1_SHELL}" == "zsh" ]]; then
+ mtime=$(zstat -L +mtime "${file}")
+ elif stat -c "%s" /dev/null &> /dev/null; then
+ # GNU stat
+ mtime=$(stat -c %Y "${file}")
+ else
+ # BSD stat
+ mtime=$(stat -f %m "$file")
+ fi
else
- # BSD stat
- mtime=$(stat -L -f %m "$file")
+ if [[ "${KUBE_PS1_SHELL}" == "zsh" ]]; then
+ mtime=$(zstat +mtime "${file}")
+ elif stat -c "%s" /dev/null &> /dev/null; then
+ # GNU stat
+ mtime=$(stat -L -c %Y "${file}")
+ else
+ # BSD stat
+ mtime=$(stat -L -f %m "$file")
+ fi
fi
[[ "${mtime}" -gt "${check_time}" ]]
diff --git a/plugins/kubectl/README.md b/plugins/kubectl/README.md
index 579a90b3b..5e4ae7e60 100644
--- a/plugins/kubectl/README.md
+++ b/plugins/kubectl/README.md
@@ -11,122 +11,130 @@ plugins=(... kubectl)
## Aliases
-| 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** |
-| kcuc | `kubectl config use-context` | Set the current-context in a kubeconfig file |
-| kcsc | `kubectl config set-context` | Set a context entry in kubeconfig |
-| kcdc | `kubectl config delete-context` | Delete the specified context from the kubeconfig |
-| kccc | `kubectl config current-context` | Display the current-context |
-| kcgc | `kubectl config get-contexts` | List of contexts available |
-| | | **General aliases** |
-| kdel | `kubectl delete` | Delete resources by filenames, stdin, resources and names, or by resources and label selector |
-| kdelf | `kubectl delete -f` | Delete a pod using the type and name specified in -f argument |
-| | | **Pod management** |
-| kgp | `kubectl get pods` | List all pods in ps output format |
-| kgpw | `kgp --watch` | After listing/getting the requested object, watch for changes |
-| kgpwide | `kgp -o wide` | Output in plain-text format with any additional information. For pods, the node name is included |
-| kep | `kubectl edit pods` | Edit pods from the default editor |
-| kdp | `kubectl describe pods` | Describe all pods |
-| kdelp | `kubectl delete pods` | Delete all pods matching passed arguments |
-| kgpl | `kgp -l` | Get pods by label. Example: `kgpl "app=myapp" -n myns` |
-| kgpn | `kgp -n` | Get pods by namespace. Example: `kgpn kube-system` |
-| | | **Service management** |
-| kgs | `kubectl get svc` | List all services in ps output format |
-| kgsw | `kgs --watch` | After listing all services, watch for changes |
-| kgswide | `kgs -o wide` | After listing all services, output in plain-text format with any additional information |
-| kes | `kubectl edit svc` | Edit services(svc) from the default editor |
-| kds | `kubectl describe svc` | Describe all services in detail |
-| kdels | `kubectl delete svc` | Delete all services matching passed argument |
-| | | **Ingress management** |
-| kgi | `kubectl get ingress` | List ingress resources in ps output format |
-| kei | `kubectl edit ingress` | Edit ingress resource from the default editor |
-| kdi | `kubectl describe ingress` | Describe ingress resource in detail |
-| 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 --current --namespace` | 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 |
-| | | **ConfigMap management** |
-| kgcm | `kubectl get configmaps` | List the configmaps in ps output format |
-| kecm | `kubectl edit configmap` | Edit configmap resource from the default editor |
-| kdcm | `kubectl describe configmap` | Describe configmap resource in detail |
-| kdelcm | `kubectl delete configmap` | Delete the configmap |
-| | | **Secret management** |
-| kgsec | `kubectl get secret` | Get secret for decoding |
-| kdsec | `kubectl describe secret` | Describe secret resource in detail |
-| kdelsec | `kubectl delete secret` | Delete the secret |
-| | | **Deployment management** |
-| kgd | `kubectl get deployment` | Get the deployment |
-| kgdw | `kgd --watch` | After getting the deployment, watch for changes |
-| kgdwide | `kgd -o wide` | After getting the deployment, output in plain-text format with any additional information |
-| ked | `kubectl edit deployment` | Edit deployment resource from the default editor |
-| kdd | `kubectl describe deployment` | Describe deployment resource in detail |
-| 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 replicaset` | List all ReplicaSets `rs` created by the deployment |
-| kdrs | `kubectl describe replicaset` | Describe ReplicaSet in detail |
-| kers | `kubectl edit replicaset` | Edit ReplicaSet from the default editor |
-| krh | `kubectl rollout history` | Check the revisions of this deployment |
-| kru | `kubectl rollout undo` | Rollback to the previous revision |
-| | | **Port forwarding** |
-| kpf | `kubectl port-forward` | Forward one or more local ports to a pod |
-| | | **Tools for accessing all information** |
-| kga | `kubectl get all` | List all resources in ps format |
-| kgaa | `kubectl get all --all-namespaces` | List the requested object(s) across all namespaces |
-| | | **Logs** |
-| kl | `kubectl logs` | Print the logs for a container or resource |
-| klf | `kubectl logs -f` | Stream the logs for a container or resource (follow) |
-| | | **File copy** |
-| kcp | `kubectl cp` | Copy files and directories to and from containers |
-| | | **Node management** |
-| kgno | `kubectl get nodes` | List the nodes in ps output format |
-| keno | `kubectl edit node` | Edit nodes resource from the default editor |
-| kdno | `kubectl describe node` | Describe node resource in detail |
-| kdelno | `kubectl delete node` | Delete the node |
-| | | **Persistent Volume Claim management** |
-| kgpvc | `kubectl get pvc` | List all PVCs |
-| kgpvcw | `kgpvc --watch` | After listing/getting the requested object, watch for changes |
-| kepvc | `kubectl edit pvc` | Edit pvcs from the default editor |
-| kdpvc | `kubectl describe pvc` | Describe all pvcs |
-| kdelpvc | `kubectl delete pvc` | Delete all pvcs matching passed arguments |
-| | | **StatefulSets management** |
-| kgss | `kubectl get statefulset` | List the statefulsets in ps format |
-| kgssw | `kgss --watch` | After getting the list of statefulsets, watch for changes |
-| kgsswide| `kgss -o wide` | After getting the statefulsets, output in plain-text format with any additional information |
-| kess | `kubectl edit statefulset` | Edit statefulset resource from the default editor |
-| kdss | `kubectl describe statefulset` | Describe statefulset resource in detail |
-| kdelss | `kubectl delete statefulset` | Delete the statefulset |
-| ksss | `kubectl scale statefulset` | Scale a statefulset |
-| krsss | `kubectl rollout status statefulset`| Check the rollout status of a deployment |
-| | | **Service Accounts management** |
-| kdsa | `kubectl describe sa` | Describe a service account in details |
-| kdelsa | `kubectl delete sa` | Delete the service account |
-| | | **DaemonSet management** |
-| kgds | `kubectl get daemonset` | List all DaemonSets in ps output format |
-| kgdsw | `kgds --watch` | After listing all DaemonSets, watch for changes |
-| keds | `kubectl edit daemonset` | Edit DaemonSets from the default editor |
-| kdds | `kubectl describe daemonset` | Describe all DaemonSets in detail |
-| kdelds | `kubectl delete daemonset` | Delete all DaemonSets matching passed argument |
-| | | **CronJob management** |
-| kgcj | `kubectl get cronjob` | List all CronJobs in ps output format |
-| kecj | `kubectl edit cronjob` | Edit CronJob from the default editor |
-| kdcj | `kubectl describe cronjob` | Describe a CronJob in details |
-| kdelcj | `kubectl delete cronjob` | Delete the CronJob |
-| | | **Job management** |
-| kgj | `kubectl get job` | List all Job in ps output format |
-| kej | `kubectl edit job` | Edit a Job in details |
-| kdj | `kubectl describe job` | Describe the Job |
-| kdelj | `kubectl delete job` | Delete the Job |
+| 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 |
+| kapk | `kubectl apply -k` | Apply a kustomization directory |
+| keti | `kubectl exec -ti` | Drop into an interactive terminal on a container |
+| | | **Manage configuration quickly to switch contexts between local, dev and staging** |
+| kcuc | `kubectl config use-context` | Set the current-context in a kubeconfig file |
+| kcsc | `kubectl config set-context` | Set a context entry in kubeconfig |
+| kcdc | `kubectl config delete-context` | Delete the specified context from the kubeconfig |
+| kccc | `kubectl config current-context` | Display the current-context |
+| kcgc | `kubectl config get-contexts` | List of contexts available |
+| | | **General aliases** |
+| kdel | `kubectl delete` | Delete resources by filenames, stdin, resources and names, or by resources and label selector |
+| kdelf | `kubectl delete -f` | Delete a pod using the type and name specified in -f argument |
+| kdelk | `kubectl delete -k` | Delete all resources defined in a kustomization directory |
+| kge | `kubectl get events --sort-by=".lastTimestamp"` | Get events (sorted by timestamp) |
+| kgew | `kubectl get events --watch --sort-by=".lastTimestamp"` | Get events and watch as they occur (sorted by timestamp) |
+| | | **Pod management** |
+| kgp | `kubectl get pods` | List all pods in ps output format |
+| kgpl | `kgp -l` | Get pods by label. Example: `kgpl "app=myapp" -n myns` |
+| kgpn | `kgp -n` | Get pods by namespace. Example: `kgpn kube-system` |
+| kgpsl | `kubectl get pods --show-labels` | List all pods in ps output format with labels |
+| kgpw | `kgp --watch` | After listing/getting the requested object, watch for changes |
+| kgpwide | `kgp -o wide` | Output in plain-text format with any additional information. For pods, the node name is included |
+| kep | `kubectl edit pods` | Edit pods from the default editor |
+| kdp | `kubectl describe pods` | Describe all pods |
+| kdelp | `kubectl delete pods` | Delete all pods matching passed arguments |
+| | | **Service management** |
+| kgs | `kubectl get svc` | List all services in ps output format |
+| kgsw | `kgs --watch` | After listing all services, watch for changes |
+| kgswide | `kgs -o wide` | After listing all services, output in plain-text format with any additional information |
+| kes | `kubectl edit svc` | Edit services(svc) from the default editor |
+| kds | `kubectl describe svc` | Describe all services in detail |
+| kdels | `kubectl delete svc` | Delete all services matching passed argument |
+| | | **Ingress management** |
+| kgi | `kubectl get ingress` | List ingress resources in ps output format |
+| kei | `kubectl edit ingress` | Edit ingress resource from the default editor |
+| kdi | `kubectl describe ingress` | Describe ingress resource in detail |
+| 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 --current --namespace` | 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 |
+| | | **ConfigMap management** |
+| kgcm | `kubectl get configmaps` | List the configmaps in ps output format |
+| kecm | `kubectl edit configmap` | Edit configmap resource from the default editor |
+| kdcm | `kubectl describe configmap` | Describe configmap resource in detail |
+| kdelcm | `kubectl delete configmap` | Delete the configmap |
+| | | **Secret management** |
+| kgsec | `kubectl get secret` | Get secret for decoding |
+| kdsec | `kubectl describe secret` | Describe secret resource in detail |
+| kdelsec | `kubectl delete secret` | Delete the secret |
+| | | **Deployment management** |
+| kgd | `kubectl get deployment` | Get the deployment |
+| kgdw | `kgd --watch` | After getting the deployment, watch for changes |
+| kgdwide | `kgd -o wide` | After getting the deployment, output in plain-text format with any additional information |
+| ked | `kubectl edit deployment` | Edit deployment resource from the default editor |
+| kdd | `kubectl describe deployment` | Describe deployment resource in detail |
+| 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 |
+| krrd | `kubectl rollout restart deployment` | Rollout restart a deployment |
+| kres | `kubectl set env $@ REFRESHED_AT=...` | Recreate all pods in deployment with zero-downtime |
+| | | **Rollout management** |
+| kgrs | `kubectl get replicaset` | List all ReplicaSets `rs` created by the deployment |
+| kdrs | `kubectl describe replicaset` | Describe ReplicaSet in detail |
+| kers | `kubectl edit replicaset` | Edit ReplicaSet from the default editor |
+| krh | `kubectl rollout history` | Check the revisions of this deployment |
+| kru | `kubectl rollout undo` | Rollback to the previous revision |
+| | | **Port forwarding** |
+| kpf | `kubectl port-forward` | Forward one or more local ports to a pod |
+| | | **Tools for accessing all information** |
+| kga | `kubectl get all` | List all resources in ps format |
+| kgaa | `kubectl get all --all-namespaces` | List the requested object(s) across all namespaces |
+| | | **Logs** |
+| kl | `kubectl logs` | Print the logs for a container or resource |
+| klf | `kubectl logs -f` | Stream the logs for a container or resource (follow) |
+| | | **File copy** |
+| kcp | `kubectl cp` | Copy files and directories to and from containers |
+| | | **Node management** |
+| kgno | `kubectl get nodes` | List the nodes in ps output format |
+| kgnosl | `kubectl get nodes --show-labels` | List the nodes in ps output format with labels |
+| keno | `kubectl edit node` | Edit nodes resource from the default editor |
+| kdno | `kubectl describe node` | Describe node resource in detail |
+| kdelno | `kubectl delete node` | Delete the node |
+| | | **Persistent Volume Claim management** |
+| kgpvc | `kubectl get pvc` | List all PVCs |
+| kgpvcw | `kgpvc --watch` | After listing/getting the requested object, watch for changes |
+| kepvc | `kubectl edit pvc` | Edit pvcs from the default editor |
+| kdpvc | `kubectl describe pvc` | Describe all pvcs |
+| kdelpvc | `kubectl delete pvc` | Delete all pvcs matching passed arguments |
+| | | **StatefulSets management** |
+| kgss | `kubectl get statefulset` | List the statefulsets in ps format |
+| kgssw | `kgss --watch` | After getting the list of statefulsets, watch for changes |
+| kgsswide | `kgss -o wide` | After getting the statefulsets, output in plain-text format with any additional information |
+| kess | `kubectl edit statefulset` | Edit statefulset resource from the default editor |
+| kdss | `kubectl describe statefulset` | Describe statefulset resource in detail |
+| kdelss | `kubectl delete statefulset` | Delete the statefulset |
+| ksss | `kubectl scale statefulset` | Scale a statefulset |
+| krsss | `kubectl rollout status statefulset` | Check the rollout status of a deployment |
+| krrss | `kubectl rollout restart statefulset` | Rollout restart a statefulset |
+| | | **Service Accounts management** |
+| kdsa | `kubectl describe sa` | Describe a service account in details |
+| kdelsa | `kubectl delete sa` | Delete the service account |
+| | | **DaemonSet management** |
+| kgds | `kubectl get daemonset` | List all DaemonSets in ps output format |
+| kgdsw | `kgds --watch` | After listing all DaemonSets, watch for changes |
+| keds | `kubectl edit daemonset` | Edit DaemonSets from the default editor |
+| kdds | `kubectl describe daemonset` | Describe all DaemonSets in detail |
+| kdelds | `kubectl delete daemonset` | Delete all DaemonSets matching passed argument |
+| | | **CronJob management** |
+| kgcj | `kubectl get cronjob` | List all CronJobs in ps output format |
+| kecj | `kubectl edit cronjob` | Edit CronJob from the default editor |
+| kdcj | `kubectl describe cronjob` | Describe a CronJob in details |
+| kdelcj | `kubectl delete cronjob` | Delete the CronJob |
+| | | **Job management** |
+| kgj | `kubectl get job` | List all Job in ps output format |
+| kej | `kubectl edit job` | Edit a Job in details |
+| kdj | `kubectl describe job` | Describe the Job |
+| kdelj | `kubectl delete job` | Delete the Job |
## Wrappers
diff --git a/plugins/kubectl/kubectl.plugin.zsh b/plugins/kubectl/kubectl.plugin.zsh
index 0dd4e691a..ba371cd87 100644
--- a/plugins/kubectl/kubectl.plugin.zsh
+++ b/plugins/kubectl/kubectl.plugin.zsh
@@ -21,6 +21,9 @@ alias kca='_kca(){ kubectl "$@" --all-namespaces; unset -f _kca; }; _kca'
# Apply a YML file
alias kaf='kubectl apply -f'
+# Apply a kustomization directory
+alias kapk='kubectl apply -k'
+
# Drop into an interactive terminal on a container
alias keti='kubectl exec -t -i'
@@ -36,9 +39,15 @@ alias kcgc='kubectl config get-contexts'
# General aliases
alias kdel='kubectl delete'
alias kdelf='kubectl delete -f'
+alias kdelk='kubectl delete -k'
+alias kge='kubectl get events --sort-by=".lastTimestamp"'
+alias kgew='kubectl get events --sort-by=".lastTimestamp" --watch'
# Pod management.
alias kgp='kubectl get pods'
+alias kgpl='kgp -l'
+alias kgpn='kgp -n'
+alias kgpsl='kubectl get pods --show-labels'
alias kgpa='kubectl get pods --all-namespaces'
alias kgpw='kgp --watch'
alias kgpwide='kgp -o wide'
@@ -47,12 +56,6 @@ alias kdp='kubectl describe pods'
alias kdelp='kubectl delete pods'
alias kgpall='kubectl get pods --all-namespaces -o wide'
-# get pod by label: kgpl "app=myapp" -n myns
-alias kgpl='kgp -l'
-
-# get pod by namespace: kgpn kube-system"
-alias kgpn='kgp -n'
-
# Service management.
alias kgs='kubectl get svc'
alias kgsa='kubectl get svc --all-namespaces'
@@ -99,6 +102,7 @@ alias kdd='kubectl describe deployment'
alias kdeld='kubectl delete deployment'
alias ksd='kubectl scale deployment'
alias krsd='kubectl rollout status deployment'
+alias krrd='kubectl rollout restart deployment'
function kres(){
kubectl set env $@ REFRESHED_AT=$(date +%Y%m%d%H%M%S)
@@ -121,6 +125,7 @@ alias kdss='kubectl describe statefulset'
alias kdelss='kubectl delete statefulset'
alias ksss='kubectl scale statefulset'
alias krsss='kubectl rollout status statefulset'
+alias krrss='kubectl rollout restart statefulset'
# Port forwarding
alias kpf="kubectl port-forward"
@@ -144,6 +149,7 @@ alias kcp='kubectl cp'
# Node Management
alias kgno='kubectl get nodes'
+alias kgnosl='kubectl get nodes --show-labels'
alias keno='kubectl edit node'
alias kdno='kubectl describe node'
alias kdelno='kubectl delete node'
@@ -180,13 +186,23 @@ alias kej='kubectl edit job'
alias kdj='kubectl describe job'
alias kdelj='kubectl delete job'
-# Only run if the user actually has kubectl installed
-if (( ${+_comps[kubectl]} )); then
- function kj() { kubectl "$@" -o json | jq; }
- function kjx() { kubectl "$@" -o json | fx; }
- function ky() { kubectl "$@" -o yaml | yh; }
+# Utility print functions (json / yaml)
+function _build_kubectl_out_alias {
+ setopt localoptions norcexpandparam
- compdef kj=kubectl
- compdef kjx=kubectl
- compdef ky=kubectl
-fi
+ # alias function
+ eval "function $1 { $2 }"
+
+ # completion function
+ eval "function _$1 {
+ words=(kubectl \"\${words[@]:1}\")
+ _kubectl
+ }"
+
+ compdef _$1 $1
+}
+
+_build_kubectl_out_alias "kj" 'kubectl "$@" -o json | jq'
+_build_kubectl_out_alias "kjx" 'kubectl "$@" -o json | fx'
+_build_kubectl_out_alias "ky" 'kubectl "$@" -o yaml | yh'
+unfunction _build_kubectl_out_alias
diff --git a/plugins/kubectx/README.md b/plugins/kubectx/README.md
index 98f1cf032..e3987b42f 100644
--- a/plugins/kubectx/README.md
+++ b/plugins/kubectx/README.md
@@ -1,25 +1,55 @@
# kubectx - show active kubectl context
-This plugins adds ```kubectx_prompt_info()``` function. It shows name of the
-active kubectl context (```kubectl config current-context```).
+This plugins adds `kubectx_prompt_info()` function. It shows name of the active
+kubectl context (`kubectl config current-context`).
You can use it to customize prompt and know if You are on prod cluster ;)
-_Example_. Add to **.zshrc**:
+To use this plugin, add `kubectx` to the plugins array in your zshrc file:
+```zsh
+plugins=(... kubectx)
```
+
+### Usage
+
+Add to **.zshrc**:
+
+```zsh
+# right prompt
RPS1='$(kubectx_prompt_info)'
+# left prompt
+PROMPT="$PROMPT"'$(kubectx_prompt_info)'
```
-### custom ctx names
+### Custom context names
-One can rename default context name for better readability.
+You can rename the default context name for better readability or additional formatting.
+These values accept [prompt expansion sequences](http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html)
+such as `%F{color}`, `%f`, `%K{color}`, `%k`, `%B`, `%b`, `%U`, `%u`, `%S`, `%s`, `%{...%}`.
-_Example_. Add to **.zshrc**:
-```
+**Example**: add this to your .zshrc file:
+
+```zsh
kubectx_mapping[minikube]="mini"
kubectx_mapping[context_name_from_kubeconfig]="$emoji[wolf_face]"
kubectx_mapping[production_cluster]="%{$fg[yellow]%}prod!%{$reset_color%}"
+# contexts with spaces
+kubectx_mapping[context\ with\ spaces]="%F{red}spaces%f"
+# don't use quotes as it will break the prompt
+kubectx_mapping["context with spaces"]="%F{red}spaces%f" # ti
+```
+
+You can also define the whole mapping array at once:
+
+```zsh
+typeset -A kubectx_mapping
+kubectx_mapping=(
+ minikube "mini"
+ context_name_from_kubeconfig "$emoji[wolf_face]"
+ production_cluster "%{$fg[yellow]%}prod!%{$reset_color%}"
+ "context with spaces" "%F{red}spaces%f"
+)
```
![staging](stage.png)
diff --git a/plugins/kubectx/kubectx.plugin.zsh b/plugins/kubectx/kubectx.plugin.zsh
index 6096feeae..f1ca990ad 100644
--- a/plugins/kubectx/kubectx.plugin.zsh
+++ b/plugins/kubectx/kubectx.plugin.zsh
@@ -7,7 +7,9 @@ function kubectx_prompt_info() {
[[ -n "$current_ctx" ]] || return
- # use value in associative array if it exists
- # otherwise fall back to the context name
+ # Use value in associative array if it exists, otherwise fall back to the context name
+ #
+ # Note: we need to escape the % character in the prompt string when coming directly from
+ # the context name, as it could contain a % character.
echo "${kubectx_mapping[$current_ctx]:-${current_ctx:gs/%/%%}}"
}
diff --git a/plugins/laravel/README.md b/plugins/laravel/README.md
index 95f590191..c5375f270 100644
--- a/plugins/laravel/README.md
+++ b/plugins/laravel/README.md
@@ -10,6 +10,7 @@ plugins=(... laravel)
|:-:|:-:|
| `artisan` | `php artisan` |
| `pas` | `php artisan serve` |
+| `pats` | `php artisan test` |
## Database
@@ -20,6 +21,7 @@ plugins=(... laravel)
| `pamfs` | `php artisan migrate:fresh --seed` |
| `pamr` | `php artisan migrate:rollback` |
| `pads` | `php artisan db:seed` |
+| `padw` | `php artisan db:wipe` |
## Makers
@@ -35,6 +37,10 @@ plugins=(... laravel)
| `pamj` | `php artisan make:job` |
| `paml` | `php artisan make:listener` |
| `pamn` | `php artisan make:notification` |
+| `pamcl` | `php artisan make:class` |
+| `pamen` | `php artisan make:enum` |
+| `pami` | `php artisan make:interface` |
+| `pamtr` | `php artisan make:trait` |
## Clears
@@ -44,6 +50,7 @@ plugins=(... laravel)
| `pacoc` | `php artisan config:clear` |
| `pavic` | `php artisan view:clear` |
| `paroc` | `php artisan route:clear` |
+| `paopc` | `php artisan optimize:clear` |
## Queues
diff --git a/plugins/laravel/laravel.plugin.zsh b/plugins/laravel/laravel.plugin.zsh
index a8382d3c9..20a1c473e 100644
--- a/plugins/laravel/laravel.plugin.zsh
+++ b/plugins/laravel/laravel.plugin.zsh
@@ -4,6 +4,7 @@ alias bob='php artisan bob::build'
# Development
alias pas='php artisan serve'
+alias pats='php artisan test'
# Database
alias pam='php artisan migrate'
@@ -11,6 +12,7 @@ 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'
+alias padw='php artisan db:wipe'
# Makers
alias pamm='php artisan make:model'
@@ -24,6 +26,10 @@ alias pamj='php artisan make:job'
alias paml='php artisan make:listener'
alias pamn='php artisan make:notification'
alias pampp='php artisan make:provider'
+alias pamcl='php artisan make:class'
+alias pamen='php artisan make:enum'
+alias pami='php artisan make:interface'
+alias pamtr='php artisan make:trait'
# Clears
@@ -31,6 +37,7 @@ alias pacac='php artisan cache:clear'
alias pacoc='php artisan config:clear'
alias pavic='php artisan view:clear'
alias paroc='php artisan route:clear'
+alias paopc='php artisan optimize:clear'
# queues
alias paqf='php artisan queue:failed'
diff --git a/plugins/last-working-dir/last-working-dir.plugin.zsh b/plugins/last-working-dir/last-working-dir.plugin.zsh
index 684972cc1..b816f6a8f 100644
--- a/plugins/last-working-dir/last-working-dir.plugin.zsh
+++ b/plugins/last-working-dir/last-working-dir.plugin.zsh
@@ -9,20 +9,23 @@ chpwd_last_working_dir() {
[[ "$ZSH_SUBSHELL" -eq 0 ]] || return 0
# Add ".$SSH_USER" suffix to cache file if $SSH_USER is set and non-empty
local cache_file="$ZSH_CACHE_DIR/last-working-dir${SSH_USER:+.$SSH_USER}"
- builtin pwd >| "$cache_file"
+ 'builtin' 'echo' '-E' "$PWD" >| "$cache_file"
}
# Changes directory to the last working directory
lwd() {
# Add ".$SSH_USER" suffix to cache file if $SSH_USER is set and non-empty
local cache_file="$ZSH_CACHE_DIR/last-working-dir${SSH_USER:+.$SSH_USER}"
- [[ -r "$cache_file" ]] && cd "$(cat "$cache_file")"
+ [[ -r "$cache_file" ]] && cd "$(<"$cache_file")"
}
# Jump to last directory automatically unless:
-# - this isn't the first time the plugin is loaded
-# - it's not in $HOME directory
-[[ -n "$ZSH_LAST_WORKING_DIRECTORY" ]] && return
-[[ "$PWD" != "$HOME" ]] && return
+#
+# - This isn't the first time the plugin is loaded
+# - We're not in the $HOME directory (e.g. if terminal opened a different folder)
+[[ -z "$ZSH_LAST_WORKING_DIRECTORY" ]] || return
+[[ "$PWD" == "$HOME" ]] || return
-lwd 2>/dev/null && ZSH_LAST_WORKING_DIRECTORY=1 || true
+if lwd 2>/dev/null; then
+ ZSH_LAST_WORKING_DIRECTORY=1
+fi
diff --git a/plugins/localstack/README.md b/plugins/localstack/README.md
new file mode 100644
index 000000000..2c71e9edf
--- /dev/null
+++ b/plugins/localstack/README.md
@@ -0,0 +1,24 @@
+# Localstack plugin #
+
+CLI support for LOCALSTACK interaction
+
+## Description ##
+To use it, add `localstack` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... localstack)
+```
+
+## Usage ##
+
+This plugin supplies one command, `lsk`, through which all its features are exposed.
+
+## Commands
+
+| Command | Description |
+| :------------ | :-------------------------------------------------------------------- |
+| `lsk sqs-send <queue> <message.json>` | sends a given message in sqs to a given queue |
+
+## Examples
+
+![staging](sqs-send-result.png)
diff --git a/plugins/localstack/localstack.plugin.zsh b/plugins/localstack/localstack.plugin.zsh
new file mode 100644
index 000000000..080b14a54
--- /dev/null
+++ b/plugins/localstack/localstack.plugin.zsh
@@ -0,0 +1,37 @@
+# CLI support for LOCALSTACK interaction
+#
+# See README.md for details
+lsk() {
+ case $1 in
+ sqs-send)
+ shift
+ sqs-send "$@"
+ ;;
+ *)
+ echo "Command not found: $1"
+ return 1
+ ;;
+ esac
+}
+
+# Send SQS function
+#
+# This function sends a given message in sqs to a given queue, when used Localstack
+#
+# Use:
+# sqs-send <queue> <message>
+#
+# Parameters
+# <queue> A given queue
+# <message> A content of message em json archive
+#
+# Example
+# sqs-send user user.json
+sqs-send(){
+ if [ -z "$1" ]; then
+ echo "Use: sqs-send <queue> <payload>"
+ return 1
+ fi
+
+ curl -X POST "http://localhost:4566/000000000000/$1" -d "Action=SendMessage" -d "MessageBody=$(cat $2)"
+} \ No newline at end of file
diff --git a/plugins/localstack/sqs-send-result.png b/plugins/localstack/sqs-send-result.png
new file mode 100644
index 000000000..69eb2a640
--- /dev/null
+++ b/plugins/localstack/sqs-send-result.png
Binary files differ
diff --git a/plugins/lpass/_lpass b/plugins/lpass/_lpass
index 621a7bcd7..e312fb9a3 100644
--- a/plugins/lpass/_lpass
+++ b/plugins/lpass/_lpass
@@ -78,7 +78,7 @@ _lpass() {
has_sync=1
;;
status)
- _arguments : '(-q --quiet)'{-q,--quiet}'[Supress output to stdout]'
+ _arguments : '(-q --quiet)'{-q,--quiet}'[Suppress output to stdout]'
has_color=1
;;
sync)
diff --git a/plugins/macos/README.md b/plugins/macos/README.md
index 1cb9b395d..ccc4331e5 100644
--- a/plugins/macos/README.md
+++ b/plugins/macos/README.md
@@ -8,7 +8,12 @@ To start using it, add the `macos` plugin to your plugins array in `~/.zshrc`:
plugins=(... macos)
```
-Original author: [Sorin Ionescu](https://github.com/sorin-ionescu)
+## Supported Terminals
+- [iTerm](https://iterm.sourceforge.net/)
+- [iTerm2](https://iterm2.com/)
+- [Hyper](https://hyper.is/)
+- [Tabby](https://tabby.sh/)
+- [Ghostty](https://ghostty.org)
## Commands
@@ -17,7 +22,7 @@ Original author: [Sorin Ionescu](https://github.com/sorin-ionescu)
| `tab` | Open the current directory in a new tab |
| `split_tab` | Split the current terminal tab horizontally |
| `vsplit_tab` | Split the current terminal tab vertically |
-| `ofd` | Open the current directory in a Finder window |
+| `ofd` | Open passed directories (or $PWD by default) in Finder |
| `pfd` | Return the path of the frontmost Finder window |
| `pfs` | Return the current Finder selection |
| `cdf` | `cd` to the current Finder directory |
@@ -37,7 +42,9 @@ Original author: [Sorin Ionescu](https://github.com/sorin-ionescu)
## Acknowledgements
-This application makes use of the following third party scripts:
+Original author: [Sorin Ionescu](https://github.com/sorin-ionescu)
+
+This application makes use of the following third-party scripts:
[shpotify](https://github.com/hnarayanan/shpotify)
diff --git a/plugins/macos/macos.plugin.zsh b/plugins/macos/macos.plugin.zsh
index e27d412c8..4d73d22c3 100644
--- a/plugins/macos/macos.plugin.zsh
+++ b/plugins/macos/macos.plugin.zsh
@@ -3,8 +3,15 @@
0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
0="${${(M)0:#/*}:-$PWD/$0}"
-# Open the current directory in a Finder window
-alias ofd='open_command $PWD'
+# Open in Finder the directories passed as arguments, or the current directory if
+# no directories are passed
+function ofd {
+ if (( ! $# )); then
+ open_command $PWD
+ else
+ open_command $@
+ fi
+}
# Show/hide hidden files in the Finder
alias showfiles="defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder"
@@ -72,6 +79,19 @@ EOF
key code 36 #(presses enter)
end tell
EOF
+
+ elif [[ "$the_app" == 'Tabby' ]]; then
+ osascript >/dev/null <<EOF
+ tell application "System Events"
+ tell process "Tabby" to keystroke "t" using command down
+ end tell
+EOF
+ elif [[ "$the_app" == 'ghostty' ]]; then
+ osascript >/dev/null <<EOF
+ tell application "System Events"
+ tell process "Ghostty" to keystroke "t" using command down
+ end tell
+EOF
else
echo "$0: unsupported terminal app: $the_app" >&2
return 1
@@ -120,6 +140,18 @@ EOF
keystroke "${command} \n"
end tell
EOF
+ elif [[ "$the_app" == 'Tabby' ]]; then
+ osascript >/dev/null <<EOF
+ tell application "System Events"
+ tell process "Tabby" to keystroke "D" using command down
+ end tell
+EOF
+ elif [[ "$the_app" == 'ghostty' ]]; then
+ osascript >/dev/null <<EOF
+ tell application "System Events"
+ tell process "Ghostty" to keystroke "D" using command down
+ end tell
+EOF
else
echo "$0: unsupported terminal app: $the_app" >&2
return 1
@@ -169,6 +201,18 @@ EOF
keystroke "${command} \n"
end tell
EOF
+ elif [[ "$the_app" == 'Tabby' ]]; then
+ osascript >/dev/null <<EOF
+ tell application "System Events"
+ tell process "Tabby" to keystroke "d" using command down
+ end tell
+EOF
+ elif [[ "$the_app" == 'ghostty' ]]; then
+ osascript >/dev/null <<EOF
+ tell application "System Events"
+ tell process "Ghostty" to keystroke "d" using command down
+ end tell
+EOF
else
echo "$0: unsupported terminal app: $the_app" >&2
return 1
@@ -224,8 +268,10 @@ function quick-look() {
}
function man-preview() {
+ [[ $# -eq 0 ]] && >&2 echo "Usage: $0 command1 [command2 ...]" && return 1
+
local page
- for page in "${(@f)"$(man -w $@)"}"; do
+ for page in "${(@f)"$(command man -w $@)"}"; do
command mandoc -Tpdf $page | open -f -a Preview
done
}
diff --git a/plugins/macports/README.md b/plugins/macports/README.md
index 09bd42df2..ffe3f973f 100644
--- a/plugins/macports/README.md
+++ b/plugins/macports/README.md
@@ -16,7 +16,7 @@ plugins=(... macports)
| pc | `sudo port clean --all installed` | Clean up intermediate installation files for installed ports |
| pi | `sudo port install` | Install package given as argument |
| pli | `port livecheck installed` | Check for updates for installed ports |
-| plm | `port-livecheck-maintainer` | Check for updates of ports mainained by the specified users |
+| plm | `port-livecheck-maintainer` | Check for updates of ports maintained by the specified users |
| psu | `sudo port selfupdate` | Update ports tree with MacPorts repository |
| puni | `sudo port uninstall inactive` | Uninstall inactive ports |
| puo | `sudo port upgrade outdated` | Upgrade ports with newer versions available |
diff --git a/plugins/macports/_port b/plugins/macports/_port
index 897598a46..f40f6550b 100644
--- a/plugins/macports/_port
+++ b/plugins/macports/_port
@@ -1,6 +1,6 @@
#compdef port
-local subcmds
+local subcmds
# we cache the list of ports
# we shall use some cache policy to avoid problems with new ports
@@ -31,8 +31,8 @@ subcmds=(
'file'
'help'
'info'
-'install'
-'installed'
+'install'
+'installed'
'list'
'livecheck'
'location'
@@ -51,7 +51,7 @@ subcmds=(
'test'
'unarchive'
'uninstall'
-'upgrade'
+'upgrade'
'variants'
'version'
)
diff --git a/plugins/magic-enter/magic-enter.plugin.zsh b/plugins/magic-enter/magic-enter.plugin.zsh
index 55b893535..722d747f3 100644
--- a/plugins/magic-enter/magic-enter.plugin.zsh
+++ b/plugins/magic-enter/magic-enter.plugin.zsh
@@ -1,5 +1,6 @@
# Default commands
: ${MAGIC_ENTER_GIT_COMMAND:="git status -u ."} # run when in a git repository
+: ${MAGIC_ENTER_JJ_COMMAND:="jj st --no-pager ."} # run when in a jj repository
: ${MAGIC_ENTER_OTHER_COMMAND:="ls -lh ."} # run anywhere else
magic-enter() {
@@ -9,7 +10,10 @@ magic-enter() {
return
fi
- if command git rev-parse --is-inside-work-tree &>/dev/null; then
+ # needs to be before git to handle colocated repositories
+ if (( $+commands[jj] )) && command jj st >/dev/null 2>&1; then
+ BUFFER="$MAGIC_ENTER_JJ_COMMAND"
+ elif (( $+commands[git] )) && command git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
BUFFER="$MAGIC_ENTER_GIT_COMMAND"
else
BUFFER="$MAGIC_ENTER_OTHER_COMMAND"
diff --git a/plugins/marked2/README.md b/plugins/marked2/README.md
index 101343abb..2f825bc4a 100644
--- a/plugins/marked2/README.md
+++ b/plugins/marked2/README.md
@@ -1,6 +1,6 @@
## marked2
-Plugin for Marked 2, a previewer for Markdown files on Mac OS X
+Plugin for Marked 2, a previewer for Markdown files on Mac OS X
### Requirements
diff --git a/plugins/marktext/README.md b/plugins/marktext/README.md
index 71d287451..254e4e7ac 100644
--- a/plugins/marktext/README.md
+++ b/plugins/marktext/README.md
@@ -1,6 +1,6 @@
## marktext
-Plugin for MarkText, a previewer for Markdown files on Mac OS X
+Plugin for MarkText, a previewer for Markdown files on Mac OS X
### Requirements
diff --git a/plugins/minikube/minikube.plugin.zsh b/plugins/minikube/minikube.plugin.zsh
index e87abceaf..0d2737052 100644
--- a/plugins/minikube/minikube.plugin.zsh
+++ b/plugins/minikube/minikube.plugin.zsh
@@ -1,13 +1,13 @@
-# Autocompletion for Minikube.
-#
-if (( $+commands[minikube] )); then
- __MINIKUBE_COMPLETION_FILE="${ZSH_CACHE_DIR}/minikube_completion"
-
- if [[ ! -f $__MINIKUBE_COMPLETION_FILE ]]; then
- minikube completion zsh >! $__MINIKUBE_COMPLETION_FILE
- fi
-
- [[ -f $__MINIKUBE_COMPLETION_FILE ]] && source $__MINIKUBE_COMPLETION_FILE
+if (( ! $+commands[minikube] )); then
+ return
+fi
- unset __MINIKUBE_COMPLETION_FILE
+# If the completion file doesn't exist yet, we need to autoload it and
+# bind it to `minikube`. Otherwise, compinit will have already done that.
+if [[ ! -f "$ZSH_CACHE_DIR/completions/_minikube" ]]; then
+ typeset -g -A _comps
+ autoload -Uz _minikube
+ _comps[minikube]=_minikube
fi
+
+minikube completion zsh >| "$ZSH_CACHE_DIR/completions/_minikube" &|
diff --git a/plugins/mise/README.md b/plugins/mise/README.md
new file mode 100644
index 000000000..8ec05aab9
--- /dev/null
+++ b/plugins/mise/README.md
@@ -0,0 +1,32 @@
+# mise
+
+Adds integration with [mise](https://github.com/jdx/mise) (formerly `rtx`), a runtime executor compatible with
+npm, nodenv, pyenv, etc. mise is written in rust and is very fast. 20x-200x faster than asdf. With that being
+said, mise is compatible with asdf plugins and .tool-versions files. It can be used as a drop-in replacement.
+
+## Installation
+
+1. [Download & install mise](https://github.com/jdx/mise#installation) by running the following:
+
+```bash
+curl https://mise.jdx.dev/install.sh | sh
+```
+
+2. [Enable mise](https://github.com/jdx/mise#quickstart) by adding it to your `plugins` definition in
+ `~/.zshrc`.
+
+```bash
+plugins=(mise)
+```
+
+## Usage
+
+See the [mise readme](https://github.com/jdx/mise#table-of-contents) for information on how to use mise. Here
+are a few examples:
+
+```bash
+mise install node Install the current version specified in .tool-versions/.mise.toml
+mise use -g node@system Use system node as global default
+mise install node@20.0.0 Install a specific version number
+mise use -g node@20 Use node-20.x as global default
+```
diff --git a/plugins/mise/mise.plugin.zsh b/plugins/mise/mise.plugin.zsh
new file mode 100644
index 000000000..96686f6aa
--- /dev/null
+++ b/plugins/mise/mise.plugin.zsh
@@ -0,0 +1,27 @@
+# TODO: 2024-01-03 remove rtx support
+local __mise=mise
+if (( ! $+commands[mise] )); then
+ if (( $+commands[rtx] )); then
+ __mise=rtx
+ else
+ return
+ fi
+fi
+
+# Load mise hooks
+eval "$($__mise activate zsh)"
+
+# Hook mise into current environment
+eval "$($__mise hook-env -s zsh)"
+
+# If the completion file doesn't exist yet, we need to autoload it and
+# bind it to `mise`. Otherwise, compinit will have already done that.
+if [[ ! -f "$ZSH_CACHE_DIR/completions/_$__mise" ]]; then
+ typeset -g -A _comps
+ autoload -Uz _$__mise
+ _comps[$__mise]=_$__mise
+fi
+
+# Generate and load mise completion
+$__mise completion zsh >| "$ZSH_CACHE_DIR/completions/_$__mise" &|
+unset __mise
diff --git a/plugins/mix/README.md b/plugins/mix/README.md
index f0258fe88..9bbe53a41 100644
--- a/plugins/mix/README.md
+++ b/plugins/mix/README.md
@@ -17,3 +17,4 @@ plugins=(... mix)
| Ecto | [Ecto](https://hexdocs.pm/ecto/Ecto.html) |
| Hex | [Hex](https://hex.pm/) |
| Nerves | [Nerves](https://nerves-project.org/) |
+| mix_test_watch | [mix_test_watch](https://hex.pm/packages/mix_test_watch) |
diff --git a/plugins/mix/_mix b/plugins/mix/_mix
index 7940ff1c9..346fc8c4f 100644
--- a/plugins/mix/_mix
+++ b/plugins/mix/_mix
@@ -109,6 +109,7 @@ _1st_arguments=(
'release.init:Generates sample files for releases'
'run:Run the given file or expression'
"test:Run a project's tests"
+ "test.watch:Run a project's tests continuously using hex package mix_test_watch"
'test.coverage:Build report from exported test coverage'
'xref:Prints cross reference information'
'--help:Describe available tasks'
@@ -120,7 +121,7 @@ __task_list ()
local expl
declare -a tasks
- tasks=(app.config app.start app.tree archive archive.build archive.install archive.uninstall clean cmd compile compile.protocols deps deps.clean deps.compile deps.get deps.tree deps.unlock deps.update do ecto.create ecto.drop ecto.dump ecto.gen.migration ecto.gen.repo ecto.load ecto.migrate ecto.migrations ecto.rollback escript escript.build escript.install escript.uninstall firmware firmware.burn firmware.image format help hex hex.audit hex.build hex.config hex.docs hex.info hex.organization hex.key hex.outdated hex.owner hex.package hex.publish hex.registry hex.repo hex.retire hex.search hex.sponsor hex.user loadconfig local local.hex local.phoenix local.phx local.public_keys local.rebar nerves.artifact nerves.artifact.get nerves.info nerves.new nerves.release.init new phoenix.digest phoenix.gen.channel phoenix.gen.html phoenix.gen.json phoenix.gen.model phoenix.gen.secret phoenix.new phoenix.routes phoenix.server phx.digest phx.digest.clean phx.gen.auth phx.gen.cert phx.gen.channel phx.gen.context phx.gen.embedded phx.gen.html phx.gen.json phx.gen.live phx.gen.notifier phx.gen.presence phx.gen.schema phx.gen.secret phx.gen.socket phx.new phx.new.ecto phx.new.web phx.routes phx.server profile.cprof profile.eprof profile.fprof release release.init run test test.coverage xref)
+ tasks=(app.config app.start app.tree archive archive.build archive.install archive.uninstall clean cmd compile compile.protocols deps deps.clean deps.compile deps.get deps.tree deps.unlock deps.update do ecto.create ecto.drop ecto.dump ecto.gen.migration ecto.gen.repo ecto.load ecto.migrate ecto.migrations ecto.rollback escript escript.build escript.install escript.uninstall firmware firmware.burn firmware.image format help hex hex.audit hex.build hex.config hex.docs hex.info hex.organization hex.key hex.outdated hex.owner hex.package hex.publish hex.registry hex.repo hex.retire hex.search hex.sponsor hex.user loadconfig local local.hex local.phoenix local.phx local.public_keys local.rebar nerves.artifact nerves.artifact.get nerves.info nerves.new nerves.release.init new phoenix.digest phoenix.gen.channel phoenix.gen.html phoenix.gen.json phoenix.gen.model phoenix.gen.secret phoenix.new phoenix.routes phoenix.server phx.digest phx.digest.clean phx.gen.auth phx.gen.cert phx.gen.channel phx.gen.context phx.gen.embedded phx.gen.html phx.gen.json phx.gen.live phx.gen.notifier phx.gen.presence phx.gen.schema phx.gen.secret phx.gen.socket phx.new phx.new.ecto phx.new.web phx.routes phx.server profile.cprof profile.eprof profile.fprof release release.init run test test.watch test.coverage xref)
_wanted tasks expl 'help' compadd $tasks
}
@@ -145,9 +146,22 @@ case $state in
(help)
_arguments ':feature:__task_list'
;;
+ (format)
+ _arguments -C \
+ '--check-formatted' \
+ '--dot-formatter' \
+ '--dry-run' \
+ '--force' \
+ '--migrate' \
+ '--no-exit' \
+ '*::file:_files'
+ ;;
(test)
_files
;;
+ (test.watch)
+ _files
+ ;;
(run)
_files
;;
diff --git a/plugins/mongo-atlas/README.md b/plugins/mongo-atlas/README.md
index ef1b5e0d2..94183c544 100644
--- a/plugins/mongo-atlas/README.md
+++ b/plugins/mongo-atlas/README.md
@@ -1,6 +1,6 @@
# MongoDB Atlas plugin
-This plugin adds completion for [Atlas](https://www.mongodb.com/docs/atlas/cli/stable/) a command line interface built specifically for
+This plugin adds completion for [Atlas](https://www.mongodb.com/docs/atlas/cli/stable/) a command line interface built specifically for
MongoDB Atlas.
To use it, add `mongo-atlas` to the plugins array in your zshrc file:
diff --git a/plugins/mvn/README.md b/plugins/mvn/README.md
index 4181fedc5..bcb26482e 100644
--- a/plugins/mvn/README.md
+++ b/plugins/mvn/README.md
@@ -33,6 +33,8 @@ if it's found, or the mvn command otherwise.
| `mvnct` | `mvn clean test` |
| `mvncv` | `mvn clean verify` |
| `mvncvst` | `mvn clean verify -DskipTests` |
+| `mvnv` | `mvn verify` |
+| `mvnvst` | `mvn verify -DskipTests` |
| `mvndp` | `mvn deploy` |
| `mvndocs` | `mvn dependency:resolve -Dclassifier=javadoc` |
| `mvndt` | `mvn dependency:tree` |
diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh
index a569a87fa..8477722b0 100644
--- a/plugins/mvn/mvn.plugin.zsh
+++ b/plugins/mvn/mvn.plugin.zsh
@@ -62,6 +62,8 @@ alias mvncp='mvn clean package'
alias mvnct='mvn clean test'
alias mvncv='mvn clean verify'
alias mvncvst='mvn clean verify -DskipTests'
+alias mvnv='mvn verify'
+alias mvnvst='mvn verify -DskipTests'
alias mvndp='mvn deploy'
alias mvndocs='mvn dependency:resolve -Dclassifier=javadoc'
alias mvndt='mvn dependency:tree'
@@ -101,8 +103,14 @@ function listMavenCompletions {
new_file="../pom.xml"
fi
- # if file doesn't exist break
file="${file:h}/${new_file}"
+
+ # if the file points to a directory, assume it is a pom.xml in that directory
+ if [[ -d "$file" ]]; then
+ file="${file}/pom.xml"
+ fi
+
+ # if file doesn't exist break
if ! [[ -e "$file" ]]; then
break
fi
diff --git a/plugins/n98-magerun/n98-magerun.plugin.zsh b/plugins/n98-magerun/n98-magerun.plugin.zsh
index d79aee7eb..2744ad96e 100644
--- a/plugins/n98-magerun/n98-magerun.plugin.zsh
+++ b/plugins/n98-magerun/n98-magerun.plugin.zsh
@@ -1,6 +1,6 @@
# ------------------------------------------------------------------------------
# FILE: n98-magerun.plugin.zsh
-# DESCRIPTION: oh-my-zsh n98-magerun plugin file. Adapted from composer plugin
+# DESCRIPTION: oh-my-zsh n98-magerun plugin file. Adapted from composer plugin
# AUTHOR: Andrew Dwyer (andrewrdwyer at gmail dot com)
# AUTHOR: Jisse Reitsma (jisse at yireo dot com)
# VERSION: 1.1.0
diff --git a/plugins/nestjs/README.md b/plugins/nestjs/README.md
new file mode 100644
index 000000000..295618214
--- /dev/null
+++ b/plugins/nestjs/README.md
@@ -0,0 +1,52 @@
+# NestJS Plugin for Oh My Zsh
+
+This plugin provides aliases for common [NestJS CLI](https://docs.nestjs.com/cli/overview) commands.
+
+## Requirements
+
+- [NestJS CLI](https://docs.nestjs.com/cli/overview#installation) installed globally:
+ `npm install -g @nestjs/cli`
+
+## Aliases
+
+| Alias | Command | Description |
+| :------ | :--------------------------- | :------------------------------------------ |
+| `nnew` | `nest new` | Create a new NestJS project |
+| `nb` | `nest build` | Build the NestJS application |
+| `ns` | `nest start` | Start the application |
+| `nsw` | `nest start --watch` | Start the application in watch mode |
+| `nsd` | `nest start --dev` | Start the application in dev mode |
+| `nsdbg` | `nest start --debug --watch` | Start the application in debug & watch mode |
+| `ng` | `nest generate` | Generate a NestJS element |
+| `ngm` | `nest generate module` | Generate a module |
+| `ngc` | `nest generate controller` | Generate a controller |
+| `ngs` | `nest generate service` | Generate a service |
+| `ngg` | `nest generate guard` | Generate a guard |
+| `ngp` | `nest generate pipe` | Generate a pipe |
+| `ngf` | `nest generate filter` | Generate a filter |
+| `ngr` | `nest generate resolver` | Generate a GraphQL resolver |
+| `ngcl` | `nest generate class` | Generate a class |
+| `ngi` | `nest generate interface` | Generate an interface |
+| `ngit` | `nest generate interceptor` | Generate an interceptor |
+| `ngmi` | `nest generate middleware` | Generate a middleware |
+| `ngd` | `nest generate decorator` | Generate a custom decorator |
+| `ngres` | `nest generate resource` | Generate a CRUD resource |
+| `nglib` | `nest generate library` | Generate a new library |
+| `ngsub` | `nest generate sub-app` | Generate a new sub-application (monorepo) |
+| `na` | `nest add` | Add a library to the project |
+| `ni` | `nest info` | Display NestJS project information |
+| `nu` | `nest update` | Update NestJS dependencies |
+
+## Usage
+
+1. Add `nestjs` to the `plugins` array in your `~/.zshrc` file:
+
+```zsh
+plugins=(... nestjs)
+```
+
+2. Restart your terminal or source your `~/.zshrc` file:
+
+```zsh
+source ~/.zshrc
+```
diff --git a/plugins/nestjs/nestjs.plugin.zsh b/plugins/nestjs/nestjs.plugin.zsh
new file mode 100644
index 000000000..9496abdeb
--- /dev/null
+++ b/plugins/nestjs/nestjs.plugin.zsh
@@ -0,0 +1,41 @@
+# Oh My Zsh plugin for NestJS CLI
+
+# Check if nest command exists
+if ! command -v nest &>/dev/null; then
+ return
+fi
+
+# Project creation
+alias nnew='nest new'
+
+# Basic development
+alias nb='nest build'
+alias ns='nest start'
+alias nsw='nest start --watch'
+alias nsd='nest start --dev' # Alias for start --watch
+alias nsdbg='nest start --debug --watch'
+
+# Code generation (short aliases)
+alias ng='nest generate'
+alias ngm='nest generate module'
+alias ngc='nest generate controller'
+alias ngs='nest generate service'
+alias ngg='nest generate guard'
+alias ngp='nest generate pipe'
+alias ngf='nest generate filter'
+alias ngr='nest generate resolver'
+alias ngcl='nest generate class'
+alias ngi='nest generate interface'
+alias ngit='nest generate interceptor'
+alias ngmi='nest generate middleware'
+alias ngd='nest generate decorator'
+alias ngres='nest generate resource'
+alias nglib='nest generate library'
+alias ngsub='nest generate sub-app'
+
+# Other commands
+alias na='nest add'
+alias ni='nest info'
+alias nu='nest update'
+
+# You can add more aliases or functions here as needed.
diff --git a/plugins/ngrok/README.md b/plugins/ngrok/README.md
new file mode 100644
index 000000000..6c37b1905
--- /dev/null
+++ b/plugins/ngrok/README.md
@@ -0,0 +1,20 @@
+# ngrok plugin
+
+This plugin adds completion for the [ngrok](https://ngrok.com) CLI.
+
+To use it, add `ngrok` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... ngrok)
+```
+
+This plugin does not add any aliases.
+
+## Cache
+
+This plugin caches the completion script and is automatically updated asynchronously when the plugin is
+loaded, which is usually when you start up a new terminal emulator.
+
+The cache is stored at:
+
+- `$ZSH_CACHE/completions/_ngrok` completions script
diff --git a/plugins/ngrok/ngrok.plugin.zsh b/plugins/ngrok/ngrok.plugin.zsh
new file mode 100644
index 000000000..ca3c82db0
--- /dev/null
+++ b/plugins/ngrok/ngrok.plugin.zsh
@@ -0,0 +1,14 @@
+# Autocompletion for ngrok
+if (( ! $+commands[ngrok] )); then
+ return
+fi
+
+# If the completion file doesn't exist yet, we need to autoload it and
+# bind it to `ngrok`. Otherwise, compinit will have already done that.
+if [[ ! -f "$ZSH_CACHE_DIR/completions/_ngrok" ]]; then
+ typeset -g -A _comps
+ autoload -Uz _ngrok
+ _comps[ngrok]=_ngrok
+fi
+
+ngrok completion zsh >| "$ZSH_CACHE_DIR/completions/_ngrok" &|
diff --git a/plugins/nmap/nmap.plugin.zsh b/plugins/nmap/nmap.plugin.zsh
index 406870f00..f649dafc2 100644
--- a/plugins/nmap/nmap.plugin.zsh
+++ b/plugins/nmap/nmap.plugin.zsh
@@ -27,6 +27,6 @@ alias nmap_detect_versions="sudo nmap -sV -p1-65535 -O --osscan-guess -T4 -Pn"
alias nmap_check_for_vulns="nmap --script=vuln"
alias nmap_full_udp="sudo nmap -sS -sU -T4 -A -v -PE -PS22,25,80 -PA21,23,80,443,3389 "
alias nmap_traceroute="sudo nmap -sP -PE -PS22,25,80 -PA21,23,80,3389 -PU -PO --traceroute "
-alias nmap_full_with_scripts="sudo nmap -sS -sU -T4 -A -v -PE -PP -PS21,22,23,25,80,113,31339 -PA80,113,443,10042 -PO --script all "
+alias nmap_full_with_scripts="sudo nmap -sS -sU -T4 -A -v -PE -PP -PS21,22,23,25,80,113,31339 -PA80,113,443,10042 -PO --script all "
alias nmap_web_safe_osscan="sudo nmap -p 80,443 -O -v --osscan-guess --fuzzy "
alias nmap_ping_scan="nmap -n -sP"
diff --git a/plugins/nomad/_nomad b/plugins/nomad/_nomad
index 1c935a02e..87f80aa84 100644
--- a/plugins/nomad/_nomad
+++ b/plugins/nomad/_nomad
@@ -89,7 +89,7 @@ __plan() {
'-address=[(addr) The address of the Nomad server. Overrides the NOMAD_ADDR environment variable if set. Default = http://127.0.0.1:4646]' \
'-region=[(region) The region of the Nomad servers to forward commands to. Overrides the NOMAD_REGION environment variable if set. Defaults to the Agent s local region.]' \
'-no-color[Disables colored command output.]' \
- '-diff[Determines whether the diff between the remote job and planned job is shown. Defaults to true.]'
+ '-diff[Determines whether the diff between the remote job and planned job is shown. Defaults to true.]'
}
__run() {
@@ -97,7 +97,7 @@ __run() {
'-address=[(addr) The address of the Nomad server. Overrides the NOMAD_ADDR environment variable if set. Default = http://127.0.0.1:4646]' \
'-region=[(region) The region of the Nomad servers to forward commands to. Overrides the NOMAD_REGION environment variable if set. Defaults to the Agent s local region.]' \
'-no-color[Disables colored command output.]' \
- '-check-index[If set, the job is only registered or updated if the the passed job modify index matches the server side version. If a check-index value of zero is passed, the job is only registered if it does not yet exist. If a non-zero value is passed, it ensures that the job is being updated from a known state. The use of this flag is most common in conjunction with plan command.]' \
+ '-check-index[If set, the job is only registered or updated if the passed job modify index matches the server side version. If a check-index value of zero is passed, the job is only registered if it does not yet exist. If a non-zero value is passed, it ensures that the job is being updated from a known state. The use of this flag is most common in conjunction with plan command.]' \
'-detach[Return immediately instead of entering monitor mode. After job submission, the evaluation ID will be printed to the screen, which can be used to examine the evaluation using the eval-status command.]' \
'-output[Output the JSON that would be submitted to the HTTP API without submitting the job.]' \
'-verbose[Show full information.]'
diff --git a/plugins/npm/npm.plugin.zsh b/plugins/npm/npm.plugin.zsh
index 23377b085..c333f76ed 100644
--- a/plugins/npm/npm.plugin.zsh
+++ b/plugins/npm/npm.plugin.zsh
@@ -58,7 +58,7 @@ alias npmt="npm test"
# Run npm scripts
alias npmR="npm run"
-# Run npm publish
+# Run npm publish
alias npmP="npm publish"
# Run npm init
diff --git a/plugins/nvm/README.md b/plugins/nvm/README.md
index b5ef221d3..1245f66db 100644
--- a/plugins/nvm/README.md
+++ b/plugins/nvm/README.md
@@ -26,9 +26,10 @@ These settings should go in your zshrc file, before Oh My Zsh is sourced:
#### Lazy startup
This option will help you to defer nvm's load until you use it to speed-up your zsh startup. This will source
-nvm script only when using it, and will create a function for `node`, `npm`, `npx`, `pnpm`, `yarn`, and the
-command(s) specified by `lazy-cmd` option, so when you call either of them, nvm will be loaded and run with
-default version. To enable it, you can add this snippet to your zshrc, before Oh My Zsh is sourced:
+nvm script only when using it, and will create a function for `node`, `npm`, `npx`, `pnpm`, `pnpx`, `yarn`,
+`corepack` and the command(s) specified by `lazy-cmd` option, so when you call either of them, nvm will be
+loaded and run with default version. To enable it, you can add this snippet to your zshrc, before Oh My Zsh is
+sourced:
```zsh
zstyle ':omz:plugins:nvm' lazy yes
@@ -41,10 +42,11 @@ as you want:
zstyle ':omz:plugins:nvm' lazy-cmd eslint prettier typescript ...
```
+There will be a function `_omz_nvm_load` available to load `nvm` without executing any other trigger command.
+
#### `.nvmrc` autoload
-Note: _this option cannot be used at the same time as `lazy`. `autoload` will override it and load `nvm` at
-startup._
+Note: _if used at the same time as `lazy`, `autoload` will start working only after nvm has been lazy-loaded_
If set, the plugin will automatically load a node version when if finds a
[`.nvmrc` file](https://github.com/nvm-sh/nvm#nvmrc) in the current working directory indicating which node
diff --git a/plugins/nvm/_nvm b/plugins/nvm/_nvm
deleted file mode 100644
index e292a8d8c..000000000
--- a/plugins/nvm/_nvm
+++ /dev/null
@@ -1,34 +0,0 @@
-#compdef nvm
-#autoload
-
-[[ -f "$NVM_DIR/nvm.sh" ]] || return 0
-
-local -a _1st_arguments
-_1st_arguments=(
- 'help:show help'
- '--version:print out the latest released version of nvm'
- 'install:download and install a version in <node|iojs|node version number>'
- 'install-latest-npm:download and install the latest npm version'
- 'uninstall:uninstall a version'
- 'use:modify PATH to use <version>. Uses .nvmrc if available'
- 'exec:run <command> on <version>. Uses .nvmrc if available'
- 'run:run `node` on <version> with <args> as arguments. Uses .nvmrc if available'
- 'current:list installed versions'
- 'ls:list installed versions or versions matching a given description'
- 'version:resolve the given description to a single local version'
- 'version-remote:resolve the given description to a single remote version'
- 'ls-remote:list remote versions available for install'
- 'deactivate:undo effects of `nvm` on current shell'
- 'alias:show or set aliases'
- 'unalias:deletes an alias'
- 'reinstall-packages:reinstall global `npm` packages contained in <version> to current version'
- 'unload:unload `nvm` from shell'
- 'which:display path to installed node version. Uses .nvmrc if available'
-)
-
-_arguments -C '*:: :->subcmds' && return 0
-
-if (( CURRENT == 1 )); then
- _describe -t commands "nvm subcommand" _1st_arguments
- return
-fi
diff --git a/plugins/nvm/nvm.plugin.zsh b/plugins/nvm/nvm.plugin.zsh
index 1badbeab5..682bddc47 100644
--- a/plugins/nvm/nvm.plugin.zsh
+++ b/plugins/nvm/nvm.plugin.zsh
@@ -1,3 +1,7 @@
+# Don't try to load nvm if command already available
+# Note: nvm is a function so we need to use `which`
+which nvm &>/dev/null && return
+
# See https://github.com/nvm-sh/nvm#installation-and-update
if [[ -z "$NVM_DIR" ]]; then
if [[ -d "$HOME/.nvm" ]]; then
@@ -12,52 +16,49 @@ if [[ -z "$NVM_DIR" ]]; then
fi
fi
-# Don't try to load nvm if command already available
-# Note: nvm is a function so we need to use `which`
-which nvm &>/dev/null && return
-
-if [[ -z "$NVM_DIR" ]] || [[ ! -f "$NVM_DIR/nvm.sh" ]]; then
+if [[ -z "$NVM_DIR" ]] || [[ ! -f "$NVM_DIR/nvm.sh" ]]; then
return
fi
-if zstyle -t ':omz:plugins:nvm' lazy && \
- ! zstyle -t ':omz:plugins:nvm' autoload; then
- # Call nvm when first using nvm, node, npm, pnpm, yarn or other commands in lazy-cmd
- zstyle -a ':omz:plugins:nvm' lazy-cmd nvm_lazy_cmd
- eval "
- function nvm node npm npx pnpm yarn $nvm_lazy_cmd {
- unfunction nvm node npm npx pnpm yarn $nvm_lazy_cmd
- # Load nvm if it exists in \$NVM_DIR
- [[ -f \"\$NVM_DIR/nvm.sh\" ]] && source \"\$NVM_DIR/nvm.sh\"
- \"\$0\" \"\$@\"
- }
- "
- unset nvm_lazy_cmd
-else
- source "$NVM_DIR/nvm.sh"
-fi
+function _omz_nvm_setup_completion {
+ local _nvm_completion
+ # Load nvm bash completion
+ for _nvm_completion in "$NVM_DIR/bash_completion" "$NVM_HOMEBREW/etc/bash_completion.d/nvm"; do
+ if [[ -f "$_nvm_completion" ]]; then
+ # Load bashcompinit
+ autoload -U +X bashcompinit && bashcompinit
+ # Bypass compinit call in nvm bash completion script. See:
+ # https://github.com/nvm-sh/nvm/blob/4436638/bash_completion#L86-L93
+ ZSH_VERSION= source "$_nvm_completion"
+ break
+ fi
+ done
+ unfunction _omz_nvm_setup_completion
+}
+
+function _omz_nvm_setup_autoload {
+ if ! zstyle -t ':omz:plugins:nvm' autoload; then
+ unfunction _omz_nvm_setup_autoload
+ return
+ fi
-# Autoload nvm when finding a .nvmrc file in the current directory
-# Adapted from: https://github.com/nvm-sh/nvm#zsh
-if zstyle -t ':omz:plugins:nvm' autoload; then
+ # Autoload nvm when finding a .nvmrc file in the current directory
+ # Adapted from: https://github.com/nvm-sh/nvm#zsh
function load-nvmrc {
- local node_version="$(nvm version)"
local nvmrc_path="$(nvm_find_nvmrc)"
local nvm_silent=""
zstyle -t ':omz:plugins:nvm' silent-autoload && nvm_silent="--silent"
if [[ -n "$nvmrc_path" ]]; then
- local nvmrc_node_version=$(nvm version $(cat "$nvmrc_path" | tr -dc '[:print:]'))
+ local nvmrc_node_version=$(nvm version $(command cat "$nvmrc_path" | tr -dc '[:print:]'))
if [[ "$nvmrc_node_version" = "N/A" ]]; then
nvm install
- elif [[ "$nvmrc_node_version" != "$node_version" ]]; then
+ elif [[ "$nvmrc_node_version" != "$(nvm version)" ]]; then
nvm use $nvm_silent
fi
- elif [[ "$node_version" != "$(nvm version default)" ]]; then
- if [[ -z $nvm_silent ]]; then
- echo "Reverting to nvm default version"
- fi
+ elif [[ -n "$(PWD=$OLDPWD nvm_find_nvmrc)" ]] && [[ "$(nvm version)" != "$(nvm version default)" ]]; then
+ [[ -z $nvm_silent ]] && echo "Reverting to nvm default version"
nvm use default $nvm_silent
fi
@@ -67,18 +68,32 @@ if zstyle -t ':omz:plugins:nvm' autoload; then
add-zsh-hook chpwd load-nvmrc
load-nvmrc
-fi
+ unfunction _omz_nvm_setup_autoload
+}
-# Load nvm bash completion
-for nvm_completion in "$NVM_DIR/bash_completion" "$NVM_HOMEBREW/etc/bash_completion.d/nvm"; do
- if [[ -f "$nvm_completion" ]]; then
- # Load bashcompinit
- autoload -U +X bashcompinit && bashcompinit
- # Bypass compinit call in nvm bash completion script. See:
- # https://github.com/nvm-sh/nvm/blob/4436638/bash_completion#L86-L93
- ZSH_VERSION= source "$nvm_completion"
- break
- fi
-done
-
-unset NVM_HOMEBREW nvm_completion
+if zstyle -t ':omz:plugins:nvm' lazy; then
+ # Call nvm when first using nvm, node, npm, pnpm, yarn, corepack or other commands in lazy-cmd
+ zstyle -a ':omz:plugins:nvm' lazy-cmd nvm_lazy_cmd
+ nvm_lazy_cmd=(_omz_nvm_load nvm node npm npx pnpm pnpx yarn corepack $nvm_lazy_cmd) # default values
+ eval "
+ function $nvm_lazy_cmd {
+ for func in $nvm_lazy_cmd; do
+ if (( \$+functions[\$func] )); then
+ unfunction \$func
+ fi
+ done
+ # Load nvm if it exists in \$NVM_DIR
+ [[ -f \"\$NVM_DIR/nvm.sh\" ]] && source \"\$NVM_DIR/nvm.sh\"
+ _omz_nvm_setup_completion
+ _omz_nvm_setup_autoload
+ if [[ \"\$0\" != _omz_nvm_load ]]; then
+ \"\$0\" \"\$@\"
+ fi
+ }
+ "
+ unset nvm_lazy_cmd
+else
+ source "$NVM_DIR/nvm.sh"
+ _omz_nvm_setup_completion
+ _omz_nvm_setup_autoload
+fi
diff --git a/plugins/opentofu/README.md b/plugins/opentofu/README.md
new file mode 100644
index 000000000..059664d47
--- /dev/null
+++ b/plugins/opentofu/README.md
@@ -0,0 +1,61 @@
+# OpenTofu plugin
+
+Plugin for OpenTofu, a fork of Terraform that is open-source, community-driven, and managed by the Linux Foundation. It adds
+completion for `tofu` command, as well as aliases and a prompt function.
+
+To use it, add `opentofu` to the plugins array of your `~/.zshrc` file:
+
+```shell
+plugins=(... opentofu)
+```
+
+## Requirements
+
+- [OpenTofu](https://opentofu.org/)
+
+## Aliases
+
+| Alias | Command |
+|--------|------------------------------|
+| `tt` | `tofu` |
+| `tta` | `tofu apply` |
+| `tta!` | `tofu apply -auto-approve` |
+| `ttc` | `tofu console` |
+| `ttd` | `tofu destroy` |
+| `ttd!` | `tofu destroy -auto-approve` |
+| `ttf` | `tofu fmt` |
+| `ttfr` | `tofu fmt -recursive` |
+| `tti` | `tofu init` |
+| `tto` | `tofu output` |
+| `ttp` | `tofu plan` |
+| `ttv` | `tofu validate` |
+| `tts` | `tofu state` |
+| `ttsh` | `tofu show` |
+| `ttr` | `tofu refresh` |
+| `ttt` | `tofu test` |
+| `ttws` | `tofu workspace` |
+
+
+## Prompt functions
+
+- `tofu_prompt_info`: shows the current workspace when in an OpenTofu project directory.
+
+- `tofu_version_prompt_info`: shows the current version of the `tofu` command.
+
+To use them, add them to a `PROMPT` variable in your theme or `.zshrc` file:
+
+```sh
+PROMPT='$(tofu_prompt_info)'
+RPROMPT='$(tofu_version_prompt_info)'
+```
+
+You can also specify the PREFIX and SUFFIX strings for both functions, with the following variables:
+
+```sh
+# for tofu_prompt_info
+ZSH_THEME_TOFU_PROMPT_PREFIX="%{$fg[white]%}"
+ZSH_THEME_TOFU_PROMPT_SUFFIX="%{$reset_color%}"
+# for tofu_version_prompt_info
+ZSH_THEME_TOFU_VERSION_PROMPT_PREFIX="%{$fg[white]%}"
+ZSH_THEME_TOFU_VERSION_PROMPT_SUFFIX="%{$reset_color%}"
+```
diff --git a/plugins/opentofu/opentofu.plugin.zsh b/plugins/opentofu/opentofu.plugin.zsh
new file mode 100644
index 000000000..b7a3ba3b6
--- /dev/null
+++ b/plugins/opentofu/opentofu.plugin.zsh
@@ -0,0 +1,46 @@
+# set up the tofu completion (compatible for zsh)
+autoload -Uz bashcompinit && bashcompinit
+complete -C tofu tofu
+
+# tofu workspace prompt function
+function tofu_prompt_info() {
+ # only show the workspace name if we're in an opentofu project
+ # i.e. if a .terraform directory exists within the hierarchy
+ local dir="$PWD"
+ while [[ ! -d "${dir}/.terraform" ]]; do
+ [[ "$dir" != / ]] || return 0 # stop at the root directory
+ dir="${dir:h}" # get the parent directory
+ done
+
+ # workspace might be different than the .terraform/environment file
+ # for example, if set with the TF_WORKSPACE environment variable
+ local workspace="$(tofu workspace show)"
+ # make sure to escape % signs in the workspace name to prevent command injection
+ echo "${ZSH_THEME_TOFU_PROMPT_PREFIX-[}${workspace:gs/%/%%}${ZSH_THEME_TOFU_PROMPT_SUFFIX-]}"
+}
+
+# tofu version prompt function
+function tofu_version_prompt_info() {
+ # get the output of `tofu --version` in a single line, and get the second word after splitting by a space
+ local tofu_version=${${(s: :)$(tofu --version)}[2]}
+ # make sure to escape % signs in the version string to prevent command injection
+ echo "${ZSH_THEME_TOFU_VERSION_PROMPT_PREFIX-[}${tofu_version:gs/%/%%}${ZSH_THEME_TOFU_VERSION_PROMPT_SUFFIX-]}"
+}
+
+alias tt='tofu'
+alias tta='tofu apply'
+alias tta!='tofu apply -auto-approve'
+alias ttc='tofu console'
+alias ttd='tofu destroy'
+alias ttd!='tofu destroy -auto-approve'
+alias ttf='tofu fmt'
+alias ttfr='tofu fmt -recursive'
+alias tti='tofu init'
+alias tto='tofu output'
+alias ttp='tofu plan'
+alias ttv='tofu validate'
+alias tts='tofu state'
+alias ttsh='tofu show'
+alias ttr='tofu refresh'
+alias ttt='tofu test'
+alias ttws='tofu workspace'
diff --git a/plugins/otp/README.md b/plugins/otp/README.md
index 8331fd02b..52ad9525b 100644
--- a/plugins/otp/README.md
+++ b/plugins/otp/README.md
@@ -16,7 +16,7 @@ Provided aliases:
email address). Then the OTP key needs to be pasted, followed by a CTRL+D character
inserted on an empty line.
-- `ot`: generates a MFA code based on the given key and copies it to the clipboard
+- `ot`: generates a MFA code based on the given key and copies it to the clipboard
(on Linux it relies on xsel, on MacOS X it uses pbcopy instead).
The plugin uses `$HOME/.otp` to store its internal files.
diff --git a/plugins/pass/_pass b/plugins/pass/_pass
index d911e122f..c66d99318 100644
--- a/plugins/pass/_pass
+++ b/plugins/pass/_pass
@@ -20,6 +20,8 @@
_pass () {
local cmd
+ local rootcontext
+ rootcontext=$curcontext
if (( CURRENT > 2)); then
cmd=${words[2]}
# Set the context for the subcommand.
@@ -123,8 +125,9 @@ _pass_cmd_show () {
_pass_complete_entries_helper () {
local IFS=$'\n'
local prefix
- zstyle -s ":completion:${curcontext}:" prefix prefix || prefix="${PASSWORD_STORE_DIR:-$HOME/.password-store}"
- _values -C 'passwords' ${$(find -L "$prefix" \( -name .git -o -name .gpg-id \) -prune -o $@ -print 2>/dev/null | sed -e "s#${prefix}/\{0,1\}##" -e 's#\.gpg##' -e 's#\\#\\\\#g' -e 's#:#\\:#g' | sort):-""}
+ zstyle -s ":completion:${rootcontext}:" prefix prefix ||
+prefix="${PASSWORD_STORE_DIR:-$HOME/.password-store}"
+ _values -C 'passwords' ${$(find -L "$prefix" \( -name .git -o -name .gpg-id \) -prune -o $@ -print 2>/dev/null | sed -e "s#${prefix}/\{0,1\}##" -e 's#\.gpg##' -e 's#\\#\\\\#g' -e 's#:#\\:#g' | sort):-""}
}
_pass_complete_entries_with_subdirs () {
diff --git a/plugins/per-directory-history/README.md b/plugins/per-directory-history/README.md
index 11150b059..c7d062a0c 100644
--- a/plugins/per-directory-history/README.md
+++ b/plugins/per-directory-history/README.md
@@ -1,5 +1,4 @@
-per-directory-history plugin
-----------------------------
+# per-directory-history plugin
This plugin adds per-directory history for zsh, as well as a global history,
and the ability to toggle between them with a keyboard shortcut. This is a
@@ -36,6 +35,7 @@ toggle set the `PER_DIRECTORY_HISTORY_TOGGLE` environment variable.
function above (default `^G`)
* `PER_DIRECTORY_HISTORY_PRINT_MODE_CHANGE` is a variable which toggles whether
the current mode is printed to the screen following a mode change (default `true`)
+* `HISTORY_START_WITH_GLOBAL` is a global variable that defines how to start the plugin: global or local (default `false`)
## History
diff --git a/plugins/per-directory-history/per-directory-history.zsh b/plugins/per-directory-history/per-directory-history.zsh
index b33e0b5dd..926373ae0 100644
--- a/plugins/per-directory-history/per-directory-history.zsh
+++ b/plugins/per-directory-history/per-directory-history.zsh
@@ -21,7 +21,7 @@
#-------------------------------------------------------------------------------
#
# The idea/inspiration for a per directory history is from Stewart MacArthur[1]
-# and Dieter[2], the implementation idea is from Bart Schaefer on the the zsh
+# and Dieter[2], the implementation idea is from Bart Schaefer on the zsh
# mailing list[3]. The implementation is by Jim Hester in September 2012.
#
# [1]: http://www.compbiome.com/2010/07/bash-per-directory-bash-history.html
diff --git a/plugins/perl/README.md b/plugins/perl/README.md
index dd9b7dc75..a387455c1 100644
--- a/plugins/perl/README.md
+++ b/plugins/perl/README.md
@@ -8,30 +8,36 @@ To use it, add `perl` to the plugins array in your zshrc file:
plugins=(... perl)
```
+## Perlbrew activation
+
+If the plugin detects that `perlbrew` hasn't been activated, yet there is an installation of it in
+`$PERLBREW_ROOT`, it'll initialize by default. To avoid this behaviour, set `ZSH_PERLBREW_ACTIVATE=false`
+before `source oh-my-zsh.sh` in your zshrc.
+
## Aliases
-| Aliases | Command | Description |
-| :------------ | :----------------- | :------------------------------------- |
-| pbi | `perlbrew install` | Install specific perl version |
-| pbl | `perlbrew list` | List all perl version installed |
-| pbo | `perlbrew off` | Go back to the system perl |
-| pbs | `perlbrew switch` | Turn it back on |
-| pbu | `perlbrew use` | Use specific version of perl |
-| pd | `perldoc` | Show the perl documentation |
-| ple | `perl -wlne` | Use perl like awk/sed |
-| latest-perl | `curl ...` | Show the latest stable release of Perl |
+| Aliases | Command | Description |
+| :---------- | :----------------- | :------------------------------------- |
+| pbi | `perlbrew install` | Install specific perl version |
+| pbl | `perlbrew list` | List all perl version installed |
+| pbo | `perlbrew off` | Go back to the system perl |
+| pbs | `perlbrew switch` | Turn it back on |
+| pbu | `perlbrew use` | Use specific version of perl |
+| pd | `perldoc` | Show the perl documentation |
+| ple | `perl -wlne` | Use perl like awk/sed |
+| latest-perl | `curl ...` | Show the latest stable release of Perl |
## Functions
-* `newpl`: creates a basic Perl script file and opens it with $EDITOR.
+- `newpl`: creates a basic Perl script file and opens it with $EDITOR.
-* `pgs`: Perl Global Substitution: `pgs <find_pattern> <replace_pattern> <filename>`
- Looks for `<find_pattern>` and replaces it with `<replace_pattern>` in `<filename>`.
+- `pgs`: Perl Global Substitution: `pgs <find_pattern> <replace_pattern> <filename>` Looks for
+ `<find_pattern>` and replaces it with `<replace_pattern>` in `<filename>`.
-* `prep`: Perl grep, because 'grep -P' is terrible: `prep <pattern> [<filename>]`
- Lets you work with pipes or files (if no `<filename>` provided, use stdin).
+- `prep`: Perl grep, because 'grep -P' is terrible: `prep <pattern> [<filename>]` Lets you work with pipes or
+ files (if no `<filename>` provided, use stdin).
## Requirements
-In order to make this work, you will need to have perl installed.
-More info on the usage and install: https://www.perl.org/get.html
+In order to make this work, you will need to have perl installed. More info on the usage and install:
+https://www.perl.org/get.html
diff --git a/plugins/perl/perl.plugin.zsh b/plugins/perl/perl.plugin.zsh
index 678e88d97..137fa252a 100644
--- a/plugins/perl/perl.plugin.zsh
+++ b/plugins/perl/perl.plugin.zsh
@@ -54,3 +54,12 @@ pgs() { # [find] [replace] [filename]
prep() { # [pattern] [filename unless STDOUT]
perl -nle 'print if /'"$1"'/;' $2
}
+
+# If the 'perlbrew' function isn't defined, perlbrew isn't setup.
+if [[ $ZSH_PERLBREW_ACTIVATE != false ]] && (( ! $+functions[perlbrew] )); then
+ local _perlbrew="${PERLBREW_ROOT:-${HOME}/perl5/perlbrew}"
+ if [[ -f "${_perlbrew}/etc/bashrc" ]]; then
+ source "${_perlbrew}/etc/bashrc"
+ fi
+ unset _perlbrew
+fi
diff --git a/plugins/pip/README.md b/plugins/pip/README.md
index 70d40c79f..9d1daca9f 100644
--- a/plugins/pip/README.md
+++ b/plugins/pip/README.md
@@ -20,17 +20,17 @@ the next time you autocomplete `pip install`.
## Aliases
-| Alias | Description |
-| :------- | :-------------------------------------------- |
-| pipi | Install packages |
-| pipig | Install package from GitHub repository |
-| pipigb | Install package from GitHub branch |
-| pipigp | Install package from GitHub pull request |
-| pipu | Upgrade packages |
-| pipun | Uninstall packages |
-| pipgi | Grep through installed packages |
-| piplo | List outdated packages |
-| pipreq | Create requirements file |
-| pipir | Install packages from `requirements.txt` file |
-| pipupall | Update all installed packages |
-| pipunall | Uninstall all installed packages |
+| Alias | Command | Description |
+| :--------|:----------------------------------------------------------------------------------|:--------------------------------------------- |
+| pipi | `pip install` | Install packages |
+| pipig | `pip install "git+https://github.com/user/repo.git"` | Install package from GitHub repository |
+| pipigb | `pip install "git+https://github.com/user/repo.git@branch"` | Install package from GitHub branch |
+| pipigp | `pip install "git+https://github.com/user/repo.git@refs/pull/PR_NUMBER/head"` | Install package from GitHub pull request |
+| pipu | `pip install --upgrade` | Upgrade packages |
+| pipun | `pip uninstall` | Uninstall packages |
+| pipgi | `pip freeze \| grep` | Grep through installed packages |
+| piplo | `pip list --outdated` | List outdated packages |
+| pipreq | `pip freeze > requirements.txt` | Create requirements file |
+| pipir | `pip install -r requirements.txt` | Install packages from `requirements.txt` file |
+| pipupall | `pip list --outdated \| awk 'NR > 2 { print $1 }' \| xargs pip install --upgrade` | Update all installed packages |
+| pipunall | `pip list --format freeze \| cut -d= -f1 \| xargs pip uninstall` | Uninstall all installed packages |
diff --git a/plugins/pipenv/README.md b/plugins/pipenv/README.md
index e78ef0e3b..429b6f186 100644
--- a/plugins/pipenv/README.md
+++ b/plugins/pipenv/README.md
@@ -1,6 +1,6 @@
# Pipenv
-## Installation
+This plugin provides some features to simplify the use of [Pipenv](https://pipenv.pypa.io/) while working on ZSH.
In your `.zshrc` file, add `pipenv` to the plugins section
@@ -10,8 +10,6 @@ plugins=(... pipenv ...)
## Features
-This plugin provides some features to simplify the use of Pipenv while working on ZSH.
-
- Adds completion for pipenv
- Auto activates and deactivates pipenv shell
- Adds short aliases for common pipenv commands
diff --git a/plugins/pipenv/pipenv.plugin.zsh b/plugins/pipenv/pipenv.plugin.zsh
index f81c266a4..76d66b301 100644
--- a/plugins/pipenv/pipenv.plugin.zsh
+++ b/plugins/pipenv/pipenv.plugin.zsh
@@ -19,7 +19,8 @@ if zstyle -T ':omz:plugins:pipenv' auto-shell; then
if [[ ! -f "$PWD/Pipfile" ]]; then
if [[ "$PIPENV_ACTIVE" == 1 ]]; then
if [[ "$PWD" != "$pipfile_dir"* ]]; then
- exit
+ unset PIPENV_ACTIVE pipfile_dir
+ deactivate
fi
fi
fi
@@ -28,7 +29,8 @@ if zstyle -T ':omz:plugins:pipenv' auto-shell; then
if [[ "$PIPENV_ACTIVE" != 1 ]]; then
if [[ -f "$PWD/Pipfile" ]]; then
export pipfile_dir="$PWD"
- pipenv shell
+ source "$(pipenv --venv)/bin/activate"
+ export PIPENV_ACTIVE=1
fi
fi
}
diff --git a/plugins/pm2/_pm2 b/plugins/pm2/_pm2
index faa6a3404..afe4ae0db 100644
--- a/plugins/pm2/_pm2
+++ b/plugins/pm2/_pm2
@@ -1,16 +1,233 @@
-#!/bin/zsh -f
#compdef pm2
-#autoload
+# ------------------------------------------------------------------------------
+# Description
+# -----------
+#
+# Completion script for pm2 5.2.2 (https://pm2.keymetrics.io/).
+#
+# ------------------------------------------------------------------------------
+# Authors
+# -------
+#
+# * Myoungdo Park <mdo.park@gmail.com>
+# * Shohei Yoshida <https://github.com/syohex>
+#
+# ------------------------------------------------------------------------------
-local -a _1st_arguments
+_pm2() {
+ typeset -A opt_args
+ local context state line
-_1st_arguments=(
+ local curcontext="$curcontext"
+
+ local ret=1
+
+ _arguments -C \
+ '(- *)'{-v,-V,--version}'[print pm2 version]' \
+ '(-s --silent)'{-s,--silent}'[hide all messages]' \
+ '--ext[watch only this file extension]:extension' \
+ '(-n --name)'{-n,--name}'[set a name for the process in the process list]:name' \
+ '(-m --mini-list)'{-m,--mini-list}'[display a compacted list without formatting]' \
+ '--interpreter[set a specific interpreter to use for executing app(default: node)]:prog' \
+ '(--interpreter-args --node-args)'{--interpreter-args,--node-args}'[set arguments to pass to the interpreter]:args' \
+ '(-o --output)'{-o,--output}'[specify log file for stdout]: :_files' \
+ '(-e --error)'{-e,--error}'[specify log file for stderr]: :_files' \
+ '(-l --log)'{-l,--log}'[specify log file which gathers both stdout and stderr]' \
+ '--filter-env[filter out outgoing global values that contain provided strings]:envs' \
+ '--log-type[specify log output style]: :(raw json)' \
+ '--log-date-format[specify log output style]:format' \
+ '--time[enable time logging]' \
+ '--disable-logs[disable all logs storage]' \
+ '*--env[specify which set of environment variables from ecosystem file must be injected]:env' \
+ '(-a --update-env)'{-a,--update-env}'[force and update of the environment with restart/reload]' \
+ '(-f --force)'{-f,--force}'[force actions]' \
+ '(-i --instances)'{-i,--instances}'[launch number instances]:num' \
+ '--parallel[number of parallel actions]:num' \
+ '--shutdown-with-message[shutdown an application with process.send("shutdown") instead of process.kill(pid, SIGINT)]' \
+ '(-p --pid)'{-p,--pid}'[specify pid file]: :_files' \
+ '(-k --kill-timeout)'{-k,--kill-timeout}'[delay before sending final SIGKILL signal to process]:delay' \
+ '--listen-timeout[listen timeout an application reload]:delay' \
+ '--max-memory-restart[restart the app if an amount of memory is exceeded (in bytes)]:bytes' \
+ '--restart-delay[specify a delay between restarts(in milliseconds)]:delay' \
+ '--exp-backoff-restart-delay[specify a delay between restarts(in milliseconds)]:delay' \
+ '(-x --execute-command)'{-e,--execute-command}'[execute a program using fork system]' \
+ '--max-restarts[only start the script COUNT times]:count' \
+ '(-u --user)'{-u,--user}'[define user when generating startup script]:username' \
+ '--uid[run target script with <uid> rights]:uid' \
+ '--gid[run target script with <gid> rights]:gui' \
+ '--namespace[start application within specified namespace]:namespace' \
+ '--cwd[run target script from path <cwd>]:cwd:_paths -/' \
+ '--hp[define home path when generating startup script]: :_paths -/' \
+ '--wait-ip[override systemd script to wait for full internet connectivity to launch pm2]' \
+ '--service-name[define service name when generating startup script]' \
+ '(-c --cron --cron-restart)'{-c,--cron,--cron-restart}'[restart a running process based on a cron pattern]:pattern' \
+ '(-w --write)'{-w,--write}'[write configuration in local folder]' \
+ '--no-daemon[run pm2 daemon in the foreground if it does not exist already]' \
+ '(--disable-source-map-support --source-map-support)--source-map-support[force source map support]' \
+ '--only[with json declaration, allow to only act on one application]:app' \
+ '(--disable-source-map-support --source-map-support)--disable-source-map-support[force disable source map support]' \
+ '--wait-ready[ask pm2 to wait for ready event from your app]' \
+ '--merge-logs[merge logs from different instances but keep error and out separated]' \
+ '*--watch[watch application folder for changes]: :_files -/' \
+ '*--ignore-watch[list of paths to ignore]: :_files' \
+ '--no-color[skip colors]' \
+ '--no-vizion[start an app without vizion feature]' \
+ '--np-autorestart[start an app without automatic restart]' \
+ '--no-treekill[Only kill the main process, not detached children]' \
+ '--no-pmx[start an app without pmx]' \
+ '--no-automation[start an app without automation]' \
+ '(--disable-trace --trace)--trace[enable transaction tracing with km]' \
+ '(--disable-trace --trace)--disable-trace[disable transaction tracing with km]' \
+ "--sort[sort process according to field's]:field_name" \
+ '--attach[attach logging after your start/restart/stop/reload]' \
+ '--v8[enable v8 data collecting]' \
+ '--event-loop-inspector[enable event-loop-inspector dump in pmx]' \
+ '--deep-monitoring[enable all monitoring tools]' \
+ '(- *)'{-h,--help}'[output usage information]' \
+ '1: :_pm2_subcommands' \
+ '*:: :->subcmds' && return 0
+
+ case "$state" in
+ (subcmds)
+ case $words[1] in
+ (start)
+ _arguments \
+ '--watch[watch folder for changes]' \
+ '--fresh[Rebuild Dockerfile]' \
+ '--daemon[Run container in Daemon mode(debug purposes)]' \
+ '--container[Start application in container mode]' \
+ '--dist[--with-container; change local Dockerfile to containerize all files in current directory]' \
+ '--image-name[with --dist; set the exported image name]:name' \
+ '--node-version[with --container, set a specific major Node.js version]:version' \
+ '--dockerdaemon[for debugging purpose]' \
+ '(- *)'{-h,--help}'[output usage information]' \
+ '*: :_pm2_id_namespace_file' \
+ && ret=0
+ ;;
+ (trigger)
+ _arguments \
+ '(- *)'{-h,--help}'[output usage information]' \
+ '1: :_pm2_id_names' \
+ && ret=0
+ ;;
+ (deploy|startOrRestart|startOrReload|startOrGracefulReload)
+ _arguments \
+ '(- *)'{-h,--help}'[output usage information]' \
+ '1: :_files -g "*.json"' \
+ && ret=0
+ ;;
+ (stop|restart)
+ _arguments \
+ '(- *)'{-h,--help}'[output usage information]' \
+ '--watch[Stop watching folder for changes]' \
+ '*: :_pm2_id_namespace_all' \
+ && ret=0
+ ;;
+ (reload|delete|reset)
+ _arguments \
+ '(- *)'{-h,--help}'[output usage information]' \
+ '*: :_pm2_id_namespace_all' \
+ && ret=0
+ ;;
+ (module:install)
+ _arguments \
+ '(- *)'{-h,--help}'[output usage information]' \
+ '--tarball[is local tarball]' \
+ '--install[run yarn install before starting module]' \
+ '--docker[is docker container]' \
+ '--v1[install module in v1 manner(do not use it)]' \
+ '--safe[keep module backup, if new module fail = restore with previous]:time' \
+ && ret=0
+ ;;
+ (publish|module:publish)
+ _arguments \
+ '(- *)'{-h,--help}'[output usage information]' \
+ '--npm[publish on npm]' \
+ '*: :_files -/' \
+ && ret=0
+ ;;
+ (link)
+ _arguments \
+ '(- *)'{-h,--help}'[output usage information]' \
+ '--info-node[set url info node]:url' \
+ && ret=0
+ ;;
+ (plus)
+ _arguments \
+ '(- *)'{-h,--help}'[output usage information]' \
+ '--info-node[set url info node]:url' \
+ '(-d --discrete)'{-d,--discrete}'[silent mode]' \
+ '(-a --install-all)'{-a,--install-all}'[install all modules (force yes)]' \
+ && ret=0
+ ;;
+ (dump|save)
+ _arguments \
+ '(- *)'{-h,--help}'[output usage information]' \
+ '--force[force deletion of dump file even if empty]' \
+ && ret=0
+ ;;
+ (send|attach|describe|env)
+ _arguments \
+ '(- *)'{-h,--help}'[output usage information]' \
+ '1: :_pm2_id_names' \
+ && ret=0
+ ;;
+ (slist|sysinfos)
+ _arguments \
+ '(- *)'{-h,--help}'[output usage information]' \
+ '--tree[show as tree]' \
+ && ret=0
+ ;;
+ (logs)
+ _arguments \
+ '(- *)'{-h,--help}'[output usage information]' \
+ '--json[json log output]' \
+ '--format[formatted log output]' \
+ '--raw[raw output]' \
+ '--err[only shows error output]' \
+ '--out[only shows standard output]' \
+ '--line[output the last N lines, instead of the last 15 by default]:lines' \
+ '--timestamp[add timestamps(default format YYYY-MM-DD-HH:mm:ss)]:format' \
+ '--nostream[print logs without launching the log stream]' \
+ '*--highlight[highlights the given value]' \
+ '1: :_pm2_id_namespace' \
+ && ret=0
+ ;;
+ (serve)
+ _arguments \
+ '(- *)'{-h,--help}'[output usage information]' \
+ '--port[specify port to listen to]:port' \
+ '--spa[always serving index.html on inexistent sub path]' \
+ '--basic-auth-username[set basic auth username]:username' \
+ '--basic-auth-password[set basic auth password]:password' \
+ '--monitor[frontend app monitoring]:app' \
+ '*: :_files -/' \
+ && ret=0
+ ;;
+ (*)
+ _arguments \
+ '(- *)'{-h,--help}'[output usage information]' \
+ '*: :_files' \
+ && ret=0
+ ;;
+ esac
+ ;;
+ esac
+
+ return ret
+}
+
+(( $+functions[_pm2_subcommands] )) ||
+_pm2_subcommands() {
+ local -a subcommands=(
"start:start and daemonize an app"
"trigger:trigger process action"
"deploy:deploy your json"
"startOrRestart:start or restart JSON file"
"startOrReload:start or gracefully reload JSON file"
"pid:return pid of [app_name] or all"
+ "create:return pid of [app_name] or all"
+ "startOrGracefulReload:start or gracefully reload JSON file"
"stop:stop a process"
"restart:restart a process"
"scale:scale up/down a process in cluster mode depending on total_number param"
@@ -23,18 +240,23 @@ _1st_arguments=(
"sendSignal:send a system signal to the target process"
"ping:ping pm2 daemon - if not up it will launch it"
"updatePM2:update in-memory PM2 with local PM2"
+ "update:update in-memory PM2 with local PM2"
"install:install or update a module and run it forever"
+ "module\:install:install or update a module and run it forever"
"module\:update:update a module and run it forever"
"module\:generate:Generate a sample module in current folder"
"uninstall:stop and uninstall a module"
+ "module\:uninstall:stop and uninstall a module"
"package:Check & Package TAR type module"
"publish:Publish the module you are currently on"
+ "module\:publish:Publish the module you are currently on"
"set:sets the specified config <key> <value>"
"multiset:multiset eg \"key1 val1 key2 val2\""
"get:get value for <key>"
+ "conf:get / set module config values"
"config:get / set module config values"
"unset:clears the specified config <key>"
- "report:give a full pm2 report for https\://github.com/Unitech/pm2/issues"
+ "report:give a full pm2 report for https://github.com/Unitech/pm2/issues"
"link:link with the pm2 monitoring dashboard"
"unlink:unlink with the pm2 monitoring dashboard"
"monitor:monitor target process"
@@ -43,8 +265,8 @@ _1st_arguments=(
"plus:enable pm2 plus"
"login:Login to pm2 plus"
"logout:Logout from pm2 plus"
- "web:launch a health API on 0.0.0.0\:9615"
"dump:dump all processes for resurrecting them later"
+ "save:dump all processes for resurrecting them later"
"cleardump:Create empty dump file"
"send:send stdin to <pm_id>"
"attach:attach stdin/stdout to application identified by <pm_id>"
@@ -52,15 +274,27 @@ _1st_arguments=(
"unstartup:disable the pm2 startup hook"
"startup:enable the pm2 startup hook"
"logrotate:copy default logrotate configuration"
- "ecosystem:generate a process conf file. (mode = null or simple)"
+ "ecosystem:generate a process conf file"
+ "init:generate a process conf file"
"reset:reset counters for process"
- "describe:describe all parameters of a process id"
+ "describe:describe all parameters of a process"
+ "desc:describe all parameters of a process"
+ "info:describe all parameters of a process"
+ "show:describe all parameters of a process"
+ "env:list all environment variables of a process id"
"list:list all processes"
+ "l:list all processes"
+ "ps:list all processes"
+ "status:list all processes"
"jlist:list all processes in JSON format"
+ "sysmonit:start system monitoring daemon"
+ "slist:list system infos in JSON"
+ "sysinfos:list system infos in JSON"
"prettylist:print json in a prettified JSON"
"monit:launch termcaps monitoring"
"imonit:launch legacy termcaps monitoring"
"dashboard:launch dashboard with monitoring and logs"
+ "dash:launch dashboard with monitoring and logs"
"flush:flush logs"
"reloadLogs:reload all logs"
"logs:stream logs file. Default stream all logs"
@@ -70,99 +304,71 @@ _1st_arguments=(
"backward:downgrades repository to the previous commit for a given app"
"deepUpdate:performs a deep update of PM2"
"serve:serve a directory over http via port"
+ "autoinstall:auto install"
"examples:display pm2 usage examples"
-)
+ )
-local -a id_names
+ _describe -t subcommands 'subcommand' subcommands "$@"
+}
-_id_names() {
- local app_list
- app_list=`pm2 list -m`
+(( $+functions[_pm2_id_names] )) ||
+_pm2_id_names() {
+ local app_list=$(pm2 list -m)
+ local -a names=(${(@f)"$(echo $app_list | awk '/^\+---/{sub("+--- ", ""); print}')"})
+ local -a ids=(${(@f)"$(echo $app_list | awk '/^pm2 id/{sub("pm2 id :", ""); print}')"})
- local -a names ids
- names=(`echo $app_list | grep '+---' | awk '{print $2}'`)
- ids=(`echo $app_list | grep 'pm2 id' | awk '{print $4}'`)
+ if (( ${#ids} > 0 )); then
+ local -a id_names
+ for i in {1..${#ids}}; do
+ id_names+=( "${ids[i]}:${names[i]}" )
+ done
- if (( ${#ids} > 0 )); then
- for i in {1..${#ids}}; do
- id_names+=( "${ids[i]}:${names[i]}" )
- done
- fi
+ _describe 'id' id_names
+ fi
}
-_arguments \
- '(-v --version)'{-v,--version}'[output version]' \
- '(-h --help)'{-h,--help}'[output usage information]' \
- '*:: :->subcmds' && return 0
+(( $+functions[_pm2_namespaces] )) ||
+_pm2_namespaces() {
+ local -a namespaces=(${(@f)"$(pm2 list -m | awk '/^namespace :/{ print $3 }')"})
+ if (( ${#namespaces} > 0 )); then
+ _values 'namespace' $namespaces
+ fi
+}
-if (( CURRENT == 1 )); then
- _describe "command" _1st_arguments
- return
-fi
+(( $+functions[_pm2_id_namespace] )) ||
+_pm2_id_namespace() {
+ _alternative \
+ 'ids:id:_pm2_id_names' \
+ 'namespaces:namespace:_pm2_namespaces'
+}
+
+(( $+functions[_pm2_id_namespace_all] )) ||
+_pm2_id_namespace_all() {
+ _alternative \
+ 'ids:id:_pm2_id_names' \
+ 'namespaces:namespace:_pm2_namespaces' \
+ 'all:all:(all)'
+}
+
+(( $+functions[_pm2_id_namespace_file] )) ||
+_pm2_id_namespace_file() {
+ _alternative \
+ 'ids:id:_pm2_id_names' \
+ 'namespaces:namespace:_pm2_namespaces' \
+ 'files:file:_files'
+}
-local -a id_comp id_all_comp id_all_files_comp start_options logs_options
-id_comp=('1: :->id_comp')
-id_all_comp=('1: :->id_all_comp')
-id_all_files_comp=('1: :->id_all_files_comp')
-start_options=(
- '--watch[Watch folder for changes]'
- '--fresh[Rebuild Dockerfile]'
- '--daemon[Run container in Daemon mode (debug purposes)]'
- '--container[Start application in container mode]'
- '--dist[with --container; change local Dockerfile to containerize all files in current directory]'
- '--image-name[with --dist; set the exported image name]'
- '--node-version[with --container, set a specific major Node.js version]'
- '--dockerdaemon[for debugging purpose]'
- '(-h --help)'{-h,--help}'[output usage information]'
- $id_all_files_comp
-)
-logs_options=(
- '--json[json log output]'
- '--format[formatted log output]'
- '--raw[raw output]'
- '--err[only shows error output]'
- '--out[only shows standard output]'
- '--lines[output the last N lines, instead of the last 15 by default]'
- '--timestamp[add timestamps (default format YYYY-MM-DD-HH:mm:ss)]'
- '--nostream[print logs without launching the log stream]'
- '(-h --help)'{-h,--help}'[output usage information]'
- $id_all_comp
-)
+if [ "$funcstack[1]" = "_pm2" ]; then
+ _pm2 "$@"
+else
+ compdef _pm2 pm2
+fi
-case "$words[1]" in
- start)
- _arguments $start_options && return 0
- ;;
- logs)
- _arguments $logs_options && return 0
- ;;
- stop|restart|delete|reload|reset)
- _arguments $id_all_comp && return 0
- ;;
- env|inspect|monitor|unmonitor|describe)
- _arguments $id_comp && return 0
- ;;
- deploy|startOrRestart|startOrReload)
- _files ;;
-esac
+# Local Variables:
+# mode: Shell-Script
+# sh-indentation: 2
+# indent-tabs-mode: nil
+# sh-basic-offset: 2
+# End:
-case "$state" in
- id_comp)
- _id_names
- _alternative \
- 'args:app args:(($id_names))'
- ;;
- id_all_comp)
- _id_names
- id_names+=(all)
- _alternative \
- 'args:app args:(($id_names))'
- ;;
- id_all_files_comp)
- _id_names
- id_names+=(all)
- _alternative \
- 'args:app args:(($id_names))' \
- 'files:filename:_files'
- ;;
-esac
+# vim: ft=zsh sw=2 ts=2 et
diff --git a/plugins/poetry-env/README.md b/plugins/poetry-env/README.md
index a7d16563e..bd99d2a91 100644
--- a/plugins/poetry-env/README.md
+++ b/plugins/poetry-env/README.md
@@ -1,6 +1,6 @@
# Poetry Environment Plugin
-This plugin automatically changes poetry environment when you cd into or out of the project directory.
+This plugin automatically changes poetry environment when you cd into or out of the project directory.
Note: Script looks for pyproject.toml file to determine poetry if its a poetry environment
To use it, add `poetry-env` to the plugins array in your zshrc file:
diff --git a/plugins/poetry-env/poetry-env.plugin.zsh b/plugins/poetry-env/poetry-env.plugin.zsh
index 86e5fad4e..d2d571dbe 100644
--- a/plugins/poetry-env/poetry-env.plugin.zsh
+++ b/plugins/poetry-env/poetry-env.plugin.zsh
@@ -1,27 +1,27 @@
-# Automatic poetry environment activation/deactivation
_togglePoetryShell() {
- # deactivate environment if pyproject.toml doesn't exist and not in a subdir
- if [[ ! -f "$PWD/pyproject.toml" ]] ; then
- if [[ "$poetry_active" == 1 ]]; then
- if [[ "$PWD" != "$poetry_dir"* ]]; then
- export poetry_active=0
- deactivate
- return
- fi
- fi
+ # Determine if currently in a Poetry-managed directory
+ local in_poetry_dir=0
+ if [[ -f "$PWD/pyproject.toml" && -f "$PWD/poetry.lock" ]]; then
+ in_poetry_dir=1
+ fi
+
+ # Deactivate the current environment if moving out of a Poetry directory or into a different Poetry directory
+ if [[ $poetry_active -eq 1 ]] && { [[ $in_poetry_dir -eq 0 ]] || [[ "$PWD" != "$poetry_dir"* ]]; }; then
+ export poetry_active=0
+ unset poetry_dir
+ (( $+functions[deactivate] )) && deactivate
fi
- # activate the environment if pyproject.toml exists
- if [[ "$poetry_active" != 1 ]]; then
- if [[ -f "$PWD/pyproject.toml" ]]; then
- if grep -q 'tool.poetry' "$PWD/pyproject.toml"; then
- export poetry_active=1
- export poetry_dir="$PWD"
- source "$(poetry env info --path)/bin/activate"
- fi
+ # Activate the environment if in a Poetry directory and no environment is currently active
+ if [[ $in_poetry_dir -eq 1 ]] && [[ $poetry_active -ne 1 ]]; then
+ venv_dir=$(poetry env info --path 2>/dev/null)
+ if [[ -n "$venv_dir" ]]; then
+ export poetry_active=1
+ export poetry_dir="$PWD"
+ source "${venv_dir}/bin/activate"
fi
fi
}
autoload -U add-zsh-hook
add-zsh-hook chpwd _togglePoetryShell
-_togglePoetryShell
+_togglePoetryShell # Initial call to check the current directory at shell startup
diff --git a/plugins/poetry/README.md b/plugins/poetry/README.md
index 51780cbed..7b7905a41 100644
--- a/plugins/poetry/README.md
+++ b/plugins/poetry/README.md
@@ -7,3 +7,36 @@ To use it, add `poetry` to the plugins array in your zshrc file:
```zsh
plugins=(... poetry)
```
+
+## Aliases
+
+| Alias | Command | Description
+|:----- |--------------------------------------------------- |:--------------------------------------------------------------------------------------- |
+| pad | `poetry add` | Add packages to `pyproject.toml` and install them |
+| pbld | `poetry build` | Build the source and wheels archives |
+| pch | `poetry check` | Validate the content of the `pyproject.toml` and its consistency with the `poetry.lock` |
+| pcmd | `poetry list` | Display all the available Poetry commands |
+| pconf | `poetry config --list` | Allow you to edit poetry config settings and repositories |
+| pexp | `poetry export --without-hashes > requirements.txt | Export the lock file to `requirements.txt` |
+| pin | `poetry init` | Create a `pyproject.toml` interactively |
+| pinst | `poetry install` | Read the `pyproject.toml`, resolve the dependencies, and install them |
+| plck | `poetry lock` | Lock the dependencies in `pyproject.toml` without installing |
+| pnew | `poetry new` | Create a directory structure suitable for most Python projects |
+| ppath | `poetry env info --path` | Get the path of the currently activated virtualenv` |
+| pplug | `poetry self show plugins` | List all the installed Poetry plugins |
+| ppub | `poetry publish` | Publish the builded (`poetry build` command) package to the remote repository |
+| prm | `poetry remove` | Remove packages from `pyproject.toml` and uninstall them |
+| prun | `poetry run` | Executes the given command inside the project’s virtualenv |
+| psad | `poetry self add` | Add the Poetry plugin and install dependencies to make it work |
+| psh | `poetry shell` | Spawns a shell within the virtual environment. If one doesn’t exist, it will be created |
+| pshw | `poetry show` | List all the available dependencies |
+| pslt | `poetry show --latest` | List lastest version of the dependencies |
+| psup | `poetry self update` | Update Poetry to the latest version (default) or to the specified version |
+| psync | `poetry install --sync` | Synchronize your environment with the `poetry.lock` |
+| ptree | `poetry show --tree` | List the dependencies as tree |
+| pup | `poetry update` | Get the latest versions of the dependencies and to update the `poetry.lock` |
+| pvinf | `poetry env info` | Get basic information about the currently activated virtualenv |
+| pvoff | `poetry config virtualenvs.create false` | Disable automatic virtualenv creation |
+| pvrm | `poetry env remove` | Delete existing virtualenvs |
+| pvrma | `poetry env remove --all` | Delete all existing virtualenvs |
+| pvu | `poetry env use` | Switch between existing virtualenvs |
diff --git a/plugins/poetry/poetry.plugin.zsh b/plugins/poetry/poetry.plugin.zsh
index cebcb46c4..fe6a0f7ed 100644
--- a/plugins/poetry/poetry.plugin.zsh
+++ b/plugins/poetry/poetry.plugin.zsh
@@ -1,3 +1,31 @@
+alias pad='poetry add'
+alias pbld='poetry build'
+alias pch='poetry check'
+alias pcmd='poetry list'
+alias pconf='poetry config --list'
+alias pexp='poetry export --without-hashes > requirements.txt'
+alias pin='poetry init'
+alias pinst='poetry install'
+alias plck='poetry lock'
+alias pnew='poetry new'
+alias ppath='poetry env info --path'
+alias pplug='poetry self show plugins'
+alias ppub='poetry publish'
+alias prm='poetry remove'
+alias prun='poetry run'
+alias psad='poetry self add'
+alias psh='poetry shell'
+alias pshw='poetry show'
+alias pslt='poetry show --latest'
+alias psup='poetry self update'
+alias psync='poetry install --sync'
+alias ptree='poetry show --tree'
+alias pup='poetry update'
+alias pvinf='poetry env info'
+alias pvoff='poetry config virtualenvs.create false'
+alias pvrm='poetry env remove'
+alias pvu='poetry env use'
+
# Return immediately if poetry is not found
if (( ! $+commands[poetry] )); then
return
diff --git a/plugins/procs/README.md b/plugins/procs/README.md
new file mode 100644
index 000000000..f1e663d9b
--- /dev/null
+++ b/plugins/procs/README.md
@@ -0,0 +1,9 @@
+# procs
+
+This plugin provides completion for [procs](https://github.com/dalance/procs).
+
+To use it, add `procs` to the plugins array in your zshrc file.
+
+```
+plugins=(... procs)
+```
diff --git a/plugins/procs/procs.plugin.zsh b/plugins/procs/procs.plugin.zsh
new file mode 100644
index 000000000..8b15f1d5d
--- /dev/null
+++ b/plugins/procs/procs.plugin.zsh
@@ -0,0 +1,21 @@
+if (( ! $+commands[procs] )); then
+ return
+fi
+
+# If the completion file doesn't exist yet, we need to autoload it and
+# bind it to `procs`. Otherwise, compinit will have already done that.
+if [[ ! -f "$ZSH_CACHE_DIR/completions/_procs" ]]; then
+ typeset -g -A _comps
+ autoload -Uz _procs
+ _comps[procs]=_procs
+fi
+
+{
+ autoload -Uz is-at-least
+ local _version=$(procs --version)
+ if is-at-least "0.14" "${_version#procs }"; then
+ procs --gen-completion-out zsh >| "$ZSH_CACHE_DIR/completions/_procs"
+ else
+ procs --completion-out zsh >| "$ZSH_CACHE_DIR/completions/_procs"
+ fi
+} &|
diff --git a/plugins/pulumi/README.md b/plugins/pulumi/README.md
new file mode 100644
index 000000000..4c771964b
--- /dev/null
+++ b/plugins/pulumi/README.md
@@ -0,0 +1,41 @@
+# Pulumi
+
+This is an **Oh My Zsh plugin** for the [**Pulumi CLI**](https://www.pulumi.com/docs/iac/cli/),
+an Infrastructure as Code (IaC) tool for building, deploying and managing cloud infrastucture.
+
+This plugin provides:
+
+- 🚀 Short, intuitive aliases for common Pulumi commands
+- 🎯 Auto-completion support for Pulumi
+
+To use it, add `pulumi` to the plugins array in your `.zshrc` file:
+
+```zsh
+plugins=(... pulumi)
+```
+
+## ⚡ Aliases
+
+| Alias | Command | Description |
+| -------- | ---------------------- | ----------------------------- |
+| `pul` | `pulumi` | Shortcut for Pulumi CLI |
+| `pulcs` | `pulumi config set` | Set Pulumi configuration |
+| `puld` | `pulumi destroy` | Destroy all resources |
+| `pullog` | `pulumi logs -f` | Tail Pulumi logs in real-time |
+| `pulp` | `pulumi preview` | Show planned changes |
+| `pulr` | `pulumi refresh` | Refresh state from cloud |
+| `puls` | `pulumi stack` | Show stack details |
+| `pulsh` | `pulumi stack history` | Show stack history |
+| `pulsi` | `pulumi stack init` | Initialize a new stack |
+| `pulsl` | `pulumi stack ls` | List available stacks |
+| `pulso` | `pulumi stack output` | Show stack outputs |
+| `pulss` | `pulumi stack select` | Switch stack |
+| `pulu` | `pulumi up` | Deploy infrastructure |
+
+## 🎯 Autocompletion
+
+If `pulumi gen-completion zsh` is available, this plugin **automatically loads Pulumi auto-completion**.
+
+## 🛠️ Contribution
+
+Feel free to open an issue or PR for improvements! 🚀
diff --git a/plugins/pulumi/pulumi.plugin.zsh b/plugins/pulumi/pulumi.plugin.zsh
new file mode 100644
index 000000000..70686017f
--- /dev/null
+++ b/plugins/pulumi/pulumi.plugin.zsh
@@ -0,0 +1,28 @@
+if (( ! $+commands[pulumi] )); then
+ return
+fi
+
+# If the completion file doesn't exist yet, we need to autoload it and
+# bind it to `pulumi`. Otherwise, compinit will have already done that.
+if [[ ! -f "$ZSH_CACHE_DIR/completions/_pulumi" ]]; then
+ typeset -g -A _comps
+ autoload -Uz _pulumi
+ _comps[pulumi]=_pulumi
+fi
+
+pulumi gen-completion zsh >| "$ZSH_CACHE_DIR/completions/_pulumi" &|
+
+# Aliases
+alias pul='pulumi'
+alias pulcs='pulumi config set'
+alias puld='pulumi destroy'
+alias pullog='pulumi logs -f'
+alias pulp='pulumi preview'
+alias pulr='pulumi refresh'
+alias puls='pulumi stack'
+alias pulsh='pulumi stack history'
+alias pulsi='pulumi stack init'
+alias pulsl='pulumi stack ls'
+alias pulso='pulumi stack output'
+alias pulss='pulumi stack select'
+alias pulu='pulumi up'
diff --git a/plugins/pyenv/README.md b/plugins/pyenv/README.md
index f1ca3d288..2476bbd95 100644
--- a/plugins/pyenv/README.md
+++ b/plugins/pyenv/README.md
@@ -2,7 +2,7 @@
This plugin looks for [pyenv](https://github.com/pyenv/pyenv), a Simple Python version
management system, and loads it if it's found. It also loads pyenv-virtualenv, a pyenv
-plugin to manage virtualenv, if it's found.
+plugin to manage virtualenv, if it's found. If a venv is found pyenv won't load.
To use it, add `pyenv` to the plugins array in your zshrc file:
@@ -10,7 +10,7 @@ To use it, add `pyenv` to the plugins array in your zshrc file:
plugins=(... pyenv)
```
-If you receive a `Found pyenv, but it is badly configured.` error on startup, you may need to ensure that `pyenv` is initialized before the oh-my-zsh pyenv plugin is loaded. This can be achived by adding the following earlier in the `.zshrc` file than the `plugins=(...)` line:
+If you receive a `Found pyenv, but it is badly configured.` error on startup, you may need to ensure that `pyenv` is initialized before the oh-my-zsh pyenv plugin is loaded. This can be achieved by adding the following earlier in the `.zshrc` file than the `plugins=(...)` line:
```zsh
export PYENV_ROOT="$HOME/.pyenv"
@@ -26,6 +26,14 @@ eval "$(pyenv init --path)"
- `ZSH_PYENV_VIRTUALENV`: if set to `false`, the plugin will not load pyenv-virtualenv
when it finds it.
+- `ZSH_THEME_PYENV_NO_SYSTEM`: if set to `true`, the plugin will not show the system or
+ default Python version when it finds it.
+- `ZSH_THEME_PYENV_PREFIX`: the prefix to display before the Python version in
+ the prompt.
+
+- `ZSH_THEME_PYENV_SUFFIX`: the prefix to display after the Python version in
+ the prompt.
+
## Functions
- `pyenv_prompt_info`: displays the Python version in use by pyenv; or the global Python
diff --git a/plugins/pyenv/pyenv.plugin.zsh b/plugins/pyenv/pyenv.plugin.zsh
index 48c8ffaf5..cd2a9e0ac 100644
--- a/plugins/pyenv/pyenv.plugin.zsh
+++ b/plugins/pyenv/pyenv.plugin.zsh
@@ -1,3 +1,7 @@
+# if there is a virtualenv already loaded pyenv should not be loaded
+# see https://github.com/ohmyzsh/ohmyzsh/issues/12589
+[[ -n ${VIRTUAL_ENV:-} ]] && return
+
pyenv_config_warning() {
[[ "$ZSH_PYENV_QUIET" != true ]] || return 0
@@ -84,13 +88,19 @@ if [[ $FOUND_PYENV -eq 1 ]]; then
function pyenv_prompt_info() {
local version="$(pyenv version-name)"
- echo "${version:gs/%/%%}"
+ if [[ "$ZSH_THEME_PYENV_NO_SYSTEM" == "true" ]] && [[ "${version}" == "system" ]]; then
+ return
+ fi
+ echo "${ZSH_THEME_PYENV_PREFIX=}${version:gs/%/%%}${ZSH_THEME_PYENV_SUFFIX=}"
}
else
# Fall back to system python
function pyenv_prompt_info() {
+ if [[ "$ZSH_THEME_PYENV_NO_SYSTEM" == "true" ]]; then
+ return
+ fi
local version="$(python3 -V 2>&1 | cut -d' ' -f2)"
- echo "system: ${version:gs/%/%%}"
+ echo "${ZSH_THEME_PYENV_PREFIX=}system: ${version:gs/%/%%}${ZSH_THEME_PYENV_SUFFIX=}"
}
fi
diff --git a/plugins/python/README.md b/plugins/python/README.md
index 7bf1b34ac..ca424ea55 100644
--- a/plugins/python/README.md
+++ b/plugins/python/README.md
@@ -13,7 +13,6 @@ plugins=(... python)
| Command | Description |
| ---------------- | -------------------------------------------------------------------------------------- |
| `py` | Runs `python3`. Only set if `py` is not installed. |
-| `ipython` | Runs the appropriate `ipython` version according to the activated virtualenv |
| `pyfind` | Finds .py files recursively in the current directory |
| `pyclean [dirs]` | Deletes byte-code and cache files from a list of directories or the current one |
| `pygrep <text>` | Looks for `text` in `*.py` files in the current directory, recursively |
@@ -22,8 +21,48 @@ plugins=(... python)
## Virtual environments
-The plugin provides two utilities to manage Python venvs:
+The plugin provides three utilities to manage Python 3.3+ [venv](https://docs.python.org/3/library/venv.html)
+virtual environments:
-- `mkv [name]`: make a new virtual environment called `name` (default: `venv`) in current directory.
+- `mkv [name]`: make a new virtual environment called `name` in the current directory.
+ **Default**: `$PYTHON_VENV_NAME` if set, otherwise `venv`.
+
+- `vrun [name]`: activate the virtual environment called `name` in the current directory.
+ **Default**: the first existing in `$PYTHON_VENV_NAMES`.
+
+- `auto_vrun`: automatically activate the venv virtual environment when entering a directory containing
+ `<venv-name>/bin/activate`, and automatically deactivate it when navigating out of it (keeps venv activated
+ in subdirectories).
+ - To enable the feature, set `PYTHON_AUTO_VRUN=true` before sourcing oh-my-zsh.
+ - The plugin activates the first existing virtual environment, in order, appearing in `$PYTHON_VENV_NAMES`.
+ The default virtual environment name is `venv`. To use a different name, set
+ `PYTHON_VENV_NAME=<venv-name>`. For example: `PYTHON_VENV_NAME=".venv"`
+
+### Settings
+
+You can set these variables in your `.zshrc` file, before Oh My Zsh is sourced.
+For example:
+
+```sh
+PYTHON_VENV_NAME=".venv"
+PYTHON_VENV_NAMES=($PYTHON_VENV_NAME venv)
+...
+plugins=(... python)
+source "$ZSH/oh-my-zsh.sh"
+```
+
+
+## `$PYTHON_VENV_NAME`
+
+**Default**: `venv`.
+
+Preferred name for virtual environments, for example when creating via `mkv`.
+
+## `$PYTHON_VENV_NAMES`
+
+**Default**: `$PYTHON_VENV_NAME venv .venv`.
+
+Array of virtual environment names to be checked, in order, by `vrun` and `auto_vrun`.
+This means these functions will load the first existing virtual environment in this list.
+Duplicate names are ignored.
-- `vrun [name]`: activate virtual environment called `name` (default: `venv`) in current directory.
diff --git a/plugins/python/python.plugin.zsh b/plugins/python/python.plugin.zsh
index 3d7ca55c9..2b139ddf0 100644
--- a/plugins/python/python.plugin.zsh
+++ b/plugins/python/python.plugin.zsh
@@ -43,19 +43,34 @@ function pyuserpaths() {
# Grep among .py files
alias pygrep='grep -nr --include="*.py"'
-# Run proper IPython regarding current virtualenv (if any)
-alias ipython="python3 -c 'import IPython; IPython.terminal.ipapp.launch_new_instance()'"
-
# Share local directory as a HTTP server
alias pyserver="python3 -m http.server"
-## venv utilities
+## venv settings
+: ${PYTHON_VENV_NAME:=venv}
+
+# Array of possible virtual environment names to look for, in order
+# -U for removing duplicates
+typeset -gaU PYTHON_VENV_NAMES
+[[ -n "$PYTHON_VENV_NAMES" ]] || PYTHON_VENV_NAMES=($PYTHON_VENV_NAME venv .venv)
# Activate a the python virtual environment specified.
-# If none specified, use 'venv'.
+# If none specified, use the first existing in $PYTHON_VENV_NAMES.
function vrun() {
- local name="${1:-venv}"
+ if [[ -z "$1" ]]; then
+ local name
+ for name in $PYTHON_VENV_NAMES; do
+ local venvpath="${name:P}"
+ if [[ -d "$venvpath" ]]; then
+ vrun "$name"
+ return $?
+ fi
+ done
+ echo >&2 "Error: no virtual environment found in current directory"
+ fi
+
+ local name="${1:-$PYTHON_VENV_NAME}"
local venvpath="${name:P}"
if [[ ! -d "$venvpath" ]]; then
@@ -72,12 +87,36 @@ function vrun() {
echo "Activated virtual environment ${name}"
}
-# Create a new virtual environment, with default name 'venv'.
+# Create a new virtual environment using the specified name.
+# If none specified, use $PYTHON_VENV_NAME
function mkv() {
- local name="${1:-venv}"
+ local name="${1:-$PYTHON_VENV_NAME}"
local venvpath="${name:P}"
python3 -m venv "${name}" || return
echo >&2 "Created venv in '${venvpath}'"
vrun "${name}"
}
+
+if [[ "$PYTHON_AUTO_VRUN" == "true" ]]; then
+ # Automatically activate venv when changing dir
+ function auto_vrun() {
+ # deactivate if we're on a different dir than VIRTUAL_ENV states
+ # we don't deactivate subdirectories!
+ if (( $+functions[deactivate] )) && [[ $PWD != ${VIRTUAL_ENV:h}* ]]; then
+ deactivate > /dev/null 2>&1
+ fi
+
+ if [[ $PWD != ${VIRTUAL_ENV:h} ]]; then
+ local file
+ for file in "${^PYTHON_VENV_NAMES[@]}"/bin/activate(N.); do
+ # make sure we're not in a venv already
+ (( $+functions[deactivate] )) && deactivate > /dev/null 2>&1
+ source $file > /dev/null 2>&1
+ break
+ done
+ fi
+ }
+ add-zsh-hook chpwd auto_vrun
+ auto_vrun
+fi
diff --git a/plugins/rails/_rails b/plugins/rails/_rails
index ac90d45cc..dbd843c80 100644
--- a/plugins/rails/_rails
+++ b/plugins/rails/_rails
@@ -1,6 +1,6 @@
#compdef rails
# ------------------------------------------------------------------------------
-# Copyright (c) 2016 GitHub zsh-users - http://github.com/zsh-users
+# Copyright (c) 2016 GitHub zsh-users - https://github.com/zsh-users
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -28,589 +28,503 @@
# Description
# -----------
#
-# Completion script for Ruby on Rails (http://rubyonrails.org/).
+# Completion script for Ruby on Rails 7.1.0 (https://rubyonrails.org/).
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * Kazuya Takeshima (https://github.com/mitukiii)
+# * Shohei Yoshida (https://github.com/syohex)
#
# ------------------------------------------------------------------------------
-
_rails() {
- local context state line curcontext="$curcontext"
-
- if (( CURRENT > 2 )); then
- (( CURRENT-- ))
- shift words
- _call_function - "_rails_${words[1]}" || _nothing
- else
- __rails_commands
- fi
-}
-
-__rails_commands() {
- local context state line curcontext="$curcontext"
-
- local -a rails_options
- __rails_setup_rails_options
-
- _arguments -C \
- $rails_options \
- ': :->command'
-
- case "$state" in
- command)
- local -a commands
- local application_directory
- __rails_setup_application_directory
-
- if [ -n "$application_directory" ]; then
- commands=(
- {generate,g}'[Generate new code]'
- {console,c}'[Start the Rails console]'
- {server,s}'[Start the Rails server]'
- {dbconsole,db}'[Start a console for the database specified in config/database.yml]'
- application'[Generate the Rails application code]'
- {destroy,d}'[Undo code generated with "generate"]'
- benchmarker'[See how fast a piece of code runs]'
- profiler'[Get profile information from a piece of code]'
- plugin'[Install a plugin]'
- {runner,r}'[Run a piece of code in the application environment]'
- {test,t}'[Run tests]'
- )
- else
- commands=(
- new'[Create a new Rails application]'
- )
- fi
+ local context state state_descr line curcontext="$curcontext"
+ typeset -A opt_args
- _values 'command' $commands
- ;;
- esac
-}
-
-__rails_setup_application_directory() {
- application_directory="$(pwd)"
-
- while [ -n "$application_directory" ]; do
- if [ -f "${application_directory}/script/rails" -o -f "${application_directory}/bin/rails" ]; then
- return
- fi
- application_directory="${application_directory%/*}"
- done
-
- application_directory=
-}
-
-__rails_setup_rails_options() {
- rails_options=(
- {-h,--help}'[Show this help message and quit]'
- {-v,--version}'[Show Rails version number and quit]'
+ local -a runtime_options rails_options
+ runtime_options=(
+ '(- *)'{-h,--help}'[Show this help message and quit]'
+ '(- *)'{-v,--version}'[Show Rails version and quit]'
)
-}
-__rails_setup_runtime_options() {
runtime_options=(
'(-f --force)'{-f,--force}'[Overwrite files that already exist]'
'(-p --pretend)'{-p,--pretend}'[Run but do not make any changes]'
'(-q --quiet)'{-q,--quiet}'[Suppress status output]'
'(-s --skip)'{-s,--skip}'[Skip files that already exist]'
)
-}
-
-__rails_setup_generators_options() {
- local -a runtime_options
- __rails_setup_runtime_options
-
- generators_options=(
- $runtime_options
- --skip-namespace'[Skip namespace (affects only isolated applications)]'
- --old-style-hash"[Force using old style hash (:foo => 'bar') on Ruby >= 1.9]"
- )
-}
-
-__rails_setup_model_generators_options() {
- local -a generators_options
- __rails_setup_generators_options
-
- model_generators_options=(
- $generators_options
- '(-o --orm)'{-o,--orm=}'[Orm to be invoked]:orm'
- )
-}
-
-__rails_setup_resource_generators_options() {
- local -a model_generators_options
- __rails_setup_model_generators_options
-
- resource_generators_options=(
- $model_generators_options
- --force-plural'[Forces the use of a plural ModelName]'
- --resource-route'[Indicates when to generate resource route]: :__rails_boolean'
- )
-}
-
-__rails_boolean() {
- _values 'boolean' 'true' 'false'
-}
-
-__rails_migration_fields() {
- if compset -P '*:*:'; then
- _values 'index' 'index' 'uniq'
- else
- if compset -P '*:'; then
- _values -s ':' 'type' 'string' 'text' 'integer' 'float' 'decimal' 'datetime' 'timestamp' 'time' 'date' 'binary' 'boolean' 'references'
- else
- _guard '[[:alnum:]_]#' 'field'
- fi
- fi
-}
-
-_rails_generate() {
- local context state line curcontext="$curcontext"
-
- if (( CURRENT > 2 )); then
- (( CURRENT-- ))
- shift words
- _call_function - "_rails_generate_${words[1]}" || _rails_generate_default
- else
- __rails_generate_commands
- fi
-}
-
-_rails_g() {
- _rails_generate
-}
-
-__rails_generate_commands() {
- local context curcontext="$curcontext" update_policy
-
- zstyle -s ":completion:${curcontext}:" cache-policy update_policy
- if [ -z "$update_policy" ]; then
- zstyle ":completion:${curcontext}:" cache-policy _rails_generate_commands_caching_policy
- fi
-
- local application_directory
- __rails_setup_application_directory
- local cache_name
- cache_name="rails/${application_directory##*/}/all_generators"
- if ! _retrieve_cache ${cache_name}; then
- local -a all_generators
- all_generators=($(_call_program rails_generators rails generate 2> /dev/null | awk '/^ [a-zA-Z_]+/{ print $1 }'))
- _store_cache ${cache_name} all_generators
- fi
-
- local -a rails_generators
- rails_generators=(${all_generators:#*:*})
- _describe -t rails_generators 'rails generator' rails_generators
-
- local -a -U namespaces
- local namespace
- local -a generators
- namespaces=(${(R)${(M)all_generators:#*:*}%:*})
- for namespace in $namespaces; do
- generators=(${${(M)all_generators:#${namespace}:*}/:/\\:})
- _describe -t ${namespace}_generators "${namespace/_/ } generator" generators
- done
-}
-
-_rails_generate_commands_caching_policy() {
- local application_directory
- __rails_setup_application_directory
-
- if [ "${application_directory}/Gemfile" -nt "$1" ]; then
- return 0
- fi
-
- local -a oldp
- oldp=( "$1"(Nmw+1) )
- (( $#oldp ))
-}
-
-_rails_generate_default() {
- local -a generators_options
- __rails_setup_generators_options
-
- _arguments \
- $generators_options \
- '*:argument'
-}
-
-_rails_generate_assets() {
- local -a generators_options
- __rails_setup_generators_options
-
- _arguments \
- $generators_options \
- '(-j --javascripts)'{-j,--javascripts}'[Generate JavaScripts]: :__rails_boolean' \
- '(-y --stylesheets)'{-y,--stylesheets}'[Generate Stylesheets]: :__rails_boolean' \
- '(-je --javascript-engine)'{-je,--javascript-engine=}'[Engine for JavaScripts]:javascript engine' \
- '(-se --stylesheet-engine)'{-se,--stylesheet-engine=}'[Engine for Stylesheets]:stylesheet engine' \
- ': :_guard "^-*" "name"'
-}
-
-_rails_generate_controller() {
- local -a generators_options
- __rails_setup_generators_options
-
- _arguments \
- $generators_options \
- '(-e --template-engine)'{-e,--template-engine=}'[Template engine to be invoked]:template engine' \
- '(-t --test-framework)'{-t,--test-framework=}'[Test framework to be invoked]:test framework' \
- --helper'[Indicates when to generate helper]: :__rails_boolean' \
- --assets'[Indicates when to generate assets]: :__rails_boolean' \
- ': :_guard "^-*" "name"' \
- '*: :_guard "^-*" "action"'
-}
-
-_rails_generate_generator() {
- local -a generators_options
- __rails_setup_generators_options
-
- _arguments \
- $generators_options \
- --namespace'[Namespace generator under lib/generators/name]: :__rails_boolean' \
- ': :_guard "^-*" "name"'
-}
-
-_rails_generate_helper() {
- local -a generators_options
- __rails_setup_generators_options
-
- _arguments \
- $generators_options \
- '(-t --test-framework)'{-t,--test-framework=}'[Test framework to be invoked]:test framework' \
- ': :_guard "^-*" "name"' \
-}
-
-_rails_generate_integration_test() {
- local -a generators_options
- __rails_setup_generators_options
-
- _arguments \
- $generators_options \
- --integration-tool='[Integration tool to be invoke]:integration tool' \
- ': :_guard "^-*" "name"' \
-}
-
-_rails_generate_jbuilder() {
- local -a generators_options
- __rails_setup_generators_options
-
- _arguments \
- $generators_options \
- ': :_guard "^-*" "name"' \
- '*: :__rails_migration_fields'
-}
-
-_rails_generate_mailer() {
- local -a generators_options
- __rails_setup_generators_options
- _arguments \
- $generators_options \
- '(-e --template-engine)'{-e,--template-engine=}'[Template engine to be invoked]:template engine' \
- '(-t --test-framework)'{-t,--test-framework=}'[Test framework to be invoked]:test framework' \
- ': :_guard "^-*" "name"' \
- '*: :_guard "^-*" "method"'
-}
-
-_rails_generate_migration() {
- local -a modelgenerators_options
- __rails_setup_model_generators_options
-
- _arguments \
- $model_generators_options \
- ': :_guard "^-*" "name"' \
- '*: :__rails_migration_fields'
-}
-
-_rails_generate_model() {
- _rails_generate_migration
-}
-
-_rails_generate_observer() {
- local -a model_generators_options
- __rails_setup_model_generators_options
-
- _arguments \
- $model_generators_options \
- ': :_guard "^-*" "name"'
-}
-
-_rails_generate_performance_test() {
- local -a generators_options
- __rails_setup_generators_options
-
- _arguments \
- $generators_options \
- --performance-tool='[Performance tool to be invoked]:performance tool' \
- ': :_guard "^-*" "name"' \
-}
-
-_rails_generate_resource() {
- local context state line curcontext="$curcontext"
-
- local -a resource_generators_options
- __rails_setup_resource_generators_options
+ local ret=1
_arguments -C \
- $resource_generators_options \
- '(-c --resource-controller)'{-c,--resource-controller=}'[Resource controller to be invoked]:name' \
- '(-a --actions)'{-a,--actions=}'[Actions for the resource controller]: :->actions' \
- ': :->name' \
- '*: :->fields'
-
- if (( words[(I)(--actions=*|-a)] > 0 && words[(I)(--actions=*|-a)] == words[(I)-*] )); then
- state=actions
- fi
+ $rails_options \
+ '1: :_rails_subcommands' \
+ '*:: :->command' && ret=0
case "$state" in
- actions)
- _guard "[[:alnum:]_]#" "actions"
- ;;
- name)
- _guard "^-*" "name"
- ;;
- fields)
- __rails_migration_fields
+ (command)
+ case $words[1] in
+ (new)
+ _rails_new && ret=0
+ ;;
+ (generate|g|destroy|d)
+ _rails_generate && ret=0
+ ;;
+ (console|c)
+ _arguments \
+ '(- *)'{-h,--help}'[Show this help message and quit]' \
+ '(-e --environment)'{-e,--environment=}'[The environment to run "console" in]:env:(test development production)' \
+ '(-s --sandbox)'{-s,--sandbox}'[Rollback database modifications on exit]' \
+ && ret=0
+ ;;
+ (server|s)
+ _arguments \
+ '(- *)'{-h,--help}'[Show this help message and quit]' \
+ '(-e --environment)'{-e,--environment=}'[The environment to run "server" in]:env:(test development production)' \
+ '(-p --port)'{-p,--port}'[Run Rails on the specified port]:port' \
+ '(-b --binding)'{-b,--binding=}'[Bind Rails to the specified IP]:binding' \
+ '(-c --config)'{-c,--config=}'[Use a custom rackup configuration]:config file:_files -g "*.ru"' \
+ '(-d --daemon)'{-d,--daemon}'[Run server as a Daemon]' \
+ '(-u --using)'{-u,--using=}'[Specify the Rack server used to run the application]:server:(thin puma webrick)' \
+ '(-P --pid)'{-P,--pid=}'[Specify the PID file]:pid file:_files -g "*.pid"' \
+ '(-C --dev-caching --no-dev-caching)'{-C,--dev-caching}'[Perform caching in development]' \
+ '(-C --dev-caching --no-dev-caching)--no-dev-caching[Not perform caching in development]' \
+ '--early-hints[Enable HTTP/2 early hints]' \
+ '(--log-to-stdout --no-log-to-stdout)--log-to-stdout[Log to stdout]' \
+ '(--log-to-stdout --no-log-to-stdout)--no-log-to-stdout[Not log to stdout]' \
+ && ret=0
+ ;;
+ (dbconsole|db)
+ _arguments \
+ '(- *)'{-h,--help}'[Show this help message and quit]' \
+ '(-e --environment)'{-e,--environment=}'[The environment to run "server" in]:env:(test development production)' \
+ '(-p --include-password)'{-p,--include-password}'[Automatically provide the password from database.yml]' \
+ '--mode=[Automatically put the sqlite3 database in the specified mode]:mode:(html list line column)' \
+ '(--header --no-header)--header[Display header]' \
+ '(--header --no-header)--no-header[Not display header]' \
+ '(--db --database)'{--db=,--database=}'[Specify the database to use]:database:_files' \
+ && ret=0
+ ;;
+ (test|t|test:system)
+ _arguments \
+ '(- *)'{-h,--help}'[Show this help message and quit]' \
+ '--no-plugins[Bypass minitest plugin auto-loading]' \
+ '(-s --seed)'{-s,--seed=}'[Sets random seed]:seed' \
+ '(-v -verbose)'{-v,--verbose}'[Show progress processing files]' \
+ '--show-skips[Show skipped at the end of run]' \
+ \*{-n,--name=}'[Filter run on /regexp/ or string]:pattern' \
+ *--exclude='[Exclude /regexp/ or string from run]:pattern' \
+ \*{-S,--skip=}'[Skip reporting of certain types of results]' \
+ '(-w --warnings)'{-w,--warnings}'[Run with Ruby warnings enabled]' \
+ '(-e --environment)'{-e,--environment=}'[Run tests in the given environment]' \
+ '(-b --backtrace)'{-b,--backtrace}'[Show the complete backtrace]' \
+ '(-d --defer-output)'{-d,--defer-output}'[Output test failures and errors after the test run]' \
+ '(-f --fail-fast)'{-f,--fail-fast}'[Abort test run on first failure or error]' \
+ '(-c --color --no-color)'{-c,--color}'[Enable color in the output]' \
+ '(-c --color --no-color)--no-color[Disable color in the output]' \
+ '--profile=[Enable profiling of tests and list the slowest test cases]:count' \
+ '(-p --pride)'{-p,--pride}'[Show your testing pride]' \
+ '*:: :_files -g "*.rb"' \
+ && ret=0
+ ;;
+ (runner|r)
+ _arguments \
+ '(- *)'{-h,--help}'[Show this help message and quit]' \
+ '(-e --environment)'{-e,--environment=}'[The environment to run "runner"]:env:(test development production)' \
+ '*:: :_files -g "*.rb"' \
+ && ret=0
+ ;;
+ (plugin)
+ _arguments \
+ '1: :(new)' \
+ '*:: :_rails_new' \
+ && ret=0
+ ;;
+ (routes)
+ _arguments \
+ '(- *)'{-h,--help}'[Show this help message and quit]' \
+ '(-c --controller)'{-c,--controller=}'[Filter by a specific controller]:controller' \
+ '(-g --grep)'{-g,--grep}'[Grep routes by a specific pattern]' \
+ '(-E --expanded)'{-E,--expanded}'[Print routes expanded vertically with parts explained]' \
+ '(-u --unused)'{-u,--unused}'[Print unused routes]' \
+ && ret=0
+ ;;
+ (*)
+ _arguments \
+ '(- *)'{-h,--help}'[Show help message and quit]' \
+ '*:: :_files' \
+ && ret=0
+ ;;
+ esac
;;
esac
-}
-
-_rails_generate_scaffold() {
- local -a resource_generators_options
- __rails_setup_resource_generators_options
-
- _arguments \
- $resource_generators_options \
- '(-y --stylesheets)'{-y,--stylesheets}'[Generate Stylesheets]: :__rails_boolean' \
- '(-se --stylesheet-engine)'{-se,--stylesheet-engine=}'[Engine for Stylesheets]:stylesheet engine' \
- '(-c --scaffold-controller)'{-c,--scaffold-controller=}'[Scaffold controller to be invoked]:name' \
- --assets'[Indicates when to generate assets]:boolean:(true false)' \
- ': :_guard "^-*" "name"' \
- '*: :__rails_migration_fields'
-}
-_rails_generate_scaffold_controller() {
- local -a model_generators_options
- __rails_setup_model_generators_options
-
- _arguments \
- $model_generators_options \
- '(-e --template-engine)'{-e,--template-engine=}'[Template engine to be invoked]:template engine' \
- '(-t --test-framework)'{-t,--test-framework=}'[Test framework to be invoked]:test framework' \
- --helper'[Indicates when to generate helper]: :__rails_boolean' \
- ': :_guard "^-*" "name"'
+ return ret
}
-_rails_generate_session_migration() {
- local -a model_generators_options
- __rails_setup_model_generators_options
-
- _arguments \
- $model_generators_options \
- ': :_guard "^-*" "name"'
-}
-
-_rails_generate_task() {
- local -a generators_options
- __rails_setup_generators_options
-
- _arguments \
- $generators_options \
- ': :_guard "^-*" "name"' \
- '*: :_guard "^-*" "action"'
-}
-
-_rails_console() {
- _arguments \
- '(- *)'{-h,--help}'[Show this help message]' \
- '(-s --sandbox)'{-s,--sandbox}'[Rollback database modifications on exit]' \
- --debugger'[Enable ruby-debugging for the console]'
-}
+(( $+functions[_rails_subcommands] )) ||
+_rails_subcommands() {
+ local -a commands
-_rails_c() {
- _rails_console
-}
+ _rails_is_in_app
-_rails_server() {
- _arguments \
- '(- *)'{-h,--help}'[Show this help message]' \
- '(-p --port)'{-p,--port=}'[Runs Rails on the specified port]: :_guard "[[\:digit\:]]#" "port"' \
- '(-b --binding)'{-b,--binding=}'[Binds Rails to the specified ip]:ip:_hosts' \
- '(-c --config)'{-c,--config=}'[Use custom rackup configuration file]:file:_files -g "*.ru"' \
- '(-d --daemon)'{-d,--daemon}'[Make server run as a Daemon]' \
- '(-u --debugger)'{-u,--debugger}'[Enable ruby-debugging for the server]' \
- '(-e --environment)'{-e,--environment=}'[Specifies the environment to run this server under (test/development/production)]:name:(test development production)' \
- '(-P --pid)'{-P,--pid=}'[Specifies the PID file]:pid:_files -g "*.pid"'
-}
+ if (( $? == 1 )); then
+ # is not in rails app directory
+ commands=(
+ new'[Create a new Rails application]'
+ )
+ else
+ commands=(
+ {generate,g}'[Generate new code]'
+ {console,c}'[Start the Rails console]'
+ {server,s}'[Start the Rails server]'
+ {test,t}'[Run tests]'
+ "test\\:system[Run systems test only]"
+ {dbconsole,db}'[Start a console for the database specified in config/database.yml]'
+ plugin'[Install a plugin]'
-_rails_s() {
- _rails_server
-}
+ # generated by ./bin/rails --help | ruby -ne '(b=$2;printf("%s[%s]\n", $1.gsub(/:/,"\\:"),b.strip)) if /^([a-z0-9_:]+)\S*\s+([^(\n]+)/'
+ "about[List versions of all Rails frameworks and the environment]"
+ "action_mailbox\:ingress\:exim[Relay an inbound email from Exim to Action Mailbox]"
+ "action_mailbox\:ingress\:postfix[Relay an inbound email from Postfix to Action Mailbox]"
+ "action_mailbox\:ingress\:qmail[Relay an inbound email from Qmail to Action Mailbox]"
+ "action_mailbox\:install[Install Action Mailbox and its dependencies]"
+ "action_mailbox\:install\:migrations[Copy migrations from action_mailbox to application]"
+ "action_text\:install[Copy over the migration, stylesheet, and JavaScript files]"
+ "action_text\:install\:migrations[Copy migrations from action_text to application]"
+ "active_storage\:install[Copy over the migration needed to the application]"
+ "app\:template[Apply the template supplied by LOCATION=]"
+ "app\:update[Update configs and some other initially generated files]"
+ "assets\:clean[Remove old compiled assets]"
+ "assets\:clobber[Remove compiled assets]"
+ "assets\:environment[Load asset compile environment]"
+ "assets\:precompile[Compile all the assets named in config.assets.precompile]"
+ "cache_digests\:dependencies[Lookup first-level dependencies for TEMPLATE]"
+ "cache_digests\:nested_dependencies[Lookup nested dependencies for TEMPLATE]"
+ "credentials\:diff[Enroll/disenroll in decrypted diffs of credentials using git]"
+ "credentials\:edit[Open the decrypted credentials in $VISUAL or $EDITOR for editing]"
+ "credentials\:show[Show the decrypted credentials]"
+ "db\:create[Create the database from DATABASE_URL or config/database.yml for the current RAILS_ENV]"
+ "db\:drop[Drop the database from DATABASE_URL or config/database.yml for the current RAILS_ENV]"
+ "db\:encryption\:init[Generate a set of keys for configuring Active Record encryption in a given environment]"
+ "db\:environment\:set[Set the environment value for the database]"
+ "db\:fixtures\:load[Load fixtures into the current environment's database]"
+ "db\:migrate[Migrate the database]"
+ "db\:migrate\:down[Run the 'down' for a given migration VERSION]"
+ "db\:migrate\:redo[Roll back the database one migration and re-migrate up]"
+ "db\:migrate\:status[Display status of migrations]"
+ "db\:migrate\:up[Run the 'up' for a given migration VERSION]"
+ "db\:prepare[Run setup if database does not exist, or run migrations if it does]"
+ "db\:reset[Drop and recreate all databases from their schema for the current environment and load the seeds]"
+ "db\:rollback[Roll the schema back to the previous version]"
+ "db\:schema\:cache\:clear[Clear a db/schema_cache.yml file]"
+ "db\:schema\:cache\:dump[Create a db/schema_cache.yml file]"
+ "db\:schema\:dump[Create a database schema file]"
+ "db\:schema\:load[Load a database schema file]"
+ "db\:seed[Load the seed data from db/seeds.rb]"
+ "db\:seed\:replant[Truncate tables of each database for current environment and load the seeds]"
+ "db\:setup[Create all databases, load all schemas, and initialize with the seed data]"
+ "db\:system\:change[Change 'config/database.yml' and your database gem to the target database]"
+ "db\:version[Retrieve the current schema version number]"
+ "destroy[Remove code generated by 'bin/rails generate']"
+ "dev\:cache[Toggle development mode caching on/off]"
+ "encrypted\:edit[Open the decrypted file in $VISUAL or $EDITOR for editing]"
+ "encrypted\:show[Show the decrypted contents of the file]"
+ "importmap\:install[Setup Importmap for the app]"
+ "initializers[Print out all defined initializers in the order they are invoked by Rails.]"
+ "log\:clear[Truncate all/specified *.log files in log/ to zero bytes]"
+ "middleware[Print out your Rack middleware stack]"
+ "notes[Show comments in your code annotated with FIXME, OPTIMIZE, and TODO]"
+ "restart[Restart app by touching tmp/restart.txt]"
+ "routes[List all the defined routes]"
+ "runner[Run Ruby code in the context of your application]"
+ "secret[Generate a cryptographically secure secret key]"
+ "secrets\:edit[**deprecated** Open the secrets in $VISUAL or $EDITOR for editing]"
+ "secrets\:show[**deprecated** Show the decrypted secrets]"
+ "stats[Report code statistics]"
+ "stimulus\:install[Install Stimulus into the app]"
+ "stimulus\:install\:importmap[Install Stimulus on an app running importmap-rails]"
+ "stimulus\:install\:node[Install Stimulus on an app running node]"
+ "test\:all[Run all tests, including system tests]"
+ "test\:channels[Run tests in test/channels]"
+ "test\:controllers[Run tests in test/controllers]"
+ "test\:db[Reset the database and run 'bin/rails test']"
+ "test\:functionals[Run tests in test/controllers, test/mailers, and test/functional]"
+ "test\:generators[Run tests in test/lib/generators]"
+ "test\:helpers[Run tests in test/helpers]"
+ "test\:integration[Run tests in test/integration]"
+ "test\:jobs[Run tests in test/jobs]"
+ "test\:mailboxes[Run tests in test/mailboxes]"
+ "test\:mailers[Run tests in test/mailers]"
+ "test\:models[Run tests in test/models]"
+ "test\:units[Run tests in test/models, test/helpers, and test/unit]"
+ "time\:zones[List all time zones, list by two-letter country code]"
+ "tmp\:clear[Clear cache, socket and screenshot files from tmp/]"
+ "tmp\:create[Create tmp directories for cache, sockets, and pids]"
+ "turbo\:install[Install Turbo into the app]"
+ "turbo\:install\:importmap[Install Turbo into the app with asset pipeline]"
+ "turbo\:install\:node[Install Turbo into the app with webpacker]"
+ "turbo\:install\:redis[Switch on Redis and use it in development]"
+ "version[Show the Rails version]"
+ "yarn\:install[Install all JavaScript dependencies as specified via Yarn]"
+ "zeitwerk\:check[Check project structure for Zeitwerk compatibility]"
+ )
+ fi
-_rails_dbconsole() {
- _arguments \
- '(- *)'--help'[Show this help message]' \
- '(-p --include-password)'{-p,--include-password}'[Automatically provide the password from database.yml]' \
- --mode'[Automatically put the sqlite3 database in the specified mode (html, list, line, column)]:mode:(html list line column)' \
- --header
+ _values 'command' $commands
}
+# rails new
+(( $+functions[_rails_new] )) ||
_rails_new() {
- local context state line curcontext="$curcontext"
-
- local _a rails_options runtime_options
- __rails_setup_rails_options
- __rails_setup_runtime_options
+ local ret=1
- _arguments -C \
- $rails_options \
+ _arguments \
$runtime_options \
- '(-r --ruby)'{-r,--ruby=}'[Path to the Ruby binary of your choice]:path' \
- '(-b --builder)'{-b,--builder=}'[Path to a application builder (can be a filesystem path or URL)]: :->path_or_url' \
- '(-m --template)'{-m,--template=}'[Path to an application template (can be a filesystem path or URL)]: :->path_or_url' \
+ $rails_options \
+ --skip-namespace'[Skip namespace]' \
+ '(-n --name)'{-n,--name=}'[Name of the app]:name' \
+ '(-r --ruby)'{-r,--ruby=}'[Path to the Ruby binary of your choice]:path:_files' \
+ '(-b --builder)'{-b,--builder=}'[Path to a application builder(can be a filesystem path or URL)]: :_rails_path_or_url' \
+ '(-m --template)'{-m,--template=}'[Path to an application template(can be a filesystem path or URL)]: :_rails_path_or_url' \
+ '(-d --database)'{-d,--database=}'[Preconfigure for selected database]:database:(mysql trilogy oracle postgresql sqlite3 frontbase ibm_db sqlserver jdbcmysql jdbcsqlite3 jdbcpostgresql jdbc)' \
--skip-gemfile"[Don't create a Gemfile]" \
--skip-bundle"[Don't run bundle install]" \
- '(-G --skip-git)'{-G,--skip-git}'[Skip Git ignores and keeps]' \
+ '(-G --skip-git)'{-G,--skip-git}'[Skip git init]' \
+ --skip-docker'[Skip Dockerfile]' \
+ --skip-keeps'[Skip source control .keep files]' \
+ '(-M --skip-action-mailer)'{-M,--skip-action-mailer}'[Skip Action Mailer files]' \
+ --skip-action-mailbox'[Skip Action Mailbox gem]' \
+ --skip-action-text'[Skip Action Text gem]' \
'(-O --skip-active-record)'{-O,--skip-active-record}'[Skip Active Record files]' \
- '(-S --skip-sprockets)'{-S,--skip-sprockets}'[Skip Sprockets files]' \
- '(-d --database)'{-d,--database=}'[Preconfigure for selected database]:database:(mysql oracle postgresql sqlite3 frontbase ibm_db sqlserver jdbcmysql jdbcsqlite3 jdbcpostgresql jdbc)' \
- '(-j --javascript)'{-j,--javascript=}'[Preconfigure for selected JavaScript library]:javascript' \
- '(-J --skip-javascript)'{-J,--skip-javascript}'[Skip JavaScript files]' \
+ --skip-active-job'[Skip Active Job]' \
+ --skip-active-storage'[Skip Active Storage files]' \
+ '(-C --skip-action-cable)'{-C,--skip-action-cable}'[Skip Action Cable files]' \
+ '(-A --skip-asset-pipeline)'{-A,--skip-asset-pipeline}'[Skip asset pipeline]' \
+ '(-a --asset-pipeline)'{-a,--asset-pipeline=}'[Choose your asset pipeline]:asset pipeline:(sprockets propshaft)' \
+ '(-J --skip-js)'{-J,--skip-js}'[Skip JavaScript files]' \
+ --skip-hotwire'[Skip Hotwire integration]' \
+ --skip-jbuilder'[Skip jbuilder gem]' \
+ '(-T --skip-test)'{-T,--skip-test}'[Skip test files]' \
+ --skip-system-test'[Skip system test files]' \
+ --skip-bootsnap'[Skip bootsnap gem]' \
+ --skip-dev-gems'[Skip development gems(e.g. web-console)]' \
--dev'[Setup the application with Gemfile pointing to your Rails checkout]' \
--edge'[Setup the application with Gemfile pointing to Rails repository]' \
- '(-T --skip-test-unit)'{-T,--skip-test-unit}'[Skip Test::Unit files]' \
- --old-style-hash"[Force using old style hash (:foo => 'bar') on Ruby >= 1.9]" \
- ':app path:_directories'
+ --master'[Set up the application with Gemfile pointing to Rails repository main branch]' \
+ --rc='[Path to file containing extra configuration options for rails command]:rc:_files' \
+ --api'[Preconfigure smaller stack for API only apps]' \
+ --minimal'[Preconfigure a minimal rails app]' \
+ '(-j --js)'{-j,--js=}'[Choose JavaScript approach]:javascript:(importmap bun webpack esbuild rollup)' \
+ '(-c --css)'{-c,--css=}'[Choose CSS processor]:css processor:(tailwind bootstrap bulma postcss sass)' \
+ '(-B --skip-bundle)'{-B,--skip-bundle}"[Don't run bundle install]" \
+ --skip-decrypted-diffs"[Don't configure git to show decrypted diffs of encrypted credentials]" \
+ ':app path:_directories' && ret=0
- case "$state" in
- path_or_url)
- _alternative \
- 'files:path:_files -g "*.rb"' \
- 'url:url:_urls'
- ;;
- esac
-}
-
-_rails_application() {
- _rails_new
-}
-
-_rails_db() {
- _rails_dbconsole
+ return ret
}
-_rails_destroy() {
- _rails_generate
-}
+# rails generate
+(( $+functions[_rails_generate] )) ||
+_rails_generate() {
+ local ret=1
-_rails_d() {
- _rails_destroy
-}
+ _arguments -C \
+ '(- *)'{-h,--help}"[Print generator's options and usage]" \
+ $runtime_options \
+ '1:generator:_rails_generate_generator' \
+ '*:: :->generate' && ret=0
-_rails_benchmarker() {
- _arguments \
- '(- *)'{-h,--help}'[Show this help message]' \
- '(-r --runs)'{-r,--runs}'[Number of runs]: :_guard "[[\:digit\:]]#" "number"' \
- '(-o --output)'{-o,--output}'[Directory to use when writing the results]:directory:_directories' \
- '(-m --metrics)'{-m,--metrics}'[Metrics to use]: :_values -s "," "metrics" "wall_time" "memory" "objects" "gc_runs" "gc_time"' \
- '*: :_guard "^-*" "ruby code"'
-}
+ case "$state" in
+ (generate)
+ local -a opts
+ opts=(
+ '(- *)'{-h,--help}'[Show this help message and quit]'
+ $runtime_options
+ '--skip-namespace[Skip namespace]'
+ '--skip-collision-check[Skip collision check]'
+ )
-_rails_profiler() {
- _arguments \
- '(- *)'{-h,--help}'[Show this help message]' \
- '(-r --runs)'{-r,--runs}'[Number of runs]: :_guard "[[\:digit\:]]#" "number"' \
- '(-o --output)'{-o,--output}'[Directory to use when writing the results]:directory:_directories' \
- '(-m --metrics)'{-m,--metrics}'[Metrics to use]: :_values -s "," "metrics" "process_time" "memory" "objects"' \
- '(-f --formats)'{-f,--formats}'[Formats to output to]: :_values -s "," "formats" "flat" "graph" "html" "call_tree" "call_stack"' \
- '*: :_guard "^-*" "ruby code"'
-}
+ case $words[1] in
+ (application_record|migration|model|resource|scaffold|scaffold_controller)
+ opts+=(
+ '(-o --orm)'{-o,--orm=}'[ORM to be invoked]:orm:(active_record)'
+ )
+ ;|
+ (channel)
+ opts+=(
+ '--no-assets[Not generate assets]'
+ )
+ ;|
+ (controller|resource|scaffold|scaffold_controller)
+ opts+=(
+ '--skip-routes[Do not add routes to config/routes.rb]'
+ '--no-helper[Not generate helper]'
+ )
+ ;|
+ (controller|job|model|resource|scaffold)
+ opts+=(
+ '--parent=[The parent class for the generated controller]:parent class'
+ )
+ ;|
+ (controller|mailer|resource|scaffold|scaffold_controller)
+ opts+=(
+ '(-e --template-engine)'{-e,--template-engine=}'[Template engine to be invoked]:engine:(erb)'
+ )
+ ;|
+ (channel|controller|generator|helper|job|mailbox|mailer|model|scaffold|scaffold_controller)
+ opts+=(
+ '(-t --test-framework)'{-t,--test-framework=}'[Test framework to be invoked]:test_framework:(test_unit)'
+ )
+ ;|
+ (generator|test_unit:channel)
+ opts+=(
+ '--no-namespace[Not generate namespace generate]'
+ )
+ ;|
+ (integration_test)
+ opts+=(
+ '--integration-tool=[Integration tool to be invoked]:tool:(test_unit)'
+ )
+ ;|
+ (jbuilder|resource|scaffold|scaffold_controller)
+ opts+=(
+ '--model-name=[ModelName to be used]:name'
+ )
+ ;|
+ (jbuilder|model|resource|scaffold|scaffold_controller)
+ opts+=(
+ '--force-plural[Do not singularize the model name]'
+ )
+ ;|
+ (jbuilder|migration|model|resource|scaffold_controller)
+ opts+=(
+ '--no-timestamps[Not generate timestamps]'
+ )
+ ;|
+ (job)
+ opts+=(
+ '--queue=[The queue name for the generated job]:name'
+ )
+ ;|
+ (migration|model|resource|scaffold)
+ opts+=(
+ '--primary-key-type=[The type for primary key]'
+ '(--db --database)'{--db,--database=}'[The database for your migration]:db'
+ )
+ ;|
+ (model|resource|scaffold)
+ opts+=(
+ '--no-migration[Not generate migration]'
+ '--no-indexes[Not add indexes for references and belongs_to columns]'
+ '--no-fixture[Not generate fixture]'
+ '(-r --fixture-replacement)'{-r,--fixture-replacement=}'[Fixture replacement to be invoked]:fixture'
+ )
+ ;|
+ (resource)
+ opts+=(
+ '(-c --resource-controller)'{-c,--resource-controller=}'[Resource controller to be invoked]:controller:(controller)'
+ '(-a --actions)'{-a,--actions=}'[Actions for the source controller]:action'
+ )
+ ;|
+ (resource|scaffold|scaffold_controller)
+ opts+=(
+ '--no-resource-route[Not generate resource route]'
+ )
+ ;|
+ (scaffold)
+ opts+=(
+ '(-c --scaffold-controller)'{-c,--scaffold-controller=}'[Scaffold controller to be invoked]:controller:(scaffold_controller)'
-_rails_plugin() {
- local context state line curcontext="$curcontext"
+ )
+ ;|
+ (scaffold|scaffold_controller)
+ opts+=(
+ '--api[Generate API-only controller and tests, with no view templates]'
+ '--no-jbuilder[Not generate jbuilder]'
+ )
+ ;|
+ (scaffold|scaffold_controller|system_test)
+ opts+=(
+ '--system-tests=[System test framework to be invoked]:framework:(test_unit)'
+ )
+ ;|
+ (stimulus)
+ opts+=(
+ '--skip-manifest[Do not update the stimulus manifest]'
+ )
+ ;|
+ (jbuilder|migration|resource|scaffold)
+ opts+=(
+ '*:field:_rails_migration_fields'
+ )
+ ;|
+ esac
- if (( CURRENT > 2 )); then
- (( CURRENT-- ))
- shift words
- _call_function - "_rails_plugin_${words[1]}" || _nothing
- else
- __rails_plugin_commands
- fi
-}
+ _arguments $opts && ret=0
+ ;;
+ esac
-__rails_plugin_commands() {
- _values 'plugin command' \
- install'[Install plugin(s) from known repositories or URLs]' \
- remove'[Uninstall plugins]' \
- new
+ return ret
}
-_rails_plugin_install() {
- _arguments \
- '(-x --externals)'{-x,--externals}'[Use svn:externals to grab the plugin. Enables plugin updates and plugin versioning]' \
- '(-o --checkout)'{-o,--checkout}'[Use svn checkout to grab the plugin. Enables updating but does not add a svn:externals entry]' \
- '(-e --export)'{-e,--export}'[Use svn export to grab the plugin. Exports the plugin, allowing you to check it into your local repository. Does not enable updates or add an svn:externals entry]' \
- '(-q --quiet)'{-q,--quiet}'[Suppresses the output from installation. Ignored if -v is passed (rails plugin -v install ...)]' \
- '(-r --revision)'{-r,--revision=}'[Checks out the given revision from subversion or git. Ignored if subversion/git is not used]:revision' \
- '(-f --force)'{-f,--force}"[Reinstalls a plugin if it's already installed]" \
- '*:plugin:_urls'
-}
+(( $+functions[_rails_generate_generator] )) ||
+_rails_generate_generator() {
+ local -a generators=(
+ # rails
+ application_record benchmark channel controller generator helper integration_test
+ jbuilder job mailbox mailer migration model resource scaffold scaffold_controller
+ system_test task
-_rails_plugin_remove() {
- local -a plugins
+ # active record
+ "active_record\\:application_record"
+ "active_record\\:multi_db"
- plugins=($(_call_program rails_plugins ls -1 vendor/plugins))
+ # Stimulus
+ stimulus
- _describe -t plugins 'plugin' plugins
-}
+ # TestUnit
+ "test_unit\\:channel" "test_unit\\:generator" "test_unit\\:install"
+ "test_unit\\:mailbox" "test_unit\\:plugin"
+ )
-_rails_plugin_new() {
- _rails_new
+ _values 'generators' $generators
}
-_rails_runner() {
- local context state line curcontext="$curcontext"
-
- _arguments -C \
- '(- *)'{-h,--help}'[Show this help message]' \
- '(-e --environment)'{-e,--environment=}'[Specifies the environment for the runner to operate under (test/development/production)]:name:(test development production)' \
- ': :->code_or_path'
+# Utilities
+(( $+functions[_rails_is_in_app] )) ||
+_rails_is_in_app() {
+ local dir="$PWD"
+ while [ -n "$dir" ]; do
+ if [[ -f "${dir}/bin/rails" ]]; then
+ return 0
+ fi
+ dir="${dir/*}"
+ done
- case "$state" in
- code_or_path)
- _alternative \
- 'files:filename:_files -g "*.rb"' \
- 'codes:ruby code:_guard "^-*" "ruby code"'
- ;;
- esac
+ return 1
}
-_rails_r() {
- _rails_runner
+(( $+functions[_rails_path_or_url] )) ||
+_rails_path_or_url() {
+ _alternative \
+ 'files:path:_files -g "*.rb"' \
+ 'url:url:_urls'
}
-_rails_test() {
- local context state line curcontext="$curcontext"
-
- _arguments -C \
- ': :->path'
-
- case "$state" in
- path)
- _alternative \
- 'files:filename:_files -g "*.rb"'
- ;;
- esac
-}
-
-_rails_t() {
- _rails_test
+(( $+functions[_rails_migration_fields] )) ||
+_rails_migration_fields() {
+ if compset -P '*:*:'; then
+ _values 'index' 'index' 'uniq'
+ else
+ if compset -P '*:'; then
+ _values -s ':' 'type' 'string' 'text' 'integer' 'float' 'decimal' 'datetime' 'timestamp' 'time' 'date' 'binary' 'boolean' 'references'
+ else
+ _guard '[[:alnum:]_]#' 'field'
+ fi
+ fi
}
_rails "$@"
diff --git a/plugins/rake-fast/rake-fast.plugin.zsh b/plugins/rake-fast/rake-fast.plugin.zsh
index 86e5ed586..082f02f29 100644
--- a/plugins/rake-fast/rake-fast.plugin.zsh
+++ b/plugins/rake-fast/rake-fast.plugin.zsh
@@ -43,14 +43,17 @@ _tasks_changed () {
}
_rake_generate () {
- echo "version:$_rake_tasks_version" > .rake_tasks
-
- rake --silent --tasks --all \
+ local rake_tasks_content="version:$_rake_tasks_version\n"
+ rake_tasks_content+=$(rake --silent --tasks --all \
| sed "s/^rake //" | sed "s/\:/\\\:/g" \
| sed "s/\[[^]]*\]//g" \
| sed "s/ *# /\:/" \
- | sed "s/\:$//" \
- >> .rake_tasks
+ | sed "s/\:$//")
+
+ local rake_tasks_file="$(mktemp -t .rake_tasks.XXXXXX)"
+ echo $rake_tasks_content > $rake_tasks_file
+
+ mv $rake_tasks_file .rake_tasks
}
_rake () {
diff --git a/plugins/rand-quote/rand-quote.plugin.zsh b/plugins/rand-quote/rand-quote.plugin.zsh
index 23c21dc8f..1eda54caa 100644
--- a/plugins/rand-quote/rand-quote.plugin.zsh
+++ b/plugins/rand-quote/rand-quote.plugin.zsh
@@ -8,7 +8,7 @@ function quote {
# Get random quote data
local data
- data="$(command curl -s --connect-timeout 2 "http://www.quotationspage.com/random.php" \
+ data="$(command curl -s --connect-timeout 2 "https://www.quotationspage.com/random.php" \
| iconv -c -f ISO-8859-1 -t UTF-8 \
| command grep -a -m 1 'dt class="quote"')"
diff --git a/plugins/rbfu/README.md b/plugins/rbfu/README.md
deleted file mode 100644
index fbcab64de..000000000
--- a/plugins/rbfu/README.md
+++ /dev/null
@@ -1,18 +0,0 @@
-# rbfu plugin
-
-This plugin starts [rbfu](https://github.com/hmans/rbfu), a minimal Ruby version
-manager, and adds some useful functions.
-
-To use it, add `rbfu` to the plugins array in your zshrc file:
-
-```zsh
-plugins=(... rbfu)
-```
-
-**Note: `rbfu` is deprecated and should no longer be used.**
-
-## Functions
-
-- `rbfu-rubies`: lists all installed rubies available to rbfu.
-
-- `rvm_prompt_info`: shows the Ruby version being used with rbfu.
diff --git a/plugins/rbfu/rbfu.plugin.zsh b/plugins/rbfu/rbfu.plugin.zsh
deleted file mode 100644
index 27dc3eec6..000000000
--- a/plugins/rbfu/rbfu.plugin.zsh
+++ /dev/null
@@ -1,49 +0,0 @@
-# Enables rbfu with --auto option, if available.
-#
-# Also provides a command to list all installed/available
-# rubies. To ensure compatibility with themes, creates the
-# rvm_prompt_info function to return the $RBFU_RUBY_VERSION
-# version.
-
-command -v rbfu &>/dev/null || return
-
-eval "$(rbfu --init --auto)"
-
-# Internal: Print ruby version details, if it's currently active, etc.
-function _rbfu_rubies_print() {
- # 1: path to ruby file
- # 2: active ruby
- local rb rb_out
- rb="${$1:t}"
- rb_out="$rb"
-
- # If the ruby is a symlink, add @ to the name.
- if [[ -h "$1" ]]; then
- rb_out="${rb_out}${fg[green]}@${reset_color}"
- fi
-
- # If the ruby is active, add * to the name and show it in red.
- if [[ "$rb" = "$2" ]]; then
- rb_out="${fg[red]}${rb_out} ${fg[red]}*${reset_color}"
- fi
-
- echo $rb_out
-}
-
-# Public: Provide a list with all available rubies, this basically depends
-# on ~/.rfbu/rubies. Highlights the currently active ruby version and aliases.
-function rbfu-rubies() {
- local rbfu_dir active_rb
- rbfu_dir="${RBFU_RUBIES:-${HOME}/.rbfu/rubies}"
- active_rb="${RBFU_RUBY_VERSION:-system}"
-
- _rbfu_rubies_print "${rbfu_dir}/system" "$active_rb"
- for rb in ${rbfu_dir}/*(N); do
- _rbfu_rubies_print "$rb" "$active_rb"
- done
-}
-
-# Public: Create rvm_prompt_info command for themes compatibility, unless
-# it has already been defined.
-(( ${+functions[rvm_prompt_info]} )) || \
-function rvm_prompt_info() { echo "${${RBFU_RUBY_VERSION:=system}:gs/%/%%}" }
diff --git a/plugins/rbw/rbw.plugin.zsh b/plugins/rbw/rbw.plugin.zsh
index b6cecf8b4..0b55e6e5f 100644
--- a/plugins/rbw/rbw.plugin.zsh
+++ b/plugins/rbw/rbw.plugin.zsh
@@ -29,9 +29,24 @@ function rbwpw {
echo "$service not found"
return 1
fi
+
+ # Generate a random identifier for this call to rbwpw
+ # so we can check if the clipboard content has changed
+ local _random="$RANDOM" _cache="$ZSH_CACHE_DIR/.rbwpw"
+ echo -n "$_random" > "$_cache"
+
+ # Use clipcopy to copy the password to the clipboard
echo -n $pw | clipcopy
echo "password for $service copied!"
- {sleep 20 && clipcopy </dev/null 2>/dev/null} &|
+
+ # Clear the clipboard after 20 seconds, but only if the clipboard hasn't
+ # changed (if rbwpw hasn't been called again)
+ {
+ sleep 20 \
+ && [[ "$(<"$_cache")" == "$_random" ]] \
+ && clipcopy </dev/null 2>/dev/null \
+ && command rm -f "$_cache" &>/dev/null
+ } &|
}
function _rbwpw {
diff --git a/plugins/rclone/README.md b/plugins/rclone/README.md
new file mode 100644
index 000000000..aa2ced94a
--- /dev/null
+++ b/plugins/rclone/README.md
@@ -0,0 +1,9 @@
+# Rclone plugin
+
+This plugin adds completion for [Rclone](https://rclone.org/), the command-line program to manage files on cloud storage.
+
+To use it, add `rclone` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... rclone)
+```
diff --git a/plugins/rclone/rclone.plugin.zsh b/plugins/rclone/rclone.plugin.zsh
new file mode 100644
index 000000000..a6676131c
--- /dev/null
+++ b/plugins/rclone/rclone.plugin.zsh
@@ -0,0 +1,14 @@
+# Completion
+if (( ! $+commands[rclone] )); then
+ return
+fi
+
+# If the completion file doesn't exist yet, we need to autoload it and
+# bind it to `rclone`. Otherwise, compinit will have already done that.
+if [[ ! -f "$ZSH_CACHE_DIR/completions/_rclone" ]]; then
+ typeset -g -A _comps
+ autoload -Uz _rclone
+ _comps[rclone]=_rclone
+fi
+
+rclone completion zsh - >| "$ZSH_CACHE_DIR/completions/_rclone" &|
diff --git a/plugins/react-native/README.md b/plugins/react-native/README.md
index 807c063a5..39eed6c68 100644
--- a/plugins/react-native/README.md
+++ b/plugins/react-native/README.md
@@ -54,6 +54,10 @@ plugins=(... react-native)
| **rnios14pl** | `react-native run-ios --simulator "iPhone 14 Plus"` |
| **rnios14p** | `react-native run-ios --simulator "iPhone 14 Pro"` |
| **rnios14pm** | `react-native run-ios --simulator "iPhone 14 Pro Max"` |
+| **rnios15** | `react-native run-ios --simulator "iPhone 15"` |
+| **rnios15pl** | `react-native run-ios --simulator "iPhone 15 Plus"` |
+| **rnios15p** | `react-native run-ios --simulator "iPhone 15 Pro"` |
+| **rnios15pm** | `react-native run-ios --simulator "iPhone 15 Pro Max"` |
| _iPad_ | |
| **rnipad2** | `react-native run-ios --simulator "iPad 2"` |
| **rnipad5** | `react-native run-ios --simulator "iPad (5th generation)"` |
diff --git a/plugins/react-native/react-native.plugin.zsh b/plugins/react-native/react-native.plugin.zsh
index afeaab4fd..9ee081248 100644
--- a/plugins/react-native/react-native.plugin.zsh
+++ b/plugins/react-native/react-native.plugin.zsh
@@ -39,6 +39,10 @@ alias rnios14='react-native run-ios --simulator "iPhone 14"'
alias rnios14pl='react-native run-ios --simulator "iPhone 14 Plus"'
alias rnios14p='react-native run-ios --simulator "iPhone 14 Pro"'
alias rnios14pm='react-native run-ios --simulator "iPhone 14 Pro Max"'
+alias rnios15='react-native run-ios --simulator "iPhone 15"'
+alias rnios15pl='react-native run-ios --simulator "iPhone 15 Plus"'
+alias rnios15p='react-native run-ios --simulator "iPhone 15 Pro"'
+alias rnios15pm='react-native run-ios --simulator "iPhone 15 Pro Max"'
# iPad
alias rnipad2='react-native run-ios --simulator "iPad 2"'
diff --git a/plugins/repo/_repo b/plugins/repo/_repo
index 2b1f165f1..c7a1eb11e 100644
--- a/plugins/repo/_repo
+++ b/plugins/repo/_repo
@@ -131,6 +131,8 @@ _repo()
"(--autosquash)--no-ff[Pass --autosquash to git rebase]"\
"(--whitespace=)--whitespace=[Pass --whitespace to git rebase]: :__git_apply_whitespace_strategies"\
"(--auto-stash)--auto-stash[Stash local modifications before starting]"\
+ "(--update-refs)--update-refs[Automatically force-update any branches that point to commits that are being rebased.]"\
+ "(--no-update-refs)--no-update-refs[Turn off the automatic force-update of any branches that point to commits that are being rebased.]"\
&& ret=0
;;
(checkout)
diff --git a/plugins/ripgrep/README.md b/plugins/ripgrep/README.md
deleted file mode 100644
index ab9d04116..000000000
--- a/plugins/ripgrep/README.md
+++ /dev/null
@@ -1,9 +0,0 @@
-# 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)
-```
diff --git a/plugins/ripgrep/_ripgrep b/plugins/ripgrep/_ripgrep
deleted file mode 100644
index a93a8b8eb..000000000
--- a/plugins/ripgrep/_ripgrep
+++ /dev/null
@@ -1,640 +0,0 @@
-#compdef rg
-
-##
-# zsh completion function for ripgrep
-#
-# Run ci/test-complete after building to ensure that the options supported by
-# this function stay in synch with the `rg` binary.
-#
-# For convenience, a completion reference guide is included at the bottom of
-# this file.
-#
-# 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]'
- '(: * -)'--pcre2-version'[print the version of PCRE2 used by ripgrep, if available]'
-
- + '(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]'
- '--include-zero[include files with zero matches in summary]'
-
- + '(encoding)' # Encoding options
- {-E+,--encoding=}'[specify text encoding of files to search]: :_rg_encodings'
- $no'--no-encoding[use default text encoding]'
-
- + '(engine)' # Engine choice options
- '--engine=[select which regex engine to use]:when:((
- default\:"use default engine"
- pcre2\:"identical to --pcre2"
- auto\:"identical to --auto-hybrid-regex"
- ))'
-
- + 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]'
- {-I,--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'
-
- + '(glob-case-insensitive)' # File-glob case sensitivity options
- '--glob-case-insensitive[treat -g/--glob patterns case insensitively]'
- $no'--no-glob-case-insensitive[treat -g/--glob patterns case sensitively]'
-
- + '(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]"
-
- + '(hybrid)' # hybrid regex options
- '--auto-hybrid-regex[dynamically use PCRE2 if necessary]'
- $no"--no-auto-hybrid-regex[don't dynamically use PCRE2 if necessary]"
-
- + '(ignore)' # Ignore-file options
- "(--no-ignore-global --no-ignore-parent --no-ignore-vcs --no-ignore-dot)--no-ignore[don't respect ignore files]"
- $no'(--ignore-global --ignore-parent --ignore-vcs --ignore-dot)--ignore[respect ignore files]'
-
- + '(ignore-file-case-insensitive)' # Ignore-file case sensitivity options
- '--ignore-file-case-insensitive[process ignore files case insensitively]'
- $no'--no-ignore-file-case-insensitive[process ignore files case sensitively]'
-
- + '(ignore-exclude)' # Local exclude (ignore)-file options
- "--no-ignore-exclude[don't respect local exclude (ignore) files]"
- $no'--ignore-exclude[respect local exclude (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]'
-
- + '(require-git)' # git specific settings
- "--no-require-git[don't require git repository to respect gitignore rules]"
- $no'--require-git[require git repository to respect gitignore rules]'
-
- + '(ignore-dot)' # .ignore options
- "--no-ignore-dot[don't respect .ignore files]"
- $no'--ignore-dot[respect .ignore files]'
-
- + '(ignore-files)' # custom global ignore file options
- "--no-ignore-files[don't respect --ignore-file flags]"
- $no'--ignore-files[respect --ignore-file 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-columns-preview)' # max column preview options
- '--max-columns-preview[show preview for long lines (with -M)]'
- $no"--no-max-columns-preview[don't show preview for long lines (with -M)]"
-
- + '(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]'
- "--binary[search binary files, don't print binary data]"
- $no"--no-binary[don't search binary files]"
- $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]'
-
- + '(unicode)' # Unicode options
- $no'--unicode[enable Unicode mode]'
- '--no-unicode[disable Unicode mode]'
-
- + '(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'
- $no"--no-context-separator[don't print context separators]"
- '--debug[show debug messages]'
- '--field-context-separator[set string to delimit fields in context lines]'
- '--field-match-separator[set string to delimit fields in matching lines]'
- '--trace[show more verbose 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 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 none
- )
-
- _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 "$@"
-
-################################################################################
-# ZSH COMPLETION REFERENCE
-#
-# For the convenience of developers who aren't especially familiar with zsh
-# completion functions, a brief reference guide follows. This is in no way
-# comprehensive; it covers just enough of the basic structure, syntax, and
-# conventions to help someone make simple changes like adding new options. For
-# more complete documentation regarding zsh completion functions, please see the
-# following:
-#
-# * http://zsh.sourceforge.net/Doc/Release/Completion-System.html
-# * https://github.com/zsh-users/zsh/blob/master/Etc/completion-style-guide
-#
-# OVERVIEW
-#
-# Most zsh completion functions are defined in terms of `_arguments`, which is a
-# shell function that takes a series of argument specifications. The specs for
-# `rg` are stored in an array, which is common for more complex functions; the
-# elements of the array are passed to `_arguments` on invocation.
-#
-# ARGUMENT-SPECIFICATION SYNTAX
-#
-# The following is a contrived example of the argument specs for a simple tool:
-#
-# '(: * -)'{-h,--help}'[display help information]'
-# '(-q -v --quiet --verbose)'{-q,--quiet}'[decrease output verbosity]'
-# '!(-q -v --quiet --verbose)--silent'
-# '(-q -v --quiet --verbose)'{-v,--verbose}'[increase output verbosity]'
-# '--color=[specify when to use colors]:when:(always never auto)'
-# '*:example file:_files'
-#
-# Although there may appear to be six specs here, there are actually nine; we
-# use brace expansion to combine specs for options that go by multiple names,
-# like `-q` and `--quiet`. This is customary, and ties in with the fact that zsh
-# merges completion possibilities together when they have the same description.
-#
-# The first line defines the option `-h`/`--help`. With most tools, it isn't
-# useful to complete anything after `--help` because it effectively overrides
-# all others; the `(: * -)` at the beginning of the spec tells zsh not to
-# complete any other operands (`:` and `*`) or options (`-`) after this one has
-# been used. The `[...]` at the end associates a description with `-h`/`--help`;
-# as mentioned, zsh will see the identical descriptions and merge these options
-# together when offering completion possibilities.
-#
-# The next line defines `-q`/`--quiet`. Here we don't want to suppress further
-# completions entirely, but we don't want to offer `-q` if `--quiet` has been
-# given (since they do the same thing), nor do we want to offer `-v` (since it
-# doesn't make sense to be quiet and verbose at the same time). We don't need to
-# tell zsh not to offer `--quiet` a second time, since that's the default
-# behaviour, but since this line expands to two specs describing `-q` *and*
-# `--quiet` we do need to explicitly list all of them here.
-#
-# The next line defines a hidden option `--silent` — maybe it's a deprecated
-# synonym for `--quiet`. The leading `!` indicates that zsh shouldn't offer this
-# option during completion. The benefit of providing a spec for an option that
-# shouldn't be completed is that, if someone *does* use it, we can correctly
-# suppress completion of other options afterwards.
-#
-# The next line defines `-v`/`--verbose`; this works just like `-q`/`--quiet`.
-#
-# The next line defines `--color`. In this example, `--color` doesn't have a
-# corresponding short option, so we don't need to use brace expansion. Further,
-# there are no other options it's exclusive with (just itself), so we don't need
-# to define those at the beginning. However, it does take a mandatory argument.
-# The `=` at the end of `--color=` indicates that the argument may appear either
-# like `--color always` or like `--color=always`; this is how most GNU-style
-# command-line tools work. The corresponding short option would normally use `+`
-# — for example, `-c+` would allow either `-c always` or `-calways`. For this
-# option, the arguments are known ahead of time, so we can simply list them in
-# parentheses at the end (`when` is used as the description for the argument).
-#
-# The last line defines an operand (a non-option argument). In this example, the
-# operand can be used any number of times (the leading `*`), and it should be a
-# file path, so we tell zsh to call the `_files` function to complete it. The
-# `example file` in the middle is the description to use for this operand; we
-# could use a space instead to accept the default provided by `_files`.
-#
-# GROUPING ARGUMENT SPECIFICATIONS
-#
-# Newer versions of zsh support grouping argument specs together. All specs
-# following a `+` and then a group name are considered to be members of the
-# named group. Grouping is useful mostly for organisational purposes; it makes
-# the relationship between different options more obvious, and makes it easier
-# to specify exclusions.
-#
-# We could rewrite our example above using grouping as follows:
-#
-# '(: * -)'{-h,--help}'[display help information]'
-# '--color=[specify when to use colors]:when:(always never auto)'
-# '*:example file:_files'
-# + '(verbosity)'
-# {-q,--quiet}'[decrease output verbosity]'
-# '!--silent'
-# {-v,--verbose}'[increase output verbosity]'
-#
-# Here we take advantage of a useful feature of spec grouping — when the group
-# name is surrounded by parentheses, as in `(verbosity)`, it tells zsh that all
-# of the options in that group are exclusive with each other. As a result, we
-# don't need to manually list out the exclusions at the beginning of each
-# option.
-#
-# Groups can also be referred to by name in other argument specs; for example:
-#
-# '(xyz)--aaa' '*: :_files'
-# + xyz --xxx --yyy --zzz
-#
-# Here we use the group name `xyz` to tell zsh that `--xxx`, `--yyy`, and
-# `--zzz` are not to be completed after `--aaa`. This makes the exclusion list
-# much more compact and reusable.
-#
-# CONVENTIONS
-#
-# zsh completion functions generally adhere to the following conventions:
-#
-# * Use two spaces for indentation
-# * Combine specs for options with different names using brace expansion
-# * In combined specs, list the short option first (as in `{-a,--text}`)
-# * Use `+` or `=` as described above for options that take arguments
-# * Provide a description for all options, option-arguments, and operands
-# * Capitalise/punctuate argument descriptions as phrases, not complete
-# sentences — 'display help information', never 'Display help information.'
-# (but still capitalise acronyms and proper names)
-# * Write argument descriptions as verb phrases — 'display x', 'enable y',
-# 'use z'
-# * Word descriptions to make it clear when an option expects an argument;
-# usually this is done with the word 'specify', as in 'specify x' or
-# 'use specified x')
-# * Write argument descriptions as tersely as possible — for example, articles
-# like 'a' and 'the' should be omitted unless it would be confusing
-#
-# Other conventions currently used by this function:
-#
-# * Order argument specs alphabetically by group name, then option name
-# * Group options that are directly related, mutually exclusive, or frequently
-# referenced by other argument specs
-# * Use only characters in the set [a-z0-9_-] in group names
-# * Order exclusion lists as follows: short options, long options, groups
-# * Use American English in descriptions
-# * Use 'don't' in descriptions instead of 'do not'
-# * Word descriptions for related options as similarly as possible. For example,
-# `--foo[enable foo]` and `--no-foo[disable foo]`, or `--foo[use foo]` and
-# `--no-foo[don't use foo]`
-# * Word descriptions to make it clear when an option only makes sense with
-# another option, usually by adding '(with -x)' to the end
-# * Don't quote strings or variables unnecessarily. When quotes are required,
-# prefer single-quotes to double-quotes
-# * Prefix option specs with `$no` when the option serves only to negate the
-# behaviour of another option that must be provided explicitly by the user.
-# This prevents rarely used options from cluttering up the completion menu
-################################################################################
-
-# ------------------------------------------------------------------------------
-# 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/_ros b/plugins/ros/_ros
index 6a04d3c8f..c73a7b353 100644
--- a/plugins/ros/_ros
+++ b/plugins/ros/_ros
@@ -18,7 +18,7 @@ _1st_arguments=(
'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
diff --git a/plugins/rsync/README.md b/plugins/rsync/README.md
index 032ee7f3b..04d16c88b 100644
--- a/plugins/rsync/README.md
+++ b/plugins/rsync/README.md
@@ -1,16 +1,26 @@
# rsync
-This plugin adds aliases for frequent [rsync](https://rsync.samba.org/) commands.
+This plugin adds aliases for frequent [rsync](https://rsync.samba.org/) commands, simplifying file transfer and synchronization tasks.
-To use it add `rsync` to the plugins array in you zshrc file.
+To use it add `rsync` to the plugins array in you `.zshrc` file.
```zsh
plugins=(... rsync)
```
-| Alias | Command |
-| ------------------- | ------------------------------------------------ |
-| *rsync-copy* | `rsync -avz --progress -h` |
-| *rsync-move* | `rsync -avz --progress -h --remove-source-files` |
-| *rsync-update* | `rsync -avzu --progress -h` |
-| *rsync-synchronize* | `rsync -avzu --delete --progress -h` |
+| Alias | Command | Description |
+| ------------------- | ------------------------------------------------ | ------------|
+| `rsync-copy` | `rsync -avz --progress -h` | Recursively copy files and directories, preserving permissions, timestamps, and symbolic links. Compression is enabled for faster transfers. Progress is displayed in a human-readable format. |
+| `rsync-move` | `rsync -avz --progress -h --remove-source-files` | Same as rsync-copy, but removes the source files after a successful transfer (effectively performing a move). |
+| `rsync-update` | `rsync -avzu --progress -h` | Like rsync-copy, but only updates files if the source is newer than the destination (or if the destination file is missing). |
+| `rsync-synchronize` | `rsync -avzu --delete --progress -h` | Performs bidirectional-style sync: updates files as in rsync-update and deletes files in the destination that no longer exist in the source. Useful for directory synchronization. |
+
+Explanation of Flags:
+ - -a: Archive mode; preserves symbolic links, permissions, timestamps, etc.
+ - -v: Verbose; shows details of the transfer process.
+ - -z: Compress file data during transfer for efficiency.
+ - -u: Skip files that are newer on the receiver.
+ - --progress: Show progress during file transfer.
+ - -h: Output numbers in human-readable format (e.g., 1K, 234M).
+ - --remove-source-files: Deletes source files after they are copied (used in rsync-move).
+ - --delete: Deletes files in the destination that are not present in the source (used in rsync-synchronize).
diff --git a/plugins/rtx/README.md b/plugins/rtx/README.md
deleted file mode 100644
index c6436d3a7..000000000
--- a/plugins/rtx/README.md
+++ /dev/null
@@ -1,30 +0,0 @@
-## rtx
-
-
-Adds integration with [rtx](https://github.com/jdx/rtx), a runtime executor compatible with npm, nodenv, pyenv, etc. rtx is written in rust and is very fast. 20x-200x faster than asdf. With that being said, rtx is compatible with asdf plugins and .tool-versions files. It can be used as a drop-in replacement.
-
-### Installation
-
-1. [Download & install rtx](https://github.com/jdx/rtx#installation) by running the following:
-
- ```
- curl https://rtx.pub/install.sh | sh
- ```
-
-
-2. [Enable rtx](https://github.com/jdx/rtx#quickstart) by adding it to your `plugins` definition in `~/.zshrc`.
-
- ```
- plugins=(rtx)
- ```
-
-### Usage
-
-See the [rtx readme](https://github.com/jdx/rtx#table-of-contents) for information on how to use rtx. Here are a few examples:
-
-```
-rtx install node Install the current version specified in .tool-versions/.rtx.toml
-rtx use -g node@system Use system node as global default
-rtx install node@20.0.0 Install a specific version number
-rtx use -g node@20 Use node-20.x as global default
-```
diff --git a/plugins/rtx/rtx.plugin.zsh b/plugins/rtx/rtx.plugin.zsh
deleted file mode 100644
index a01828afd..000000000
--- a/plugins/rtx/rtx.plugin.zsh
+++ /dev/null
@@ -1,18 +0,0 @@
-# rtx needs to be in $PATH
-if (( ! ${+commands[rtx]} )); then
- return
-fi
-
-# Load rtx hooks
-eval "$(rtx activate zsh)"
-
-# If the completion file doesn't exist yet, we need to autoload it and
-# bind it to `rtx`. Otherwise, compinit will have already done that.
-if [[ ! -f "$ZSH_CACHE_DIR/completions/_rtx" ]]; then
- typeset -g -A _comps
- autoload -Uz _rtx
- _comps[rtx]=_rtx
-fi
-
-# Generate and load rtx completion
-rtx completion zsh >! "$ZSH_CACHE_DIR/completions/_rtx" &|
diff --git a/plugins/rust/rust.plugin.zsh b/plugins/rust/rust.plugin.zsh
index 858f14126..567cebc64 100644
--- a/plugins/rust/rust.plugin.zsh
+++ b/plugins/rust/rust.plugin.zsh
@@ -22,5 +22,5 @@ fi
rustup completions zsh >| "$ZSH_CACHE_DIR/completions/_rustup" &|
cat >| "$ZSH_CACHE_DIR/completions/_cargo" <<'EOF'
#compdef cargo
-source "$(rustc +${${(z)$(rustup default)}[1]} --print sysroot)"/share/zsh/site-functions/_cargo
+source "$(rustup run ${${(z)$(rustup default)}[1]} rustc --print sysroot)"/share/zsh/site-functions/_cargo
EOF
diff --git a/plugins/safe-paste/safe-paste.plugin.zsh b/plugins/safe-paste/safe-paste.plugin.zsh
index d443ae8a2..c7079059b 100644
--- a/plugins/safe-paste/safe-paste.plugin.zsh
+++ b/plugins/safe-paste/safe-paste.plugin.zsh
@@ -9,7 +9,8 @@
# https://github.com/zsh-users/zsh/blob/f702e17b14d75aa21bff014168fa9048124db286/Functions/Zle/bracketed-paste-magic#L9-L12
# Load bracketed-paste-magic if zsh version is >= 5.1
-if [[ ${ZSH_VERSION:0:3} -ge 5.1 ]]; then
+autoload -Uz is-at-least
+if is-at-least 5.1; then
set zle_bracketed_paste # Explicitly restore this zsh default
autoload -Uz bracketed-paste-magic
zle -N bracketed-paste bracketed-paste-magic
diff --git a/plugins/sbt/sbt.plugin.zsh b/plugins/sbt/sbt.plugin.zsh
index 851302c68..1e977140b 100644
--- a/plugins/sbt/sbt.plugin.zsh
+++ b/plugins/sbt/sbt.plugin.zsh
@@ -4,7 +4,7 @@
# AUTHOR: Mirko Caserta (mirko.caserta@gmail.com)
# VERSION: 1.0.2
# ------------------------------------------------------------------------------
-
+
# aliases - mnemonic: prefix is 'sb'
alias sbc='sbt compile'
alias sbcc='sbt clean compile'
diff --git a/plugins/scd/scd b/plugins/scd/scd
index 7e9654b44..c79de4538 100755
--- a/plugins/scd/scd
+++ b/plugins/scd/scd
@@ -445,7 +445,7 @@ _scd_Y19oug_match() {
# build a list of matching directories reverse-sorted by their probabilities
dmatching=( ${(f)"$(
builtin printf "%s %s\n" ${(Oakv)drank} |
- /usr/bin/sort -grk1 )"}
+ command sort -grk1 )"}
)
dmatching=( ${dmatching#*[[:blank:]]} )
diff --git a/plugins/screen/screen.plugin.zsh b/plugins/screen/screen.plugin.zsh
index c1db8ad92..375d8750a 100644
--- a/plugins/screen/screen.plugin.zsh
+++ b/plugins/screen/screen.plugin.zsh
@@ -1,6 +1,10 @@
# if using GNU screen, let the zsh tell screen what the title and hardstatus
# of the tab window should be.
if [[ "$TERM" == screen* ]]; then
+ # Unset title() function defined in lib/termsupport.zsh to prevent
+ # overwriting our screen titles
+ title(){}
+
if [[ $_GET_PATH == '' ]]; then
_GET_PATH='echo $PWD | sed "s/^\/Users\//~/;s/^\/home\//~/;s/^~$USERNAME/~/"'
fi
@@ -8,7 +12,7 @@ if [[ "$TERM" == screen* ]]; then
_GET_HOST='echo $HOST | sed "s/\..*//"'
fi
- # use the current user as the prefix of the current tab title
+ # use the current user as the prefix of the current tab title
TAB_TITLE_PREFIX='"`'$_GET_HOST'`:`'$_GET_PATH' | sed "s:..*/::"`$PROMPT_CHAR"'
# when at the shell prompt, show a truncated version of the current path (with
# standard ~ replacement) as the rest of the title.
diff --git a/plugins/scw/README.md b/plugins/scw/README.md
index d2312c2e5..5dd630d64 100644
--- a/plugins/scw/README.md
+++ b/plugins/scw/README.md
@@ -1,7 +1,9 @@
-## Scaleway CLI autocomplete plugin
+## Scaleway CLI plugin
-[scw](https://github.com/scaleway/scaleway-cli): Manage Bare Metal servers from Command Line (as easily as with Docker)
+This plugin adds completion for [scw](https://github.com/scaleway/scaleway-cli), the command line interface for Scaleway.
-- Adds autocomplete options for all `scw` commands.
+To use it, add `scw` to the plugins array in your zshrc file:
-Maintainer : Manfred Touron ([@moul](https://github.com/moul))
+```zsh
+plugins=(... scw)
+```
diff --git a/plugins/scw/_scw b/plugins/scw/_scw
deleted file mode 100644
index 0eb125c65..000000000
--- a/plugins/scw/_scw
+++ /dev/null
@@ -1,333 +0,0 @@
-#compdef scw
-#
-# zsh completion for scw (https://www.scaleway.com)
-#
-# Inspired by https://github.com/felixr/docker-zsh-completion
-
-__scw_get_servers() {
- local expl
- declare -a servers
- servers=(${(f)"$(_call_program commands scw _completion servers-names)"})
- _describe -t servers "servers" servers
-}
-
-__scw_stoppedservers() {
- __scw_get_servers
-}
-
-__scw_runningservers() {
- __scw_get_servers
-}
-
-__scw_servers () {
- __scw_get_servers
-}
-
-__scw_images () {
- local expl
- declare -a images
- images=(${(f)"$(_call_program commands scw _completion images-names)"})
- _describe -t images "images" images
-}
-
-__scw_images_and_snapshots () {
- __scw_images
- __scw_snapshots
-}
-
-__scw_snapshots () {
- local expl
- declare -a snapshots
- snapshots=(${(f)"$(_call_program commands scw _completion --prefix snapshots-names)"})
- _describe -t snapshots "snapshots" snapshots
-}
-
-__scw_bootscripts () {
- local expl
- declare -a bootscripts
- bootscripts=(${(f)"$(_call_program commands scw _completion bootscripts-names)"})
- _describe -t bootscripts "bootscripts" bootscripts
-}
-
-__scw_tags() {
- __scw_images
-}
-
-__scw_repositories_with_tags() {
- __scw_images
-}
-
-__scw_search() {
- # declare -a scwsearch
- local cache_policy
- zstyle -s ":completion:${curcontext}:" cache-policy cache_policy
- if [[ -z "$cache_policy" ]]; then
- zstyle ":completion:${curcontext}:" cache-policy __scw_caching_policy
- fi
-
- local searchterm cachename
- searchterm="${words[$CURRENT]%/}"
- cachename=_scw-search-$searchterm
-
- local expl
- local -a result
- if ( [[ ${(P)+cachename} -eq 0 ]] || _cache_invalid ${cachename#_} ) \
- && ! _retrieve_cache ${cachename#_}; then
- _message "Searching for ${searchterm}..."
- result=(${${${(f)"$(_call_program commands scw search ${searchterm})"}%% *}[2,-1]})
- _store_cache ${cachename#_} result
- fi
- _wanted scwsearch expl 'available images' compadd -a result
-}
-
-__scw_caching_policy()
-{
- oldp=( "$1"(Nmh+1) ) # 1 hour
- (( $#oldp ))
-}
-
-
-__scw_repositories () {
- __scw_images
-}
-
-__scw_commands () {
- # local -a _scw_subcommands
- local cache_policy
-
- zstyle -s ":completion:${curcontext}:" cache-policy cache_policy
- if [[ -z "$cache_policy" ]]; then
- zstyle ":completion:${curcontext}:" cache-policy __scw_caching_policy
- fi
-
- if ( [[ ${+_scw_subcommands} -eq 0 ]] || _cache_invalid scw_subcommands) \
- && ! _retrieve_cache scw_subcommands;
- then
- local -a lines
- lines=(${(f)"$(_call_program commands scw 2>&1)"})
- _scw_subcommands=(${${${lines[$((${lines[(i)Commands:]} + 1)),${lines[(I) *]}]}## #}/ ##/:})
- _scw_subcommands=($_scw_subcommands 'help:Show help for a command')
- _store_cache scw_subcommands _scw_subcommands
- fi
- _describe -t scw-commands "scw command" _scw_subcommands
-}
-
-__scw_subcommand () {
- local -a _command_args
- case "$words[1]" in
- (attach)
- _arguments \
- '--no-stdin[Do not attach stdin]' \
- ':servers:__scw_runningservers'
- ;;
- (commit)
- _arguments \
- {-v,--volume=0}'[Volume slot]:volume: ' \
- ':server:__scw_servers' \
- ':repository:__scw_repositories_with_tags'
- ;;
- (cp)
- _arguments \
- ':server:->server' \
- ':hostpath:_files'
- case $state in
- (server)
- if compset -P '*:'; then
- _files
- else
- __scw_servers -qS ":"
- fi
- ;;
- esac
- ;;
- (exec)
- local state ret
- _arguments \
- {-T,--timeout=0}'[Set timeout values to seconds]' \
- {-w,--wait}'[Wait for SSH to be ready]' \
- ':servers:__scw_runningservers' \
- '*::command:->anycommand' && ret=0
-
- case $state in
- (anycommand)
- shift 1 words
- (( CURRENT-- ))
- _normal
- ;;
- esac
-
- return ret
- ;;
- (history)
- _arguments \
- '--no-trunc[Do not truncate output]' \
- {-q,--quiet}'[Only show numeric IDs]' \
- '*:images:__scw_images'
- ;;
- (images)
- _arguments \
- {-a,--all}'[Show all images]' \
- '--no-trunc[Do not truncate output]' \
- {-q,--quiet}'[Only show numeric IDs]' \
- ':repository:__scw_repositories'
- ;;
- (info)
- ;;
- (inspect)
- _arguments \
- {-f,--format=-}'[Format the output using the given go template]:template: ' \
- '*:servers:__scw_servers'
- ;;
- (kill)
- _arguments \
- '*:servers:__scw_runningservers'
- ;;
- (login)
- _arguments \
- {-o,--organization=-}'[Organization]:organization: ' \
- {-t,--token=-}'[Token]:token: ' \
- ':server: '
- ;;
- (logout)
- _arguments \
- ':server: '
- ;;
- (logs)
- _arguments \
- '*:servers:__scw_servers'
- ;;
- (port)
- _arguments \
- '1:servers:__scw_runningservers' \
- '2:port:_ports'
- ;;
- (start)
- _arguments \
- {-T,--timeout=0}'[Set timeout values to seconds]' \
- {-w,--wait}'[Wait for SSH to be ready]' \
- '*:servers:__scw_stoppedservers'
- ;;
- (rm)
- _arguments \
- '*:servers:__scw_stoppedservers'
- ;;
- (rmi)
- _arguments \
- '*:images:__scw_images'
- ;;
- (restart)
- _arguments \
- '*:servers:__scw_runningservers'
- ;;
- (stop)
- _arguments \
- {-t,--terminate}'[Stop and trash a server with its volumes]' \
- {-w,--wait}'[Synchronous stop. Wait for server to be stopped]' \
- '*:servers:__scw_runningservers'
- ;;
- (top)
- _arguments \
- '1:servers:__scw_runningservers' \
- '(-)*:: :->ps-arguments'
- case $state in
- (ps-arguments)
- _ps
- ;;
- esac
- ;;
- (ps)
- _arguments \
- {-a,--all}'[Show all servers. Only running servers are shown by default]' \
- {-l,--latest}'[Show only the latest created server]' \
- '-n[Show n last created servers, include non-running one]:n:(1 5 10 25 50)' \
- '--no-trunc[Do not truncate output]' \
- {-q,--quiet}'[Only show numeric IDs]'
- ;;
- (tag)
- _arguments \
- {-f,--force}'[force]'\
- ':image:__scw_images'\
- ':repository:__scw_repositories_with_tags'
- ;;
- (create|run)
- _arguments \
- {-a,--attach}'[Attach to stdin, stdout or stderr]' \
- '*'{-e,--environment=-}'[Set environment variables]:environment variable: ' \
- '--name=-[Server name]:name: ' \
- '--bootscript=-[Assign a bootscript]:bootscript:__scw_bootscripts ' \
- '*-v[Bind mount a volume]:volume: '\
- '(-):images:__scw_images_and_snapshots' \
- '(-):command: _command_names -e' \
- '*::arguments: _normal'
-
- case $state in
- (link)
- if compset -P '*:'; then
- _wanted alias expl 'Alias' compadd -E ""
- else
- __scw_runningservers -qS ":"
- fi
- ;;
- esac
- ;;
- (rename)
- _arguments \
- ':old name:__scw_servers' \
- ':new name: '
- ;;
- (search)
- _arguments \
- '--no-trunc[Do not truncate output]' \
- ':term: '
- ;;
- (wait)
- _arguments '*:servers:__scw_runningservers'
- ;;
- (help)
- _arguments ':subcommand:__scw_commands'
- ;;
- (*)
- _message 'Unknown sub command'
- esac
-
-}
-
-_scw () {
- # Support for subservices, which allows for `compdef _scw scw-shell=_scw_servers`.
- # Based on /usr/share/zsh/functions/Completion/Unix/_git without support for `ret`.
- if [[ $service != scw ]]; then
- _call_function - _$service
- return
- fi
-
- local curcontext="$curcontext" state line
- typeset -A opt_args
-
- _arguments -C \
- '-H[tcp://host:port to bind/connect to]:socket: ' \
- '(-): :->command' \
- '(-)*:: :->option-or-argument'
-
- if (( CURRENT == 1 )); then
-
- fi
- case $state in
- (command)
- __scw_commands
- ;;
- (option-or-argument)
- curcontext=${curcontext%:*:*}:scw-$words[1]:
- __scw_subcommand
- ;;
- esac
-}
-
-_scw "$@"
-
-# Local Variables:
-# mode: Shell-Script
-# sh-indentation: 4
-# indent-tabs-mode: nil
-# sh-basic-offset: 4
-# End:
-# vim: ft=zsh sw=4 ts=4 et
diff --git a/plugins/scw/scw.plugin.zsh b/plugins/scw/scw.plugin.zsh
new file mode 100644
index 000000000..cd8ed4ac7
--- /dev/null
+++ b/plugins/scw/scw.plugin.zsh
@@ -0,0 +1,14 @@
+if (( ! $+commands[scw] )); then
+ return
+fi
+
+_scw () {
+ output=($(scw autocomplete complete zsh -- ${CURRENT} ${words}))
+ opts=('-S' ' ')
+ if [[ $output == *= ]]; then
+ opts=('-S' '')
+ fi
+ compadd "${opts[@]}" -- "${output[@]}"
+}
+
+compdef _scw scw
diff --git a/plugins/shell-proxy/ssh-proxy.py b/plugins/shell-proxy/ssh-proxy.py
index a498c84bc..4b692f9e4 100755
--- a/plugins/shell-proxy/ssh-proxy.py
+++ b/plugins/shell-proxy/ssh-proxy.py
@@ -22,7 +22,8 @@ if parsed.scheme not in proxy_protocols:
def make_argv():
yield "nc"
- if sys.platform == 'linux':
+ if sys.platform in {'linux', 'cygwin'}:
+ # caveats: the built-in netcat of most linux distributions and cygwin support proxy type
# caveats: macOS built-in netcat command not supported proxy-type
yield "-X" # --proxy-type
# Supported protocols are 4 (SOCKS v4), 5 (SOCKS v5) and connect (HTTP proxy).
diff --git a/plugins/shrink-path/shrink-path.plugin.zsh b/plugins/shrink-path/shrink-path.plugin.zsh
index 373fd5b05..1739f9234 100644
--- a/plugins/shrink-path/shrink-path.plugin.zsh
+++ b/plugins/shrink-path/shrink-path.plugin.zsh
@@ -56,7 +56,16 @@ shrink_path () {
tilde=1
named=1
fi
- zstyle -t ':prompt:shrink_path' last && lastfull=1
+
+ local last
+ zstyle -s ':prompt:shrink_path' last last
+ case "$last" in
+ (false|no|off|0) lastfull=0 ;;
+ (true|yes|on|1) lastfull=1 ;;
+ (""|*[^0-9]*) lastfull=0 ;;
+ (*) lastfull=$last ;;
+ esac
+
zstyle -t ':prompt:shrink_path' short && short=1
zstyle -t ':prompt:shrink_path' tilde && tilde=1
zstyle -t ':prompt:shrink_path' glob && ellipsis='*'
@@ -78,7 +87,7 @@ shrink_path () {
print 'Usage: shrink_path [-f -l -s -t] [directory]'
print ' -f, --fish fish-simulation, like -l -s -t'
print ' -g, --glob Add asterisk to allow globbing of shrunk path (equivalent to -e "*")'
- print ' -l, --last Print the last directory''s full name'
+ print ' -l, --last [#] Print the last n directory''s full name (default 1).'
print ' -s, --short Truncate directory names to the number of characters given by -#. Without'
print ' -s, names are truncated without making them ambiguous.'
print ' -t, --tilde Substitute ~ for the home directory'
@@ -93,7 +102,13 @@ shrink_path () {
print ' zstyle :prompt:shrink_path fish yes'
return 0
;;
- -l|--last) lastfull=1 ;;
+ -l|--last)
+ lastfull=1
+ if [[ -n "$2" && "$2" != *[^0-9]* ]]; then
+ shift
+ lastfull=$1
+ fi
+ ;;
-s|--short) short=1 ;;
-t|--tilde) tilde=1 ;;
-T|--nameddirs)
@@ -148,8 +163,8 @@ shrink_path () {
cd -q /
}
for dir in $tree; {
- if (( lastfull && $#tree == 1 )) {
- result+="/$tree"
+ if (( lastfull && $#tree <= lastfull )) {
+ result+="/${(j:/:)tree[@]}"
break
}
expn=(a b)
diff --git a/plugins/singlechar/singlechar.plugin.zsh b/plugins/singlechar/singlechar.plugin.zsh
index d4b0b6735..6d785d9e1 100644
--- a/plugins/singlechar/singlechar.plugin.zsh
+++ b/plugins/singlechar/singlechar.plugin.zsh
@@ -1,5 +1,5 @@
###########################
-# Settings
+# Settings
# These can be overwritten any time.
# If they are not set yet, they will be
diff --git a/plugins/spackenv/README.md b/plugins/spackenv/README.md
new file mode 100644
index 000000000..371515839
--- /dev/null
+++ b/plugins/spackenv/README.md
@@ -0,0 +1,17 @@
+# spackenv
+
+Based on the virtualenv plugin.
+
+The plugin displays information of the created Spack environment and allows background theming.
+
+To use it, add `spackenv` to the plugins array of your zshrc file:
+```
+plugins=(... spackenv)
+```
+
+The plugin creates a `spackenv_prompt_info` function that you can use in your theme, which displays
+the basename of the current `$SPACK_ENV`. It uses two variables to control how that is shown:
+
+- `ZSH_THEME_SPACKENV_PREFIX`: sets the prefix of the SPACK_ENV. Defaults to `[`.
+
+- `ZSH_THEME_SPACKENV_SUFFIX`: sets the suffix of the SPACK_ENV. Defaults to `]`.
diff --git a/plugins/spackenv/spackenv.plugin.zsh b/plugins/spackenv/spackenv.plugin.zsh
new file mode 100644
index 000000000..f626f4fc6
--- /dev/null
+++ b/plugins/spackenv/spackenv.plugin.zsh
@@ -0,0 +1,5 @@
+function spackenv_prompt_info(){
+ [[ -n ${SPACK_ENV} ]] || return
+ export SPACK_ENV_PROMPT=${SPACK_ENV:t}
+ echo "${ZSH_THEME_SPACKENV_PREFIX=(}${SPACK_ENV:t:gs/%/%%}${ZSH_THEME_SPACKENV_SUFFIX=)}"
+}
diff --git a/plugins/spring/README.md b/plugins/spring/README.md
index 816181326..b93402000 100644
--- a/plugins/spring/README.md
+++ b/plugins/spring/README.md
@@ -1,16 +1,12 @@
# Spring Boot oh-my-zsh plugin
-oh-my-zsh Spring Boot plugin
-## Spring Boot autocomplete plugin
+Adds autocomplete options for all [Spring Boot](https://spring.io/projects/spring-boot) commands.
-- Adds autocomplete options for all spring boot commands.
+To use it, add `spring` to the plugins array in your zshrc file:
-## Manual Install
-
- $ cd ~/.oh-my-zsh/plugins
- $ git clone git@github.com:linux-china/oh-my-zsh-spring-boot-plugin.git spring
-
-Adjust your .zshrc file and add spring to plugins=(...)
+```zsh
+plugins=(... spring)
+```
## Tips
diff --git a/plugins/ssh-agent/README.md b/plugins/ssh-agent/README.md
index 8c118e65b..0afa80cc8 100644
--- a/plugins/ssh-agent/README.md
+++ b/plugins/ssh-agent/README.md
@@ -90,7 +90,7 @@ use the `ssh-add-args` setting. You can pass multiple arguments separated by spa
zstyle :omz:plugins:ssh-agent ssh-add-args -K -c -a /run/user/1000/ssh-auth
```
-These will then be passed the the `ssh-add` call as if written directly. The example
+These will then be passed the `ssh-add` call as if written directly. The example
above will turn into:
```zsh
diff --git a/plugins/ssh-agent/ssh-agent.plugin.zsh b/plugins/ssh-agent/ssh-agent.plugin.zsh
index 49ad95a11..83548648b 100644
--- a/plugins/ssh-agent/ssh-agent.plugin.zsh
+++ b/plugins/ssh-agent/ssh-agent.plugin.zsh
@@ -43,7 +43,7 @@ function _add_identities() {
# this is to mimic the call to ssh-add with no identities
if [[ ${#identities} -eq 0 ]]; then
# key list found on `ssh-add` man page's DESCRIPTION section
- for id in id_rsa id_dsa id_ecdsa id_ed25519 identity; do
+ for id in id_rsa id_dsa id_ecdsa id_ed25519 id_ed25519_sk identity; do
# check if file exists
[[ -f "$HOME/.ssh/$id" ]] && identities+=($id)
done
@@ -62,7 +62,7 @@ function _add_identities() {
# if id is an absolute path, make file equal to id
[[ "$id" = /* ]] && file="$id" || file="$HOME/.ssh/$id"
# check for filename match, otherwise try for signature match
- if [[ ${loaded_ids[(I)$file]} -le 0 ]]; then
+ if [[ -f $file && ${loaded_ids[(I)$file]} -le 0 ]]; then
sig="$(ssh-keygen -lf "$file" | awk '{print $2}')"
[[ ${loaded_sigs[(I)$sig]} -le 0 ]] && not_loaded+=("$file")
fi
@@ -98,8 +98,14 @@ function _add_identities() {
# Add a nifty symlink for screen/tmux if agent forwarding is enabled
if zstyle -t :omz:plugins:ssh-agent agent-forwarding \
- && [[ -n "$SSH_AUTH_SOCK" && ! -L "$SSH_AUTH_SOCK" ]]; then
- ln -sf "$SSH_AUTH_SOCK" /tmp/ssh-agent-$USERNAME-screen
+ && [[ -n "$SSH_AUTH_SOCK" ]]; then
+ if [[ ! -L "$SSH_AUTH_SOCK" ]]; then
+ if [[ -n "$TERMUX_VERSION" ]]; then
+ ln -sf "$SSH_AUTH_SOCK" "$PREFIX"/tmp/ssh-agent-$USERNAME-screen
+ else
+ ln -sf "$SSH_AUTH_SOCK" /tmp/ssh-agent-$USERNAME-screen
+ fi
+ fi
else
_start_agent
fi
diff --git a/plugins/ssh/README.md b/plugins/ssh/README.md
new file mode 100644
index 000000000..3dd32ec76
--- /dev/null
+++ b/plugins/ssh/README.md
@@ -0,0 +1,16 @@
+# ssh plugin
+
+This plugin provides host completion based off of your `~/.ssh/config` file, and adds
+some utility functions to work with SSH keys.
+
+To use it, add `ssh` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... ssh)
+```
+
+## Functions
+
+- `ssh_rmhkey`: remove host key from known hosts based on a host section name from `.ssh/config`.
+- `ssh_load_key`: load SSH key into agent.
+- `ssh_unload_key`: remove SSH key from agent.
diff --git a/plugins/ssh/ssh.plugin.zsh b/plugins/ssh/ssh.plugin.zsh
new file mode 100644
index 000000000..24ad88028
--- /dev/null
+++ b/plugins/ssh/ssh.plugin.zsh
@@ -0,0 +1,53 @@
+############################################################
+# Take all host sections in .ssh/config and offer them for
+# completion as hosts (e.g. for ssh, rsync, scp and the like)
+# Filter out wildcard host sections.
+_ssh_configfile="$HOME/.ssh/config"
+if [[ -f "$_ssh_configfile" ]]; then
+ _ssh_hosts=($(
+ grep -E '^Host.*' "$_ssh_configfile" |\
+ awk '{for (i=2; i<=NF; i++) print $i}' |\
+ sort |\
+ uniq |\
+ grep -v '^*' |\
+ sed -e 's/\.*\*$//'
+ ))
+ zstyle ':completion:*:hosts' hosts $_ssh_hosts
+ unset _ssh_hosts
+fi
+unset _ssh_configfile
+
+############################################################
+# Remove host key from known hosts based on a host section
+# name from .ssh/config
+function ssh_rmhkey {
+ local ssh_configfile="$HOME/.ssh/config"
+ local ssh_host="$1"
+ if [[ -z "$ssh_host" ]]; then return; fi
+ ssh-keygen -R $(grep -A10 "$ssh_host" "$ssh_configfile" | grep -i HostName | head -n 1 | awk '{print $2}')
+}
+compctl -k hosts ssh_rmhkey
+
+############################################################
+# Load SSH key into agent
+function ssh_load_key() {
+ local key="$1"
+ if [[ -z "$key" ]]; then return; fi
+ local keyfile="$HOME/.ssh/$key"
+ local keysig=$(ssh-keygen -l -f "$keyfile")
+ if ( ! ssh-add -l | grep -q "$keysig" ); then
+ ssh-add "$keyfile"
+ fi
+}
+
+############################################################
+# Remove SSH key from agent
+function ssh_unload_key {
+ local key="$1"
+ if [[ -z "$key" ]]; then return; fi
+ local keyfile="$HOME/.ssh/$key"
+ local keysig=$(ssh-keygen -l -f "$keyfile")
+ if ( ssh-add -l | grep -q "$keysig" ); then
+ ssh-add -d "$keyfile"
+ fi
+}
diff --git a/plugins/starship/starship.plugin.zsh b/plugins/starship/starship.plugin.zsh
index 8c5d9135e..fc415e64c 100644
--- a/plugins/starship/starship.plugin.zsh
+++ b/plugins/starship/starship.plugin.zsh
@@ -1,7 +1,7 @@
-# ignore oh-my-zsh theme
-unset ZSH_THEME
-
if (( $+commands[starship] )); then
+ # ignore oh-my-zsh theme
+ unset ZSH_THEME
+
eval "$(starship init zsh)"
else
echo '[oh-my-zsh] starship not found, please install it from https://starship.rs'
diff --git a/plugins/stripe/README.md b/plugins/stripe/README.md
new file mode 100644
index 000000000..7e7944d63
--- /dev/null
+++ b/plugins/stripe/README.md
@@ -0,0 +1,9 @@
+# Stripe
+
+This plugin provides completion for the [Stripe CLI](https://stripe.com/docs/stripe-cli).
+
+To use it add stripe to the plugins array in your zshrc file.
+
+```bash
+plugins=(... stripe)
+```
diff --git a/plugins/stripe/stripe.plugin.zsh b/plugins/stripe/stripe.plugin.zsh
new file mode 100644
index 000000000..e2041bef2
--- /dev/null
+++ b/plugins/stripe/stripe.plugin.zsh
@@ -0,0 +1,13 @@
+if (( ! $+commands[stripe] )); then
+ return
+fi
+
+# If the completion file doesn't exist yet, we need to autoload it and
+# bind it to `stripe`. Otherwise, compinit will have already done that.
+if [[ ! -f "$ZSH_CACHE_DIR/completions/_stripe" ]]; then
+ typeset -g -A _comps
+ autoload -Uz _stripe
+ _comps[stripe]=_stripe
+fi
+
+stripe completion --shell zsh --write-to-stdout >| "$ZSH_CACHE_DIR/completions/_stripe" &|
diff --git a/plugins/sublime/sublime.plugin.zsh b/plugins/sublime/sublime.plugin.zsh
index dadf37574..cc84de737 100644
--- a/plugins/sublime/sublime.plugin.zsh
+++ b/plugins/sublime/sublime.plugin.zsh
@@ -4,7 +4,7 @@ alias st=subl
alias stt='subl .'
# Define sst only if sudo exists
-(( $+commands[sudo] )) && alias sst='sudo subl'
+(( $+commands[sudo] )) && alias sst='sudo -EH subl'
alias stp=find_project
alias stn=create_project
@@ -62,7 +62,7 @@ alias stn=create_project
for _sublime_path in $_sublime_paths; do
if [[ -a $_sublime_path ]]; then
alias subl="'$_sublime_path'"
- (( $+commands[sudo] )) && alias sst="sudo '$_sublime_path'"
+ (( $+commands[sudo] )) && alias sst="sudo -EH '$_sublime_path'"
break
fi
done
diff --git a/plugins/suse/README.md b/plugins/suse/README.md
index f37ec1695..e1e3aad29 100644
--- a/plugins/suse/README.md
+++ b/plugins/suse/README.md
@@ -1,8 +1,6 @@
# suse
-**Maintainer**: [r-darwish](https://github.com/r-darwish)
-
-Alias for Zypper according to the official Zypper's alias
+Aliases for [Zypper](https://en.opensuse.org/Portal:Zypper) according to the official Zypper's alias
To use it add `suse` to the plugins array in you zshrc file.
@@ -10,6 +8,8 @@ To use it add `suse` to the plugins array in you zshrc file.
plugins=(... suse)
```
+**Maintainer**: [r-darwish](https://github.com/r-darwish)
+
## Main commands
| Alias | Commands | Description |
@@ -79,6 +79,7 @@ Related: [#9798](https://github.com/ohmyzsh/ohmyzsh/pull/9798).
| zrr | `sudo zypper rr` | remove repositories |
## Services commands
+
| Alias | Commands | Description |
| ----- | ------------------ | -------------------------------------------------------------- |
| zas | `sudo zypper as` | adds a service specified by URI to the system |
@@ -88,6 +89,7 @@ Related: [#9798](https://github.com/ohmyzsh/ohmyzsh/pull/9798).
| zls | `zypper ls` | list services defined on the system |
## Package Locks Management commands
+
| Alias | Commands | Description |
| ----- | ---------------- | ----------------------------------- |
| zal | `sudo zypper al` | add a package lock |
diff --git a/plugins/swiftpm/README.md b/plugins/swiftpm/README.md
index 223a607c1..babbf4d66 100644
--- a/plugins/swiftpm/README.md
+++ b/plugins/swiftpm/README.md
@@ -1,8 +1,6 @@
# Swift Package Manager
-## 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), as well as autocompletion for Swift 5.7.
+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.9.
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 51c9fffa0..358d1dcae 100644
--- a/plugins/swiftpm/_swift
+++ b/plugins/swiftpm/_swift
@@ -57,6 +57,8 @@ _swift_run() {
'--config-path[Specify the shared configuration directory path]:config-path:_files -/'
'--security-path[Specify the shared security directory path]:security-path:_files -/'
'--scratch-path[Specify a custom scratch directory path (default .build)]:scratch-path:_files -/'
+ '--pkg-config-path[Specify alternative path to search for pkg-config `.pc` files. Use the option multiple times to
+ specify more than one path.]:pkg-config-path:_files -/'
'--enable-dependency-cache[Use a shared cache when fetching dependencies]'
'--disable-dependency-cache[Use a shared cache when fetching dependencies]'
'--enable-build-manifest-caching'
@@ -64,13 +66,18 @@ _swift_run() {
'--manifest-cache[Caching mode of Package.swift manifests (shared: shared cache, local: package'"'"'s build directory, none: disabled]:manifest-cache:'
'(--verbose -v)'{--verbose,-v}'[Increase verbosity to include informational output]'
'(--very-verbose --vv)'{--very-verbose,--vv}'[Increase verbosity to include debug output]'
+ '(--quiet -q)'{--quiet,-q}'[Decrease verbosity to only include error output.]'
'--disable-sandbox[Disable using the sandbox when executing subprocesses]'
- '--enable-netrc[Load credentials from a .netrc file]'
- '--disable-netrc[Load credentials from a .netrc file]'
- '--netrc-file[Specify the .netrc file path.]:netrc-file:_files'
+ '--netrc[Use netrc file even in cases where other credential stores are preferred]'
+ '--enable-netrc[Load credentials from a netrc file]'
+ '--disable-netrc[Load credentials from a netrc file]'
+ '--netrc-file[Specify the netrc file path]:netrc-file:_files'
'--enable-keychain[Search credentials in macOS keychain]'
'--disable-keychain[Search credentials in macOS keychain]'
'--resolver-fingerprint-checking:resolver-fingerprint-checking:'
+ '--resolver-signing-entity-checking:resolver-signing-entity-checking:'
+ '--enable-signature-validation[Validate signature of a signed package release downloaded from registry]'
+ '--disable-signature-validation[Validate signature of a signed package release downloaded from registry]'
'--enable-prefetching'
'--disable-prefetching'
'(--force-resolved-versions --disable-automatic-resolution --only-use-versions-from-resolved-file)'{--force-resolved-versions,--disable-automatic-resolution,--only-use-versions-from-resolved-file}'[Only use versions from the Package.resolved file and fail resolution if it is out-of-date]'
@@ -78,6 +85,7 @@ _swift_run() {
'--disable-scm-to-registry-transformation[disable source control to registry transformation]'
'--use-registry-identity-for-scm[look up source control dependencies in the registry and use their registry identity when possible to help deduplicate across the two origins]'
'--replace-scm-with-registry[look up source control dependencies in the registry and use the registry to retrieve them instead of source control when possible]'
+ '--default-registry-url[Default registry URL to use, instead of the registries.json configuration file]:default-registry-url:'
'(--configuration -c)'{--configuration,-c}'[Build with configuration]:configuration:(debug release)'
'-Xcc[Pass flag through to all C compiler invocations]:Xcc:'
'-Xswiftc[Pass flag through to all Swift compiler invocations]:Xswiftc:'
@@ -86,7 +94,7 @@ _swift_run() {
'--triple:triple:'
'--sdk:sdk:_files -/'
'--toolchain:toolchain:_files -/'
- '--sanitize[Turn on runtime checks for erroneous behavior, possible values: address, thread, undefined, scudo]:sanitize:'
+ '--sanitize[Turn on runtime checks for erroneous behavior, possible values: address, thread, undefined, scudo]:sanitize:(address thread undefined scudo)'
'--auto-index-store[Enable or disable indexing-while-building feature]'
'--enable-index-store[Enable or disable indexing-while-building feature]'
'--disable-index-store[Enable or disable indexing-while-building feature]'
@@ -94,8 +102,8 @@ _swift_run() {
'(--jobs -j)'{--jobs,-j}'[The number of jobs to spawn in parallel during the build process]:jobs:'
'--emit-swift-module-separately'
'--use-integrated-swift-driver'
+ '--explicit-target-dependency-import-check:explicit-target-dependency-import-check:'
'--experimental-explicit-module-build'
- '--print-manifest-job-graph[Write the command graph for the build manifest as a graphviz file]'
'--build-system:build-system:(native xcode)'
'--enable-dead-strip[Disable/enable dead code stripping by the linker]'
'--disable-dead-strip[Disable/enable dead code stripping by the linker]'
@@ -125,6 +133,8 @@ _swift_build() {
'--config-path[Specify the shared configuration directory path]:config-path:_files -/'
'--security-path[Specify the shared security directory path]:security-path:_files -/'
'--scratch-path[Specify a custom scratch directory path (default .build)]:scratch-path:_files -/'
+ '--pkg-config-path[Specify alternative path to search for pkg-config `.pc` files. Use the option multiple times to
+ specify more than one path.]:pkg-config-path:_files -/'
'--enable-dependency-cache[Use a shared cache when fetching dependencies]'
'--disable-dependency-cache[Use a shared cache when fetching dependencies]'
'--enable-build-manifest-caching'
@@ -132,13 +142,18 @@ _swift_build() {
'--manifest-cache[Caching mode of Package.swift manifests (shared: shared cache, local: package'"'"'s build directory, none: disabled]:manifest-cache:'
'(--verbose -v)'{--verbose,-v}'[Increase verbosity to include informational output]'
'(--very-verbose --vv)'{--very-verbose,--vv}'[Increase verbosity to include debug output]'
+ '(--quiet -q)'{--quiet,-q}'[Decrease verbosity to only include error output.]'
'--disable-sandbox[Disable using the sandbox when executing subprocesses]'
- '--enable-netrc[Load credentials from a .netrc file]'
- '--disable-netrc[Load credentials from a .netrc file]'
- '--netrc-file[Specify the .netrc file path.]:netrc-file:_files'
+ '--netrc[Use netrc file even in cases where other credential stores are preferred]'
+ '--enable-netrc[Load credentials from a netrc file]'
+ '--disable-netrc[Load credentials from a netrc file]'
+ '--netrc-file[Specify the netrc file path]:netrc-file:_files'
'--enable-keychain[Search credentials in macOS keychain]'
'--disable-keychain[Search credentials in macOS keychain]'
'--resolver-fingerprint-checking:resolver-fingerprint-checking:'
+ '--resolver-signing-entity-checking:resolver-signing-entity-checking:'
+ '--enable-signature-validation[Validate signature of a signed package release downloaded from registry]'
+ '--disable-signature-validation[Validate signature of a signed package release downloaded from registry]'
'--enable-prefetching'
'--disable-prefetching'
'(--force-resolved-versions --disable-automatic-resolution --only-use-versions-from-resolved-file)'{--force-resolved-versions,--disable-automatic-resolution,--only-use-versions-from-resolved-file}'[Only use versions from the Package.resolved file and fail resolution if it is out-of-date]'
@@ -146,6 +161,7 @@ _swift_build() {
'--disable-scm-to-registry-transformation[disable source control to registry transformation]'
'--use-registry-identity-for-scm[look up source control dependencies in the registry and use their registry identity when possible to help deduplicate across the two origins]'
'--replace-scm-with-registry[look up source control dependencies in the registry and use the registry to retrieve them instead of source control when possible]'
+ '--default-registry-url[Default registry URL to use, instead of the registries.json configuration file]:default-registry-url:'
'(--configuration -c)'{--configuration,-c}'[Build with configuration]:configuration:(debug release)'
'-Xcc[Pass flag through to all C compiler invocations]:Xcc:'
'-Xswiftc[Pass flag through to all Swift compiler invocations]:Xswiftc:'
@@ -154,7 +170,7 @@ _swift_build() {
'--triple:triple:'
'--sdk:sdk:_files -/'
'--toolchain:toolchain:_files -/'
- '--sanitize[Turn on runtime checks for erroneous behavior, possible values: address, thread, undefined, scudo]:sanitize:'
+ '--sanitize[Turn on runtime checks for erroneous behavior, possible values: address, thread, undefined, scudo]:sanitize:(address thread undefined scudo)'
'--auto-index-store[Enable or disable indexing-while-building feature]'
'--enable-index-store[Enable or disable indexing-while-building feature]'
'--disable-index-store[Enable or disable indexing-while-building feature]'
@@ -162,8 +178,8 @@ _swift_build() {
'(--jobs -j)'{--jobs,-j}'[The number of jobs to spawn in parallel during the build process]:jobs:'
'--emit-swift-module-separately'
'--use-integrated-swift-driver'
+ '--explicit-target-dependency-import-check:explicit-target-dependency-import-check:'
'--experimental-explicit-module-build'
- '--print-manifest-job-graph[Write the command graph for the build manifest as a graphviz file]'
'--build-system:build-system:(native xcode)'
'--enable-dead-strip[Disable/enable dead code stripping by the linker]'
'--disable-dead-strip[Disable/enable dead code stripping by the linker]'
@@ -171,6 +187,7 @@ _swift_build() {
'--no-static-swift-stdlib[Link Swift stdlib statically]'
'--build-tests[Build both source and test targets]'
'--show-bin-path[Print the binary output path]'
+ '--print-manifest-job-graph[Write the command graph for the build manifest as a graphviz file]'
'--target[Build the specified target]:target:'
'--product[Build the specified product]:product:'
'--version[Show the version.]'
@@ -190,6 +207,8 @@ _swift_test() {
'--config-path[Specify the shared configuration directory path]:config-path:_files -/'
'--security-path[Specify the shared security directory path]:security-path:_files -/'
'--scratch-path[Specify a custom scratch directory path (default .build)]:scratch-path:_files -/'
+ '--pkg-config-path[Specify alternative path to search for pkg-config `.pc` files. Use the option multiple times to
+ specify more than one path.]:pkg-config-path:_files -/'
'--enable-dependency-cache[Use a shared cache when fetching dependencies]'
'--disable-dependency-cache[Use a shared cache when fetching dependencies]'
'--enable-build-manifest-caching'
@@ -197,13 +216,18 @@ _swift_test() {
'--manifest-cache[Caching mode of Package.swift manifests (shared: shared cache, local: package'"'"'s build directory, none: disabled]:manifest-cache:'
'(--verbose -v)'{--verbose,-v}'[Increase verbosity to include informational output]'
'(--very-verbose --vv)'{--very-verbose,--vv}'[Increase verbosity to include debug output]'
+ '(--quiet -q)'{--quiet,-q}'[Decrease verbosity to only include error output.]'
'--disable-sandbox[Disable using the sandbox when executing subprocesses]'
- '--enable-netrc[Load credentials from a .netrc file]'
- '--disable-netrc[Load credentials from a .netrc file]'
- '--netrc-file[Specify the .netrc file path.]:netrc-file:_files'
+ '--netrc[Use netrc file even in cases where other credential stores are preferred]'
+ '--enable-netrc[Load credentials from a netrc file]'
+ '--disable-netrc[Load credentials from a netrc file]'
+ '--netrc-file[Specify the netrc file path]:netrc-file:_files'
'--enable-keychain[Search credentials in macOS keychain]'
'--disable-keychain[Search credentials in macOS keychain]'
'--resolver-fingerprint-checking:resolver-fingerprint-checking:'
+ '--resolver-signing-entity-checking:resolver-signing-entity-checking:'
+ '--enable-signature-validation[Validate signature of a signed package release downloaded from registry]'
+ '--disable-signature-validation[Validate signature of a signed package release downloaded from registry]'
'--enable-prefetching'
'--disable-prefetching'
'(--force-resolved-versions --disable-automatic-resolution --only-use-versions-from-resolved-file)'{--force-resolved-versions,--disable-automatic-resolution,--only-use-versions-from-resolved-file}'[Only use versions from the Package.resolved file and fail resolution if it is out-of-date]'
@@ -211,6 +235,7 @@ _swift_test() {
'--disable-scm-to-registry-transformation[disable source control to registry transformation]'
'--use-registry-identity-for-scm[look up source control dependencies in the registry and use their registry identity when possible to help deduplicate across the two origins]'
'--replace-scm-with-registry[look up source control dependencies in the registry and use the registry to retrieve them instead of source control when possible]'
+ '--default-registry-url[Default registry URL to use, instead of the registries.json configuration file]:default-registry-url:'
'(--configuration -c)'{--configuration,-c}'[Build with configuration]:configuration:(debug release)'
'-Xcc[Pass flag through to all C compiler invocations]:Xcc:'
'-Xswiftc[Pass flag through to all Swift compiler invocations]:Xswiftc:'
@@ -219,7 +244,7 @@ _swift_test() {
'--triple:triple:'
'--sdk:sdk:_files -/'
'--toolchain:toolchain:_files -/'
- '--sanitize[Turn on runtime checks for erroneous behavior, possible values: address, thread, undefined, scudo]:sanitize:'
+ '--sanitize[Turn on runtime checks for erroneous behavior, possible values: address, thread, undefined, scudo]:sanitize:(address thread undefined scudo)'
'--auto-index-store[Enable or disable indexing-while-building feature]'
'--enable-index-store[Enable or disable indexing-while-building feature]'
'--disable-index-store[Enable or disable indexing-while-building feature]'
@@ -227,29 +252,77 @@ _swift_test() {
'(--jobs -j)'{--jobs,-j}'[The number of jobs to spawn in parallel during the build process]:jobs:'
'--emit-swift-module-separately'
'--use-integrated-swift-driver'
+ '--explicit-target-dependency-import-check:explicit-target-dependency-import-check:'
'--experimental-explicit-module-build'
- '--print-manifest-job-graph[Write the command graph for the build manifest as a graphviz file]'
'--build-system:build-system:(native xcode)'
'--enable-dead-strip[Disable/enable dead code stripping by the linker]'
'--disable-dead-strip[Disable/enable dead code stripping by the linker]'
'--static-swift-stdlib[Link Swift stdlib statically]'
'--no-static-swift-stdlib[Link Swift stdlib statically]'
'--skip-build[Skip building the test target]'
+ '--test-product[Test the specified product.]:test-product:'
'--parallel[Run the tests in parallel.]'
'--num-workers[Number of tests to execute in parallel.]:num-workers:'
'(--list-tests -l)'{--list-tests,-l}'[Lists test methods in specifier format]'
- '--show-codecov-path[Print the path of the exported code coverage JSON file]'
+ '(--show-codecov-path --show-code-coverage-path --show-coverage-path)'{--show-codecov-path,--show-code-coverage-path,--show-coverage-path}'[Print the path of the exported code coverage JSON file]'
'(-s --specifier)'{-s,--specifier}':specifier:'
'--filter[Run test cases matching regular expression, Format: <test-target>.<test-case> or <test-target>.<test-case>/<test>]:filter:'
'--skip[Skip test cases matching regular expression, Example: --skip PerformanceTests]:skip:'
'--xunit-output[Path where the xUnit xml file should be generated.]:xunit-output:_files -/'
- '--test-product[Test the specified product.]:test-product:'
'--enable-testable-imports[Enable or disable testable imports. Enabled by default.]'
'--disable-testable-imports[Enable or disable testable imports. Enabled by default.]'
'--enable-code-coverage[Enable code coverage]'
'--disable-code-coverage[Enable code coverage]'
'--version[Show the version.]'
'(-help -h --help)'{-help,-h,--help}'[Show help information.]'
+ '(-): :->command'
+ '(-)*:: :->arg'
+ )
+ _arguments -w -s -S $args[@] && ret=0
+ case $state in
+ (command)
+ local subcommands
+ subcommands=(
+ 'list:Lists test methods in specifier format'
+ 'generate-linuxmain:Generate LinuxMain.swift (deprecated)'
+ )
+ _describe "subcommand" subcommands
+ ;;
+ (arg)
+ case ${words[1]} in
+ (list)
+ _swift_test_list
+ ;;
+ (generate-linuxmain)
+ _swift_test_generate-linuxmain
+ ;;
+ esac
+ ;;
+ esac
+
+ return ret
+}
+
+_swift_test_list() {
+ integer ret=1
+ local -a args
+ args+=(
+ '--skip-build[Skip building the test target]'
+ '--test-product[Test the specified product.]:test-product:'
+ '--version[Show the version.]'
+ '(-help -h --help)'{-help,-h,--help}'[Show help information.]'
+ )
+ _arguments -w -s -S $args[@] && ret=0
+
+ return ret
+}
+
+_swift_test_generate-linuxmain() {
+ integer ret=1
+ local -a args
+ args+=(
+ '--version[Show the version.]'
+ '(-help -h --help)'{-help,-h,--help}'[Show help information.]'
)
_arguments -w -s -S $args[@] && ret=0
@@ -265,6 +338,8 @@ _swift_package() {
'--config-path[Specify the shared configuration directory path]:config-path:_files -/'
'--security-path[Specify the shared security directory path]:security-path:_files -/'
'--scratch-path[Specify a custom scratch directory path (default .build)]:scratch-path:_files -/'
+ '--pkg-config-path[Specify alternative path to search for pkg-config `.pc` files. Use the option multiple times to
+ specify more than one path.]:pkg-config-path:_files -/'
'--enable-dependency-cache[Use a shared cache when fetching dependencies]'
'--disable-dependency-cache[Use a shared cache when fetching dependencies]'
'--enable-build-manifest-caching'
@@ -272,13 +347,18 @@ _swift_package() {
'--manifest-cache[Caching mode of Package.swift manifests (shared: shared cache, local: package'"'"'s build directory, none: disabled]:manifest-cache:'
'(--verbose -v)'{--verbose,-v}'[Increase verbosity to include informational output]'
'(--very-verbose --vv)'{--very-verbose,--vv}'[Increase verbosity to include debug output]'
+ '(--quiet -q)'{--quiet,-q}'[Decrease verbosity to only include error output.]'
'--disable-sandbox[Disable using the sandbox when executing subprocesses]'
- '--enable-netrc[Load credentials from a .netrc file]'
- '--disable-netrc[Load credentials from a .netrc file]'
- '--netrc-file[Specify the .netrc file path.]:netrc-file:_files'
+ '--netrc[Use netrc file even in cases where other credential stores are preferred]'
+ '--enable-netrc[Load credentials from a netrc file]'
+ '--disable-netrc[Load credentials from a netrc file]'
+ '--netrc-file[Specify the netrc file path]:netrc-file:_files'
'--enable-keychain[Search credentials in macOS keychain]'
'--disable-keychain[Search credentials in macOS keychain]'
'--resolver-fingerprint-checking:resolver-fingerprint-checking:'
+ '--resolver-signing-entity-checking:resolver-signing-entity-checking:'
+ '--enable-signature-validation[Validate signature of a signed package release downloaded from registry]'
+ '--disable-signature-validation[Validate signature of a signed package release downloaded from registry]'
'--enable-prefetching'
'--disable-prefetching'
'(--force-resolved-versions --disable-automatic-resolution --only-use-versions-from-resolved-file)'{--force-resolved-versions,--disable-automatic-resolution,--only-use-versions-from-resolved-file}'[Only use versions from the Package.resolved file and fail resolution if it is out-of-date]'
@@ -286,6 +366,7 @@ _swift_package() {
'--disable-scm-to-registry-transformation[disable source control to registry transformation]'
'--use-registry-identity-for-scm[look up source control dependencies in the registry and use their registry identity when possible to help deduplicate across the two origins]'
'--replace-scm-with-registry[look up source control dependencies in the registry and use the registry to retrieve them instead of source control when possible]'
+ '--default-registry-url[Default registry URL to use, instead of the registries.json configuration file]:default-registry-url:'
'(--configuration -c)'{--configuration,-c}'[Build with configuration]:configuration:(debug release)'
'-Xcc[Pass flag through to all C compiler invocations]:Xcc:'
'-Xswiftc[Pass flag through to all Swift compiler invocations]:Xswiftc:'
@@ -294,7 +375,7 @@ _swift_package() {
'--triple:triple:'
'--sdk:sdk:_files -/'
'--toolchain:toolchain:_files -/'
- '--sanitize[Turn on runtime checks for erroneous behavior, possible values: address, thread, undefined, scudo]:sanitize:'
+ '--sanitize[Turn on runtime checks for erroneous behavior, possible values: address, thread, undefined, scudo]:sanitize:(address thread undefined scudo)'
'--auto-index-store[Enable or disable indexing-while-building feature]'
'--enable-index-store[Enable or disable indexing-while-building feature]'
'--disable-index-store[Enable or disable indexing-while-building feature]'
@@ -302,8 +383,8 @@ _swift_package() {
'(--jobs -j)'{--jobs,-j}'[The number of jobs to spawn in parallel during the build process]:jobs:'
'--emit-swift-module-separately'
'--use-integrated-swift-driver'
+ '--explicit-target-dependency-import-check:explicit-target-dependency-import-check:'
'--experimental-explicit-module-build'
- '--print-manifest-job-graph[Write the command graph for the build manifest as a graphviz file]'
'--build-system:build-system:(native xcode)'
'--enable-dead-strip[Disable/enable dead code stripping by the linker]'
'--disable-dead-strip[Disable/enable dead code stripping by the linker]'
@@ -325,25 +406,19 @@ _swift_package() {
'update:Update package dependencies'
'describe:Describe the current package'
'init:Initialize a new package'
- '_format:'
'diagnose-api-breaking-changes:Diagnose API-breaking changes to Swift modules in a package'
- 'experimental-api-diff:Deprecated - use `swift package diagnose-api-breaking-changes` instead'
'dump-symbol-graph:Dump Symbol Graph'
- 'dump-pif:'
'dump-package:Print parsed Package.swift as JSON'
'edit:Put a package in editable mode'
'unedit:Remove a package from editable mode'
'config:Manipulate configuration of the package'
'resolve:Resolve package dependencies'
- 'fetch:'
'show-dependencies:Print the resolved dependency graph'
'tools-version:Manipulate tools version of the current package'
- 'generate-xcodeproj:Generates an Xcode project. This command will be deprecated soon.'
'compute-checksum:Compute the checksum for a binary artifact.'
'archive-source:Create a source archive for the package'
'completion-tool:Completion tool (for shell completions)'
'plugin:Invoke a command plugin or perform other actions on command plugins'
- 'default-command:'
)
_describe "subcommand" subcommands
;;
@@ -367,21 +442,12 @@ _swift_package() {
(init)
_swift_package_init
;;
- (_format)
- _swift_package__format
- ;;
(diagnose-api-breaking-changes)
_swift_package_diagnose-api-breaking-changes
;;
- (experimental-api-diff)
- _swift_package_experimental-api-diff
- ;;
(dump-symbol-graph)
_swift_package_dump-symbol-graph
;;
- (dump-pif)
- _swift_package_dump-pif
- ;;
(dump-package)
_swift_package_dump-package
;;
@@ -397,18 +463,12 @@ _swift_package() {
(resolve)
_swift_package_resolve
;;
- (fetch)
- _swift_package_fetch
- ;;
(show-dependencies)
_swift_package_show-dependencies
;;
(tools-version)
_swift_package_tools-version
;;
- (generate-xcodeproj)
- _swift_package_generate-xcodeproj
- ;;
(compute-checksum)
_swift_package_compute-checksum
;;
@@ -421,9 +481,6 @@ _swift_package() {
(plugin)
_swift_package_plugin
;;
- (default-command)
- _swift_package_default-command
- ;;
esac
;;
esac
@@ -498,7 +555,7 @@ _swift_package_init() {
integer ret=1
local -a args
args+=(
- '--type[Package type: empty | library | executable | system-module | manifest]:type:'
+ '--type[Package type:]:type:'
'--name[Provide custom package name]:name:'
'--version[Show the version.]'
'(-help -h --help)'{-help,-h,--help}'[Show help information.]'
@@ -508,19 +565,6 @@ _swift_package_init() {
return ret
}
-_swift_package__format() {
- integer ret=1
- local -a args
- args+=(
- ':swift-format-flags:'
- '--version[Show the version.]'
- '(-help -h --help)'{-help,-h,--help}'[Show help information.]'
- )
- _arguments -w -s -S $args[@] && ret=0
-
- return ret
-}
-
_swift_package_diagnose-api-breaking-changes() {
integer ret=1
local -a args
@@ -539,19 +583,6 @@ _swift_package_diagnose-api-breaking-changes() {
return ret
}
-_swift_package_experimental-api-diff() {
- integer ret=1
- local -a args
- args+=(
- ':args:'
- '--version[Show the version.]'
- '(-help -h --help)'{-help,-h,--help}'[Show help information.]'
- )
- _arguments -w -s -S $args[@] && ret=0
-
- return ret
-}
-
_swift_package_dump-symbol-graph() {
integer ret=1
local -a args
@@ -561,19 +592,8 @@ _swift_package_dump-symbol-graph() {
'--minimum-access-level[Include symbols with this access level or more. Possible values: private | fileprivate | internal | public | open]:minimum-access-level:(private fileprivate internal public open)'
'--skip-inherited-docs[Skip emitting doc comments for members inherited through classes or default implementations.]'
'--include-spi-symbols[Add symbols with SPI information to the symbol graph.]'
- '--version[Show the version.]'
- '(-help -h --help)'{-help,-h,--help}'[Show help information.]'
- )
- _arguments -w -s -S $args[@] && ret=0
-
- return ret
-}
-
-_swift_package_dump-pif() {
- integer ret=1
- local -a args
- args+=(
- '--preserve-structure[Preserve the internal structure of PIF]'
+ '--emit-extension-block-symbols[Emit extension block symbols for extensions to external types or directly associate members and conformances with the extended nominal.]'
+ '--omit-extension-block-symbols[Emit extension block symbols for extensions to external types or directly associate members and conformances with the extended nominal.]'
'--version[Show the version.]'
'(-help -h --help)'{-help,-h,--help}'[Show help information.]'
)
@@ -666,9 +686,8 @@ _swift_package_config_set-mirror() {
integer ret=1
local -a args
args+=(
- '--package-url[The package dependency url]:package-url:'
- '--original-url[The original url]:original-url:'
- '--mirror-url[The mirror url]:mirror-url:'
+ '--original[The original url or identity]:original:'
+ '--mirror[The mirror url or identity]:mirror:'
'--version[Show the version.]'
'(-help -h --help)'{-help,-h,--help}'[Show help information.]'
)
@@ -681,9 +700,8 @@ _swift_package_config_unset-mirror() {
integer ret=1
local -a args
args+=(
- '--package-url[The package dependency url]:package-url:'
- '--original-url[The original url]:original-url:'
- '--mirror-url[The mirror url]:mirror-url:'
+ '--original[The original url or identity]:original:'
+ '--mirror[The mirror url or identity]:mirror:'
'--version[Show the version.]'
'(-help -h --help)'{-help,-h,--help}'[Show help information.]'
)
@@ -696,8 +714,7 @@ _swift_package_config_get-mirror() {
integer ret=1
local -a args
args+=(
- '--package-url[The package dependency url]:package-url:'
- '--original-url[The original url]:original-url:'
+ '--original[The original url or identity]:original:'
'--version[Show the version.]'
'(-help -h --help)'{-help,-h,--help}'[Show help information.]'
)
@@ -722,22 +739,6 @@ _swift_package_resolve() {
return ret
}
-_swift_package_fetch() {
- integer ret=1
- local -a args
- args+=(
- '--version[The version to resolve at]:version:'
- '--branch[The branch to resolve at]:branch:'
- '--revision[The revision to resolve at]:revision:'
- ':package-name:'
- '--version[Show the version.]'
- '(-help -h --help)'{-help,-h,--help}'[Show help information.]'
- )
- _arguments -w -s -S $args[@] && ret=0
-
- return ret
-}
-
_swift_package_show-dependencies() {
integer ret=1
local -a args
@@ -766,25 +767,6 @@ _swift_package_tools-version() {
return ret
}
-_swift_package_generate-xcodeproj() {
- integer ret=1
- local -a args
- args+=(
- '--xcconfig-overrides[Path to xcconfig file]:xcconfig-overrides:_files'
- '--output[Path where the Xcode project should be generated]:output:_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]'
- '--enable-code-coverage[Enable code coverage]'
- '--disable-code-coverage[Enable code coverage]'
- '--version[Show the version.]'
- '(-help -h --help)'{-help,-h,--help}'[Show help information.]'
- )
- _arguments -w -s -S $args[@] && ret=0
-
- return ret
-}
-
_swift_package_compute-checksum() {
integer ret=1
local -a args
@@ -831,6 +813,7 @@ _swift_package_plugin() {
'--list[List the available command plugins]'
'--allow-writing-to-package-directory[Allow the plugin to write to the package directory]'
'--allow-writing-to-directory[Allow the plugin to write to an additional directory]:allow-writing-to-directory:'
+ '--allow-network-connections:allow-network-connections:(none local all docker unixDomainSocket)'
':command:'
':arguments:'
'--version[Show the version.]'
@@ -841,21 +824,6 @@ _swift_package_plugin() {
return ret
}
-_swift_package_default-command() {
- integer ret=1
- local -a args
- args+=(
- '--allow-writing-to-package-directory[Allow the plugin to write to the package directory]'
- '--allow-writing-to-directory[Allow the plugin to write to an additional directory]:allow-writing-to-directory:'
- ':remaining:'
- '--version[Show the version.]'
- '(-help -h --help)'{-help,-h,--help}'[Show help information.]'
- )
- _arguments -w -s -S $args[@] && ret=0
-
- return ret
-}
-
_swift_help() {
integer ret=1
local -a args
diff --git a/plugins/symfony6/README.md b/plugins/symfony6/README.md
new file mode 100644
index 000000000..54611bcee
--- /dev/null
+++ b/plugins/symfony6/README.md
@@ -0,0 +1,9 @@
+# Symfony
+
+This plugin provides native completion for [Symfony](https://symfony.com/), but requires at least Symfony 6.2.
+
+To use it add `symfony6` to the plugins array in your zshrc file.
+
+```bash
+plugins=(... symfony6)
+```
diff --git a/plugins/symfony6/symfony6.plugin.zsh b/plugins/symfony6/symfony6.plugin.zsh
new file mode 100644
index 000000000..ed7dbe60e
--- /dev/null
+++ b/plugins/symfony6/symfony6.plugin.zsh
@@ -0,0 +1,82 @@
+#compdef console
+
+# This file is part of the Symfony package.
+#
+# (c) Fabien Potencier <fabien@symfony.com>
+#
+# For the full copyright and license information, please view
+# https://symfony.com/doc/current/contributing/code/license.html
+
+#
+# zsh completions for console
+#
+# References:
+# - https://github.com/spf13/cobra/blob/master/zsh_completions.go
+# - https://github.com/symfony/symfony/blob/5.4/src/Symfony/Component/Console/Resources/completion.bash
+#
+_sf_console() {
+ local lastParam flagPrefix requestComp out comp
+ local -a completions
+
+ # The user could have moved the cursor backwards on the command-line.
+ # We need to trigger completion from the $CURRENT location, so we need
+ # to truncate the command-line ($words) up to the $CURRENT location.
+ # (We cannot use $CURSOR as its value does not work when a command is an alias.)
+ words=("${=words[1,CURRENT]}") lastParam=${words[-1]}
+
+ # For zsh, when completing a flag with an = (e.g., console -n=<TAB>)
+ # completions must be prefixed with the flag
+ setopt local_options BASH_REMATCH
+ if [[ "${lastParam}" =~ '-.*=' ]]; then
+ # We are dealing with a flag with an =
+ flagPrefix="-P ${BASH_REMATCH}"
+ fi
+
+ # Prepare the command to obtain completions
+ requestComp="${words[0]} ${words[1]} _complete --no-interaction -szsh -a1 -c$((CURRENT-1))" i=""
+ for w in ${words[@]}; do
+ w=$(printf -- '%b' "$w")
+ # remove quotes from typed values
+ quote="${w:0:1}"
+ if [ "$quote" = \' ]; then
+ w="${w%\'}"
+ w="${w#\'}"
+ elif [ "$quote" = \" ]; then
+ w="${w%\"}"
+ w="${w#\"}"
+ fi
+ # empty values are ignored
+ if [ ! -z "$w" ]; then
+ i="${i}-i${w} "
+ fi
+ done
+
+ # Ensure at least 1 input
+ if [ "${i}" = "" ]; then
+ requestComp="${requestComp} -i\" \""
+ else
+ requestComp="${requestComp} ${i}"
+ fi
+
+ # Use eval to handle any environment variables and such
+ out=$(eval ${requestComp} 2>/dev/null)
+
+ while IFS='\n' read -r comp; do
+ if [ -n "$comp" ]; then
+ # If requested, completions are returned with a description.
+ # The description is preceded by a TAB character.
+ # For zsh's _describe, we need to use a : instead of a TAB.
+ # We first need to escape any : as part of the completion itself.
+ comp=${comp//:/\\:}
+ local tab=$(printf '\t')
+ comp=${comp//$tab/:}
+ completions+=${comp}
+ fi
+ done < <(printf "%s\n" "${out[@]}")
+
+ # Let inbuilt _describe handle completions
+ eval _describe "completions" completions $flagPrefix
+ return $?
+}
+
+compdef _sf_console console
diff --git a/plugins/systemadmin/README.md b/plugins/systemadmin/README.md
index 3a9d9de66..7847e15e9 100644
--- a/plugins/systemadmin/README.md
+++ b/plugins/systemadmin/README.md
@@ -1,7 +1,7 @@
# Systemadmin plugin
This plugin adds a series of aliases and functions which make a System Administrator's life easier.
-
+
To use it, add `systemadmin` to the plugins array in your zshrc file:
```zsh
@@ -13,6 +13,7 @@ plugins=(... systemadmin)
| Alias | Command | Description |
|---------|----------------------------------------------------------------------------|--------------------------------------------------------------------|
| ping | `ping -c 5` | Sends only 5 ICMP Messages |
+| ping6 | `ping6 -c 5` | Sends only 5 ICMPv6 Messages |
| clr | `clear; echo Currently logged in on $TTY, as $USERNAME in directory $PWD.` | Clears the screen and prints the current user, TTY, and directory |
| path | `print -l $path` | Displays PATH with each entry on a separate line |
| mkdir | `mkdir -pv` | Automatically create parent directories and display verbose output |
@@ -48,4 +49,4 @@ plugins=(... systemadmin)
| geteip | Gather information regarding an external IP address using [icanhazip.com](https://icanhazip.com) |
| getip | Determine the local IP Address with `ip addr` or `ifconfig` |
| clrz | Clear zombie processes |
-| conssec | Show number of concurrent connections per second based on ngnix/access.log file or another log file if specified |
+| conssec | Show number of concurrent connections per second based on nginx/access.log file or another log file if specified |
diff --git a/plugins/systemadmin/systemadmin.plugin.zsh b/plugins/systemadmin/systemadmin.plugin.zsh
index 03dd995b6..fa7e5f786 100644
--- a/plugins/systemadmin/systemadmin.plugin.zsh
+++ b/plugins/systemadmin/systemadmin.plugin.zsh
@@ -21,6 +21,7 @@ function retlog() {
}
alias ping='ping -c 5'
+alias ping6='ping6 -c 5'
alias clr='clear; echo Currently logged in on $TTY, as $USERNAME in directory $PWD.'
alias path='print -l $path'
alias mkdir='mkdir -pv'
diff --git a/plugins/tailscale/README.md b/plugins/tailscale/README.md
new file mode 100644
index 000000000..be5a62137
--- /dev/null
+++ b/plugins/tailscale/README.md
@@ -0,0 +1,11 @@
+# tailscale
+
+This plugin provides completion for [tailscale](https://tailscale.com/) (Easy software-defined networks using an implementation of wireguard).
+
+To use it, add `tailscale` to the plugins array in your zshrc file.
+
+```
+plugins=(... tailscale)
+```
+
+**Author:** [@lukeab](https://github.com/lukeab)
diff --git a/plugins/tailscale/tailscale.plugin.zsh b/plugins/tailscale/tailscale.plugin.zsh
new file mode 100644
index 000000000..8b4e1e34d
--- /dev/null
+++ b/plugins/tailscale/tailscale.plugin.zsh
@@ -0,0 +1,25 @@
+if (( ! $+commands[tailscale] && ! $+aliases[tailscale] )); then
+ return
+fi
+
+# If the completion file doesn't exist yet, we need to autoload it and
+# bind it to `tailscale`. Otherwise, compinit will have already done that.
+if [[ ! -f "$ZSH_CACHE_DIR/completions/_tailscale" ]]; then
+ typeset -g -A _comps
+ autoload -Uz _tailscale
+
+ if (( $+commands[tailscale] )); then
+ _comps[tailscale]=_tailscale
+ elif (( $+aliases[tailscale] )); then
+ _comps[${aliases[tailscale]:t}]=_tailscale
+ fi
+fi
+
+# If using the alias, let's make sure that the aliased executable is also bound
+# in case the alias points to "Tailscale" instead of "tailscale".
+# See https://github.com/ohmyzsh/ohmyzsh/discussions/12928
+if (( $+aliases[tailscale] )); then
+ _comps[${aliases[tailscale]:t}]=_tailscale
+fi
+
+tailscale completion zsh >| "$ZSH_CACHE_DIR/completions/_tailscale" &|
diff --git a/plugins/task/README.md b/plugins/task/README.md
new file mode 100644
index 000000000..4ef931c03
--- /dev/null
+++ b/plugins/task/README.md
@@ -0,0 +1,9 @@
+# Task plugin
+
+This plugin adds completion for [Task CLI](https://taskfile.dev/), a fast, cross-platform build tool inspired by Make, designed for modern workflows.
+
+To use it, add `task` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... task)
+``` \ No newline at end of file
diff --git a/plugins/task/task.plugin.zsh b/plugins/task/task.plugin.zsh
new file mode 100644
index 000000000..86b21b3cd
--- /dev/null
+++ b/plugins/task/task.plugin.zsh
@@ -0,0 +1,14 @@
+# Autocompletion for the task CLI (task).
+if (( !$+commands[task] )); then
+ return
+fi
+# If the completion file doesn't exist yet, we need to autoload it and
+# bind it to `task`. Otherwise, compinit will have already done that.
+if [[ ! -f "$ZSH_CACHE_DIR/completions/_task" ]]; then
+ typeset -g -A _comps
+ autoload -Uz _task
+ _comps[task]=_task
+fi
+
+# Generate and load task completion
+task --completion zsh >! "$ZSH_CACHE_DIR/completions/_task" &| \ No newline at end of file
diff --git a/plugins/terraform/README.md b/plugins/terraform/README.md
index fc9a9f005..711139ef0 100644
--- a/plugins/terraform/README.md
+++ b/plugins/terraform/README.md
@@ -15,17 +15,31 @@ plugins=(... terraform)
## Aliases
-| Alias | Command |
-| ----- | -------------------- |
-| `tf` | `terraform` |
-| `tfa` | `terraform apply` |
-| `tfc` | `terraform console` |
-| `tfd` | `terraform destroy` |
-| `tff` | `terraform fmt` |
-| `tfi` | `terraform init` |
-| `tfo` | `terraform output` |
-| `tfp` | `terraform plan` |
-| `tfv` | `terraform validate` |
+| Alias | Command |
+|---------|----------------------------------------|
+| `tf` | `terraform` |
+| `tfa` | `terraform apply` |
+| `tfa!` | `terraform apply -auto-approve` |
+| `tfap` | `terraform apply -parallelism=1` |
+| `tfc` | `terraform console` |
+| `tfd` | `terraform destroy` |
+| `tfd!` | `terraform destroy -auto-approve` |
+| `tfdp` | `terraform destroy -parallelism=1` |
+| `tff` | `terraform fmt` |
+| `tffr` | `terraform fmt -recursive` |
+| `tfi` | `terraform init` |
+| `tfir` | `terraform init -reconfigure` |
+| `tfiu` | `terraform init -upgrade` |
+| `tfiur` | `terraform init -upgrade -reconfigure` |
+| `tfo` | `terraform output` |
+| `tfp` | `terraform plan` |
+| `tfv` | `terraform validate` |
+| `tfs` | `terraform state` |
+| `tft` | `terraform test` |
+| `tfsh` | `terraform show` |
+| `tfw` | `terraform workspace` |
+| `tfwl` | `terraform workspace list` |
+| `tfws` | `terraform workspace select` |
## Prompt function
diff --git a/plugins/terraform/_terraform b/plugins/terraform/_terraform
index 625834563..157495814 100644
--- a/plugins/terraform/_terraform
+++ b/plugins/terraform/_terraform
@@ -1,411 +1,545 @@
#compdef terraform
+compdef _terraform terraform
-local -a _terraform_cmds opt_args
-_terraform_cmds=(
- 'apply:Builds or changes infrastructure'
- 'console:Interactive console for Terraform interpolations'
- 'destroy:Destroy Terraform-managed infrastructure'
- 'fmt:Rewrites config files to canonical format'
- 'force-unlock:Manually unlock the terraform state'
- 'get:Download and install modules for the configuration'
- 'graph:Create a visual graph of Terraform resources'
- 'import:Import existing infrastructure into Terraform'
- 'init:Initialize a Terraform working directory'
+(( ${+functions[_terraform_commands]} )) || _terraform_commands() {
+ local -a _terraform_cmds
+ _terraform_cmds=(
+ 'apply:Create or update infrastructure'
+ 'console:Try Terraform expressions at an interactive command prompt'
+ 'destroy:Destroy previously-created infrastructure'
+ 'fmt:Reformat your configuration in the standard style'
+ 'force-unlock:Release a stuck lock on the current workspace'
+ 'get:Install or upgrade remote Terraform modules'
+ 'graph:Generate a Graphviz graph of the steps in an operation'
+ 'import:Associate existing infrastructure with a Terraform resource'
+ 'init:Prepare your working directory for other commands'
'login:Obtain and save credentials for a remote host'
'logout:Remove locally-stored credentials for a remote host'
- 'output:Read an output from a state file'
- 'plan:Generate and show an execution plan'
- 'providers:Prints a tree of the providers used in the configuration'
- 'refresh:Update local state file against real resources'
- 'show:Inspect Terraform state or plan'
+ 'metadata:Metadata related commands'
+ 'output:Show output values from your root module'
+ 'plan:Show changes required by the current configuration'
+ 'providers:Show the providers required for this configuration'
+ 'refresh:Update the state to match remote systems'
+ 'show:Show the current state or a saved plan'
'state:Advanced state management'
- 'taint:Manually mark a resource for recreation'
- 'untaint:Manually unmark a resource as tainted'
- 'validate:Validates the Terraform files'
- 'version:Prints the Terraform version'
+ 'taint:Mark a resource instance as not fully functional'
+ 'test:Execute integration tests for Terraform modules'
+ 'untaint:Remove the '\''tainted'\'' state from a resource instance'
+ 'validate:Check whether the configuration is valid'
+ 'version:Show the current Terraform version'
'workspace:Workspace management'
- '0.12upgrade:Rewrites pre-0.12 module source code for v0.12'
- '0.13upgrade:Rewrites pre-0.13 module source code for v0.13'
-)
+ )
+ if (( CURRENT == 1 )); then
+ _describe -t commands 'terraform commands' _terraform_cmds
+ return
+ fi
-__012upgrade() {
+ local curcontext="${curcontext}"
+ cmd="${${_terraform_cmds[(r)$words[1]:*]%%:*}}"
+ curcontext="${curcontext%:*:*}:terraform-${cmd}:"
+
+ local __chdir="${opt_args[-chdir]:-.}"
+
+ if (( ${+functions[_terraform_$cmd]} )); then
+ "_terraform_${cmd}"
+ else
+ _message "no more options"
+ fi
+}
+
+(( ${+functions[_terraform_apply]} )) || _terraform_apply() {
_arguments \
- '-yes[Skip the initial introduction messages and interactive confirmation. This can be used to run this command in batch from a script.]' \
- '-force[ Override the heuristic that attempts to detect if a configuration is already written for v0.12 or later. Some of the transformations made by this command are not idempotent, so re-running against the same module may change the meanings expressions in the module.]'
+ '-auto-approve[Skip interactive approval of plan before applying.]' \
+ '-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with ".backup" extension. Set to "-" to disable backup.]:backupfile:_files -W __chdir -g "*.backup"' \
+ '-compact-warnings[If Terraform produces any warnings that are not accompanied by errors, show them in a more compact form that includes only the summary messages.]' \
+ '-destroy[Destroy Terraform-managed infrastructure. The command "terraform destroy" is a convenience alias for this option.]' \
+ '-lock=[(true) Don'\''t hold a state lock during the operation. This is dangerous if others might concurrently run commands against the same workspace.]:lock:(true false)' \
+ '-lock-timeout=[(0s) Duration to retry a state lock.]:lock_timeout:' \
+ '-input=[(true) Ask for input for variables if not directly set.]:input:(true false)' \
+ '-no-color[If specified, output won'\''t contain any color.]' \
+ '-parallelism=[(10) Limit the number of parallel resource operations.]:parallelism:' \
+ '-refresh=[(true) Skip checking for external changes to remote objects while creating the plan. This can potentially make planning faster, but at the expense of possibly planning against a stale record of the remote system state.]:refresh:(true false)' \
+ '*-replace=[(resource) Force replacement of a particular resource instance using its resource address. If applying would'\''ve normally produced an update or no-op action for this instance, Terraform will replace it instead. You can use this option multiple times to replace more than one object.]:resource:__terraform_state_resources' \
+ '-state=[(terraform.tfstate) Path to read and save state (unless state-out is specified).]:statefile:_files -W __chdir -g "*.tfstate"' \
+ '-state-out=[(path) Path to write state to that is different than "-state". This can be used to preserve the old state.]:statefile:_files -W __chdir -g "*.tfstate"' \
+ '*-target=[(resource) Limit the operation to only the given module, resource, or resource instance and all of its dependencies. You can use this option multiple times to include more than one object. This is for exceptional use only.]:target:__terraform_state_resources' \
+ '*-var=[(for=bar) Set a value for one of the input variables in the root module of the configuration. Use this option more than once to set more than one variable.]:var:' \
+ '*-var-file=[(foo) Load variable values from the given file, in addition to the default files terraform.tfvars and *.auto.tfvars. Use this option more than once to include more than one variables file.]:file:_files -W __chdir -g "*.tfvars{,.json}"' \
+ ':plan:_files -W __chdir -'
}
-__013upgrade() {
+(( ${+functions[_terraform_console]} )) || _terraform_console() {
_arguments \
- '-yes[Skip the initial introduction messages and interactive confirmation. This can be used to run this command in batch from a script.]'
+ '-state=[(terraform.tfstate) Legacy option for the local backend only. See the local backend'\''s documentation for more information.]:statefile:_files -W __chdir -g "*.tfstate"' \
+ '-plan[Create a new plan (as if running "terraform plan") and then evaluate expressions against its planned state, instead of evaluating against the current state. You can use this to inspect the effects of configuration changes that haven'\''t been applied yet.]' \
+ '*-var=[(for=bar) Set a variable in the Terraform configuration. This flag can be set multiple times.]:var:' \
+ '*-var-file=[(foo) Set variables in the Terraform configuration from a file. If "terraform.tfvars" or any ".auto.tfvars" files are present, they will be automatically loaded.]:file:_files -W __chdir -g "*.tfvars{,.json}"'
}
-__apply() {
- _arguments \
- '-auto-approve[Skip interactive approval of plan before applying.]' \
- '-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with ".backup" extension. Set to "-" to disable backup.]:backupfile:_files -g "*.backup"' \
- '-compact-warnings[If Terraform produces any warnings that are not accompanied by errors, show them in a more compact form that includes only the summary messages.]' \
- '-lock=[(true) Lock the state file when locking is supported.]:lock:(true false)' \
- '-lock-timeout=[(0s) Duration to retry a state lock.]' \
- '-input=[(true) Ask for input for variables if not directly set.]' \
- '-no-color[If specified, output will be colorless.]' \
- '-parallelism=[(10) Limit the number of parallel resource operations.]' \
- '-refresh=[(true) Update state prior to checking for differences. This has no effect if a plan file is given to apply.]' \
- '-state=[(terraform.tfstate) Path to read and save state (unless state-out is specified).]:statefile:_files -g "*.tfstate"' \
- '-state-out=[(path) Path to write state to that is different than "-state". This can be used to preserve the old state.]:statefile:_files -g "*.tfstate"' \
- '*-target=[(resource) Resource to target. Operation will be limited to this resource and its dependencies. This flag can be used multiple times.]:target:__statelist' \
- '*-var[("foo=bar") Set a variable in the Terraform configuration. This flag can be set multiple times.]' \
- '*-var-file=[(foo) Set variables in the Terraform configuration from a file. If "terraform.tfvars" or any ".auto.tfvars" files are present, they will be automatically loaded.]:file:_files -g "*.tfvars{,.json}"'
+(( ${+functions[_terraform_destroy]} )) || _terraform_destroy() {
+ _arguments \
+ '-auto-approve[Skip interactive approval of plan before applying.]' \
+ '-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with ".backup" extension. Set to "-" to disable backup.]:backupfile:_files -W __chdir -g "*.backup"' \
+ '-compact-warnings[If Terraform produces any warnings that are not accompanied by errors, show them in a more compact form that includes only the summary messages.]' \
+ '-lock=[(true) Don'\''t hold a state lock during the operation. This is dangerous if others might concurrently run commands against the same workspace.]:lock:(true false)' \
+ '-lock-timeout=[(0s) Duration to retry a state lock.]:lock_timeout:' \
+ '-input=[(true) Ask for input for variables if not directly set.]:input:(true false)' \
+ '-no-color[If specified, output won'\''t contain any color.]' \
+ '-parallelism=[(10) Limit the number of parallel resource operations.]:parallelism:' \
+ '-refresh=[(true) Update state prior to checking for differences. This has no effect if a plan file is given to apply.]:refresh:(true false)' \
+ '-state=[(terraform.tfstate) Path to read and save state (unless state-out is specified).]:statefile:_files -W __chdir -g "*.tfstate"' \
+ '-state-out=[(path) Path to write state to that is different than "-state". This can be used to preserve the old state.]:statefile:_files -W __chdir -g "*.tfstate"' \
+ '*-target=[(resource) Limit the operation to only the given module, resource, or resource instance and all of its dependencies. You can use this option multiple times to include more than one object. This is for exceptional use only.]:target:__terraform_state_resources' \
+ '*-var=[(for=bar) Set a value for one of the input variables in the root module of the configuration. Use this option more than once to set more than one variable.]:var:' \
+ '*-var-file=[(foo) Load variable values from the given file, in addition to the default files terraform.tfvars and *.auto.tfvars. Use this option more than once to include more than one variables file.]:file:_files -W __chdir -g "*.tfvars{,.json}"'
}
-__console() {
- _arguments \
- '-state=[(terraform.tfstate) Path to read state.]' \
- '*-var[("foo=bar") Set a variable in the Terraform configuration. This flag can be set multiple times.]' \
- '*-var-file=[(foo) Set variables in the Terraform configuration from a file. If "terraform.tfvars" or any ".auto.tfvars" files are present, they will be automatically loaded.]:file:_files -g "*.tfvars{,.json}"'
+(( ${+functions[_terraform_fmt]} )) || _terraform_fmt() {
+ _arguments \
+ '-list=[(true) Don'\''t list files whose formatting differs (always disabled if using STDIN)]:list:(true false)' \
+ '-write=[(true) Don'\''t write to source files (always disabled if using STDIN or -check)]:write:(true false)' \
+ '-diff[Display diffs of formatting changes]' \
+ '-check[Check if the input is formatted. Exit status will be 0 if all input is properly formatted and non-zero otherwise.]' \
+ '-no-color[If specified, output won'\''t contain any color.]' \
+ '-recursive[Also process files in subdirectories. By default, only the given directory (or current directory) is processed.]' \
+ '*:targets:_files -W __chdir -'
+}
+
+(( ${+functions[_terraform_force-unlock]} )) || _terraform_force-unlock() {
+ _arguments \
+ '-force[Don'\''t ask for input for unlock confirmation.]' \
+ ':lock_id:'
}
-__destroy() {
- _arguments \
- '-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with ".backup" extension. Set to "-" to disable backup.]:backupfile:_files -g "*.backup"' \
- '-auto-approve[Skip interactive approval before destroying.]' \
- '-force[Deprecated: same as auto-approve.]' \
- '-lock=[(true) Lock the state file when locking is supported.]:lock:(true false)' \
- '-lock-timeout=[(0s) Duration to retry a state lock.]' \
- '-no-color[If specified, output will contain no color.]' \
- '-parallelism=[(10) Limit the number of concurrent operations.]' \
- '-refresh=[(true) Update state prior to checking for differences. This has no effect if a plan file is given to apply.]' \
- '-state=[(terraform.tfstate) Path to read and save state (unless state-out is specified).]:statefile:_files -g "*.tfstate"' \
- '-state-out=[(path) Path to write state to that is different than "-state". This can be used to preserve the old state.]:statefile:_files -g "*.tfstate"' \
- '*-target=[(resource) Resource to target. Operation will be limited to this resource and its dependencies. This flag can be used multiple times.]:target:__statelist' \
- '*-var[("foo=bar") Set a variable in the Terraform configuration. This flag can be set multiple times.]' \
- '*-var-file=[(foo) Set variables in the Terraform configuration from a file. If "terraform.tfvars" or any ".auto.tfvars" files are present, they will be automatically loaded.]:file:_files -g "*.tfvars{,.json}"'
+(( ${+functions[_terraform_get]} )) || _terraform_get() {
+ _arguments \
+ '-update[Check already-downloaded modules for available updates and install the newest versions available.]' \
+ '-no-color[Disable text coloring in the output.]' \
+ '-test-directory=[(tests) Set the Terraform test directory, defaults to "tests".]:test_directory:_files -W __chdir -/'
}
-__fmt() {
- _arguments \
- '-list=[(true) List files whose formatting differs (always false if using STDIN)]' \
- '-write=[(true) Write result to source file instead of STDOUT (always false if using STDIN or -check)]' \
- '-diff=[(false) Display diffs of formatting changes]' \
- '-check=[(false) Check if the input is formatted. Exit status will be 0 if all input is properly formatted and non-zero otherwise.]' \
- '-recursive=[(false) Also process files in subdirectories. By default, only the given directory (or current directory) is processed.]'
+(( ${+functions[_terraform_graph]} )) || _terraform_graph() {
+ _arguments \
+ '-draw-cycles[Highlight any cycles in the graph with colored edges. This helps when diagnosing cycle errors. This option is supported only when illustrating a real evaluation graph, selected using the -type=TYPE option.]' \
+ '-module-depth=[(-1) (deprecated) In prior versions of Terraform, specified the depth of modules to show in the output.]:module_depth:' \
+ '-plan=[Render graph using the specified plan file instead of the configuration in the current directory. Implies -type=apply.]:plan:_files -W __chdir -' \
+ '-type=[(plan) Type of operation graph to output. Can be: plan, plan-refresh-only, plan-destroy, or apply. By default Terraform just summarizes the relationships between the resources in your configuration, without any particular operation in mind. Full operation graphs are more detailed but therefore often harder to read.]:type:(plan plan-refresh-only plan-destroy apply)'
}
-__force_unlock() {
- _arguments \
- "-force[Don't ask for input for unlock confirmation.]"
+(( ${+functions[_terraform_import]} )) || _terraform_import() {
+ _arguments \
+ '-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with ".backup" extension. Set to "-" to disable backup.]:backupfile:_files -W __chdir -g "*.backup"' \
+ '-config=[(path) Path to a directory of Terraform configuration files to use to configure the provider. Defaults to pwd. If no config files are present, they must be provided via the input prompts or env vars.]:config:_files -W __chdir -/' \
+ '-input=[(true) Disable interactive input prompts.]:input:(true false)' \
+ '-lock=[(true) Don'\''t hold a state lock during the operation. This is dangerous if others might concurrently run commands against the same workspace.]:lock:(true false)' \
+ '-lock-timeout=[(0s) Duration to retry a state lock.]:lock_timeout:' \
+ '-no-color[If specified, output will contain no color.]' \
+ '-state=[(PATH) Path to the source state file. Defaults to the configured backend, or "terraform.tfstate"]:statefile:_files -W __chdir -g "*.tfstate"' \
+ '-state-out=[(PATH) Path to the destination state file to write to. If this is not specified, the source state file will be used. This can be a new or existing path.]:statefile:_files -W __chdir -g "*.tfstate"' \
+ '*-var=[(for=bar) Set a variable in the Terraform configuration. This flag can be set multiple times. This is only useful with the "-config" flag.]:var:' \
+ '*-var-file=[(foo) Set variables in the Terraform configuration from a file. If "terraform.tfvars" or any ".auto.tfvars" files are present, they will be automatically loaded.]:file:_files -W __chdir -g "*.tfvars{,.json}"' \
+ ':addr:' \
+ ':id:'
}
-__get() {
- _arguments \
- '-update=[(false) If true, modules already downloaded will be checked for updates and updated if necessary.]' \
- '-no-color[Disable text coloring in the output.]'
+(( ${+functions[_terraform_init]} )) || _terraform_init() {
+ _arguments \
+ '-backend=[(true) Disable backend or Terraform Cloud initialization for this configuration and use what was previously initialized instead.]:backend:(true false)' \
+ '-backend-config=[Configuration to be merged with what is in the configuration file'\''s '\''backend'\'' block. This can be either a path to an HCL file with key/value assignments (same format as terraform.tfvars) or a '\''key=value'\'' format, and can be specified multiple times. The backend type must be in the configuration itself.]:backend_config:_files -W __chdir -' \
+ '-force-copy[Suppress prompts about copying state data. This is equivalent to providing a "yes" to all confirmation prompts.]' \
+ '-from-module=[Copy the contents of the given module into the target directory before initialization.]:from_module:_files -W __chdir -/' \
+ '-get=[(true) Disable downloading modules for this configuration.]:get:(true false)' \
+ '-input=[(true) Disable interactive prompts. Note that some actions may require interactive prompts and will error if input is disabled.]:input:(true false)' \
+ '-lock=[(true) Don'\''t hold a state lock during backend migration. This is dangerous if others might concurrently run commands against the same workspace.]:lock:(true false)' \
+ '-lock-timeout=[(0s) Duration to retry a state lock.]:lock_timeout:' \
+ '-no-color[If specified, output will contain no color.]' \
+ '-plugin-dir[Directory containing plugin binaries. This overrides all default search paths for plugins, and prevents the automatic installation of plugins. This flag can be used multiple times.]:plugin_dir:_files -W __chdir -/' \
+ '-reconfigure[Reconfigure the backend, ignoring any saved configuration.]' \
+ '-migrate-state[Reconfigure a backend, and attempt to migrate any existing state.]' \
+ '-upgrade[Install the latest module and provider versions allowed within configured constraints, overriding the default behavior of selecting exactly the version recorded in the dependency lockfile.]' \
+ '-lockfile=[Set a dependency lockfile mode. Currently only "readonly" is valid.]:lockfile:( readonly )' \
+ '-ignore-remote-version[A rare option used for Terraform Cloud and the remote backend only. Set this to ignore checking that the local and remote Terraform versions use compatible state representations, making an operation proceed even when there is a potential mismatch. See the documentation on configuring Terraform with Terraform Cloud for more information.]' \
+ '-test-directory=[(tests) Set the Terraform test directory, defaults to "tests".]:test_directory:_files -W __chdir -/'
}
-__graph() {
- _arguments \
- '-draw-cycles[Highlight any cycles in the graph with colored edges. This helps when diagnosing cycle errors.]' \
- '-type=[(plan) Type of graph to output. Can be: plan, plan-destroy, apply, validate, input, refresh.]'
+(( ${+functions[_terraform_login]} )) || _terraform_login() {
+ _arguments \
+ ':hostname:'
}
-__import() {
- _arguments \
- '-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with ".backup" extension. Set to "-" to disable backup.]:backupfile:_files -g "*.backup"' \
- '-config=[(path) Path to a directory of Terraform configuration files to use to configure the provider. Defaults to pwd. If no config files are present, they must be provided via the input prompts or env vars.]' \
- '-allow-missing-config[Allow import when no resource configuration block exists.]' \
- '-input=[(true) Ask for input for variables if not directly set.]' \
- '-lock=[(true) Lock the state file when locking is supported.]:lock:(true false)' \
- '-lock-timeout=[(0s) Duration to retry a state lock.]' \
- '-no-color[If specified, output will contain no color.]' \
- '-state=[(PATH) Path to the source state file. Defaults to the configured backend, or "terraform.tfstate"]:statefile:_files -g "*.tfstate"' \
- '-state-out=[(PATH) Path to the destination state file to write to. If this is not specified, the source state file will be used. This can be a new or existing path.]:statefile:_files -g "*.tfstate"' \
- '*-var[("foo=bar") Set a variable in the Terraform configuration. This flag can be set multiple times. This is only useful with the "-config" flag.]' \
- '*-var-file=[(foo) Set variables in the Terraform configuration from a file. If "terraform.tfvars" or any ".auto.tfvars" files are present, they will be automatically loaded.]:file:_files -g "*.tfvars{,.json}"'
+(( ${+functions[_terraform_logout]} )) || _terraform_logout() {
+ _arguments \
+ ':hostname:'
}
-__init() {
- _arguments \
- '-backend=[(true) Configure the backend for this configuration.]' \
- '-backend-config=[This can be either a path to an HCL file with key/value assignments (same format as terraform.tfvars) or a 'key=value' format. This is merged with what is in the configuration file. This can be specified multiple times. The backend type must be in the configuration itself.]' \
- '-force-copy[Suppress prompts about copying state data. This is equivalent to providing a "yes" to all confirmation prompts.]' \
- '-from-module=[(SOURCE) Copy the contents of the given module into the target directory before initialization.]' \
- '-get=[(true) Download any modules for this configuration.]' \
- '-get-plugins=[(true) Download any missing plugins for this configuration.]' \
- '-input=[(true) Ask for input if necessary. If false, will error if input was required.]' \
- '-lock=[(true) Lock the state file when locking is supported.]:lock:(true false)' \
- '-lock-timeout=[(0s) Duration to retry a state lock.]' \
- '-no-color[If specified, output will contain no color.]' \
- '-plugin-dir[Directory containing plugin binaries. This overrides all default search paths for plugins, and prevents the automatic installation of plugins. This flag can be used multiple times.]:plugin_dir:_files -/' \
- '-reconfigure[Reconfigure the backend, ignoring any saved configuration.]' \
- '-upgrade=[(false) If installing modules (-get) or plugins (-get-plugins), ignore previously-downloaded objects and install the latest version allowed within configured constraints.]' \
- '-verify-plugins=[(true) Verify the authenticity and integrity of automatically downloaded plugins.]'
+(( ${+functions[_terraform_metadata]} )) || _terraform_metadata() {
+ _arguments \
+ '*::terraform metadata command:_terraform_metadata_commands'
}
-__login() {
- _arguments \
+(( ${+functions[_terraform_metadata_commands]} )) || _terraform_metadata_commands() {
+ local -a _metadata_cmds
+ _metadata_cmds=(
+ 'functions:Show signatures and descriptions for the available functions'
+ )
+ if (( CURRENT == 1 )); then
+ _describe -t commands "terraform metadata commands" _metadata_cmds
+ return
+ fi
+ local curcontext="${curcontext}"
+ cmd="${${_metadata_cmds[(r)$words[1]:*]%%:*}}"
+ curcontext="${curcontext%:*:*}:terraform-metadata-${cmd}:"
+
+ if (( ${+functions[_terraform_metadata_$cmd]} )); then
+ "_terraform_metadata_${cmd}"
+ else
+ _message "no more options"
+ fi
}
-__logout() {
- _arguments \
+(( ${+functions[_terraform_metadata_functions]} )) || _terraform_metadata_functions() {
+ _arguments \
+ '-json[]'
+}
+(( ${+functions[_terraform_output]} )) || _terraform_output() {
+ _arguments \
+ '-state=[(path) Path to the state file to read. Defaults to "terraform.tfstate". Ignored when remote state is used.]:statefile:_files -W __chdir -g "*.tfstate"' \
+ '-no-color[If specified, output will contain no color.]' \
+ '-json[If specified, machine readable output will be printed in JSON format]' \
+ '-raw[For value types that can be automatically converted to a string, will print the raw string directly, rather than a human-oriented representation of the value.]' \
+ ':name:'
}
-__output() {
- _arguments \
- '-state=[(path) Path to the state file to read. Defaults to "terraform.tfstate".]:statefile:_files -g "*.tfstate"' \
- '-no-color[If specified, output will contain no color.]' \
- '-json[If specified, machine readable output will be printed in JSON format]'
+(( ${+functions[_terraform_plan]} )) || _terraform_plan() {
+ _arguments \
+ '-compact-warnings[If Terraform produces any warnings that are not accompanied by errors, show them in a more compact form that includes only the summary messages.]' \
+ '-destroy[Select the "destroy" planning mode, which creates a plan to destroy all objects currently managed by this Terraform configuration instead of the usual behavior.]' \
+ '-detailed-exitcode[Return detailed exit codes when the command exits. This will change the meaning of exit codes to: 0 - Succeeded, diff is empty (no changes); 1 - Errored, 2 - Succeeded; there is a diff]' \
+ '-input=[(true) Ask for input for variables if not directly set.]:input:(true false)' \
+ '-generate-config-out=[(path) (Experimental) If import blocks are present in configuration, instructs Terraform to generate HCL for any imported resources not already present. The configuration is written to a new file at PATH, which must not already exist. Terraform may still attempt to write configuration if the plan errors.]:generate_config_out:' \
+ '-lock=[(true) Don'\''t hold a state lock during the operation. This is dangerous if others might concurrently run commands against the same workspace.]:lock:(true false)' \
+ '-lock-timeout=[(0s) Duration to retry a state lock.]:lock_timeout:' \
+ '-no-color[If specified, output will contain no color.]' \
+ '-out=[(path) Write a plan file to the given path. This can be used as input to the "apply" command.]:out:' \
+ '-parallelism=[(10) Limit the number of concurrent operations.]:parallelism:' \
+ '-refresh=[(true) Skip checking for external changes to remote objects while creating the plan. This can potentially make planning faster, but at the expense of possibly planning against a stale record of the remote system state.]:refresh:(true false)' \
+ '-refresh-only[Select the "refresh only" planning mode, which checks whether remote objects still match the outcome of the most recent Terraform apply but does not propose any actions to undo any changes made outside of Terraform.]' \
+ '*-replace=[(resource) Force replacement of a particular resource instance using its resource address. If the plan would'\''ve normally produced an update or no-op action for this instance, Terraform will plan to replace it instead. You can use this option multiple times to replace more than one object.]:replace:__terraform_state_resources' \
+ '-state=[(statefile) Path to a Terraform state file to use to look up Terraform-managed resources. By default it will use the state "terraform.tfstate" if it exists.]:statefile:_files -W __chdir -g "*.tfstate"' \
+ '*-target=[(resource) Limit the planning operation to only the given module, resource, or resource instance and all of its dependencies. You can use this option multiple times to include more than one object. This is for exceptional use only.]:target:__terraform_state_resources' \
+ '*-var=[(for=bar) Set a value for one of the input variables in the root module of the configuration. Use this option more than once to set more than one variable.]:var:' \
+ '*-var-file=[(foo) Load variable values from the given file, in addition to the default files terraform.tfvars and *.auto.tfvars. Use this option more than once to include more than one variables file.]:file:_files -W __chdir -g "*.tfvars{,.json}"'
}
-__plan() {
- _arguments \
- '-compact-warnings[If Terraform produces any warnings that are not accompanied by errors, show them in a more compact form that includes only the summary messages.]' \
- '-destroy[If set, a plan will be generated to destroy all resources managed by the given configuration and state.]' \
- '-detailed-exitcode[() Return detailed exit codes when the command exits. This will change the meaning of exit codes to: 0 - Succeeded, diff is empty (no changes); 1 - Errored, 2 - Succeeded; there is a diff]' \
- '-input=[(true) Ask for input for variables if not directly set.]' \
- '-lock=[(true) Lock the state file when locking is supported.]:lock:(true false)' \
- '-lock-timeout=[(0s) Duration to retry a state lock.]' \
- '-no-color[() If specified, output will contain no color.]' \
- '-out=[(path) Write a plan file to the given path. This can be used as input to the "apply" command.]' \
- '-parallelism=[(10) Limit the number of concurrent operations.]' \
- '-refresh=[(true) Update state prior to checking for differences.]' \
- '-state=[(statefile) Path to a Terraform state file to use to look up Terraform-managed resources. By default it will use the state "terraform.tfstate" if it exists.]:statefile:_files -g "*.tfstate"' \
- '*-target=[(resource) Resource to target. Operation will be limited to this resource and its dependencies. This flag can be used multiple times.]:target:__statelist' \
- '*-var[("foo=bar") Set a variable in the Terraform configuration. This flag can be set multiple times.]' \
- '*-var-file=[(foo) Set variables in the Terraform configuration from a file. If "terraform.tfvars" or any ".auto.tfvars" files are present, they will be automatically loaded.]:file:_files -g "*.tfvars{,.json}"'
+(( ${+functions[_terraform_providers]} )) || _terraform_providers() {
+ _arguments \
+ '-test-directory=[(path) Set the Terraform test directory, defaults to "tests".]:test_directory:_files -W __chdir -/' \
+ '*::terraform providers command:_terraform_providers_commands'
}
-__providers() {
- local -a __providers_cmds
- __providers_cmds=(
- 'mirror:Mirrors the provider plugins needed for the current configuration'
- 'schema:Prints the schemas of the providers used in the configuration'
- )
- _describe -t providers "providers commands" __providers_cmds
+(( ${+functions[_terraform_providers_commands]} )) || _terraform_providers_commands() {
+ local -a _providers_cmds
+ _providers_cmds=(
+ 'lock:Write out dependency locks for the configured providers'
+ 'mirror:Save local copies of all required provider plugins'
+ 'schema:Show schemas for the providers used in the configuration'
+ )
+ if (( CURRENT == 1 )); then
+ _describe -t commands "terraform providers commands" _providers_cmds
+ return
+ fi
+
+ local curcontext="${curcontext}"
+ cmd="${${_providers_cmds[(r)$words[1]:*]%%:*}}"
+ curcontext="${curcontext%:*:*}:terraform-providers-${cmd}:"
+ if (( ${+functions[_terraform_providers_$cmd]} )); then
+ "_terraform_providers_${cmd}"
+ else
+ _message "no more options"
+ fi
}
-__providers_mirror() {
- _arguments \
- '-platform=[(os_arch) Choose which target platform to build a mirror for.]' \
- "*:target_dir:_files -/"
+(( ${+functions[_terraform_providers_lock]} )) || _terraform_providers_lock() {
+ _arguments \
+ '-fs-mirror=[(dir) Consult the given filesystem mirror directory instead of the origin registry for each of the given providers.]:fs_mirror:_files -W __chdir -/' \
+ '-net-mirror=[(url) Consult the given network mirror (given as a base URL) instead of the origin registry for each of the given providers.]:net_mirror:' \
+ '*-platform=[(os_arch) Choose a target platform to request package checksums for.]:platform:' \
+ '*:provider:'
}
-__providers_schema() {
- _arguments \
- '-json[]' \
- '::'
+(( ${+functions[_terraform_providers_mirror]} )) || _terraform_providers_mirror() {
+ _arguments \
+ '*-platform=[(os_arch) Choose which target platform to build a mirror for.]:platform:' \
+ '::' \
+ ':target_dir:_files -W __chdir -/'
}
-__refresh() {
- _arguments \
- '-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with ".backup" extension. Set to "-" to disable backup.]::backupfile:_files -g "*.backup"' \
- '-compact-warnings[If Terraform produces any warnings that are not accompanied by errors, show them in a more compact form that includes only the summary messages.]' \
- '-input=[(true) Ask for input for variables if not directly set.]' \
- '-lock=[(true) Lock the state file when locking is supported.]:lock:(true false)' \
- '-lock-timeout=[(0s) Duration to retry a state lock.]' \
- '-no-color[If specified, output will not contain any color.]' \
- '-state=[(path) Path to read and save state (unless state-out is specified). Defaults to "terraform.tfstate".]:statefile:_files -g "*.tfstate"' \
- '-state-out=[(path) Path to write state to that is different than "-state". This can be used to preserve the old state.]:statefile:_files -g "*.tfstate"' \
- '*-target=[(resource) A Resource Address to target. Operation will be limited to this resource and its dependencies. This flag can be used multiple times.]:target:__statelist' \
- '*-var[("foo=bar") Set a variable in the Terraform configuration. This flag can be set multiple times.]' \
- '*-var-file=[(foo) Set variables in the Terraform configuration from a file. If "terraform.tfvars" or any ".auto.tfvars" files are present, they will be automatically loaded.]:file:_files -g "*.tfvars{,.json}"'
+(( ${+functions[_terraform_providers_schema]} )) || _terraform_providers_schema() {
+ _arguments \
+ '-json[]'
}
-__show() {
- _arguments \
- '-json[If specified, output the Terraform plan or state in a machine-readable form.]' \
- '-no-color[If specified, output will not contain any color.]'
+(( ${+functions[_terraform_refresh]} )) || _terraform_refresh() {
+ _arguments \
+ '-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with ".backup" extension. Set to "-" to disable backup.]::backupfile:_files -W __chdir -g "*.backup"' \
+ '-compact-warnings[If Terraform produces any warnings that are not accompanied by errors, show them in a more compact form that includes only the summary messages.]' \
+ '-input=[(true) Ask for input for variables if not directly set.]:input:(true false)' \
+ '-lock=[(true) Don'\''t hold a state lock during the operation. This is dangerous if others might concurrently run commands against the same workspace.]:lock:(true false)' \
+ '-lock-timeout=[(0s) Duration to retry a state lock.]:lock_timeout:' \
+ '-no-color[If specified, output will not contain any color.]' \
+ '-parallelism=[(10) Limit the number of parallel resource operations.]:parallelism:' \
+ '-state=[(path) Path to read and save state (unless state-out is specified). Defaults to "terraform.tfstate".]:statefile:_files -W __chdir -g "*.tfstate"' \
+ '-state-out=[(path) Path to write state to that is different than "-state". This can be used to preserve the old state.]:statefile:_files -W __chdir -g "*.tfstate"' \
+ '*-target=[(resource) A Resource Address to target. Operation will be limited to this resource and its dependencies. This flag can be used multiple times.]:target:__terraform_state_resources' \
+ '*-var=[(for=bar) Set a variable in the Terraform configuration. This flag can be set multiple times.]:var:' \
+ '*-var-file=[(foo) Set variables in the Terraform configuration from a file. If "terraform.tfvars" or any ".auto.tfvars" files are present, they will be automatically loaded.]:file:_files -W __chdir -g "*.tfvars{,.json}"'
}
-__state() {
- local -a __state_cmds
- __state_cmds=(
- 'list:List resources in the state'
- 'mv:Move an item in the state'
- 'pull:Pull current state and output to stdout'
- 'push:Update remote state from a local state file'
- 'replace-provider:Replace provider for resources in the Terraform state'
- 'rm:Remove instances from the state'
- 'show:Show a resource in the state'
- )
- _describe -t state "state commands" __state_cmds
+(( ${+functions[_terraform_show]} )) || _terraform_show() {
+ _arguments \
+ '-json[If specified, output the Terraform plan or state in a machine-readable form.]' \
+ '-no-color[If specified, output will not contain any color.]' \
+ ':path:_files -W __chdir -g "*.tfstate"'
}
-__state_list() {
+(( ${+functions[_terraform_state]} )) || _terraform_state() {
_arguments \
- '-state=[(statefile) Path to a Terraform state file to use to look up Terraform-managed resources. By default, Terraform will consult the state of the currently-selected workspace.]' \
- '-id=[(id) Filters the results to include only instances whose resource types have an attribute named id whose value equals the given id string.]' \
- "*:address:__statelist"
+ '*::terraform state command:_terraform_state_commands'
}
-__state_mv() {
+(( ${+functions[_terraform_state_commands]} )) || _terraform_state_commands() {
+ local -a _state_cmds
+ _state_cmds=(
+ 'list:List resources in the state'
+ 'mv:Move an item in the state'
+ 'pull:Pull current state and output to stdout'
+ 'push:Update remote state from a local state file'
+ 'replace-provider:Replace provider in the state'
+ 'rm:Remove instances from the state'
+ 'show:Show a resource in the state'
+ )
+ if (( CURRENT == 1 )); then
+ _describe -t commands "terraform state commands" _state_cmds
+ return
+ fi
+
+ local curcontext="${curcontext}"
+ cmd="${${_state_cmds[(r)$words[1]:*]%%:*}}"
+ curcontext="${curcontext%:*:*}:terraform-state-${cmd}:"
+
+ if (( ${+functions[_terraform_state_$cmd]} )); then
+ "_terraform_state_${cmd}"
+ else
+ _message "no more options"
+ fi
+}
+
+(( ${+functions[_terraform_state_list]} )) || _terraform_state_list() {
_arguments \
- "-dry-run[If set, prints out what would've been moved but doesn't actually move anything.]" \
- '-backup=[(PATH) Path where Terraform should write the backup for the original state. This can"t be disabled. If not set, Terraform will write it to the same path as the statefile with a ".backup" extension.]:backupfile:_files -g "*.backup"' \
- '-backup-out=[(PATH) Path where Terraform should write the backup for the destination state. This can"t be disabled. If not set, Terraform will write it to the same path as the destination state file with a backup extension. This only needs to be specified if -state-out is set to a different path than -state.]:backupfile:_files -g "*.backup"' \
- "-lock=[(true) Lock the state files when locking is supported.]:lock:(true false)" \
- "-lock-timeout=[(0s) Duration to retry a state lock.]" \
- '-state=[(path) Path to the source state file. Defaults to the configured backend, or "terraform.tfstate"]:statefile:_files -g "*.tfstate"' \
- '-state-out=[(path) Path to the destination state file to write to. If this isn"t specified, the source state file will be used. This can be a new or existing path.]:statefile:_files -g "*.tfstate"' \
- "::" \
- ":source:__statelist" \
- ":destination: "
+ '-state=[(statefile) Path to a Terraform state file to use to look up Terraform-managed resources. By default, Terraform will consult the state of the currently-selected workspace.]:statefile:_files -W __chdir -g "*.tfstate"' \
+ '-id=[(id) Filters the results to include only instances whose resource types have an attribute named id whose value equals the given id string.]:id:' \
+ '*:address:__terraform_state_resources'
}
-__state_push() {
+(( ${+functions[_terraform_state_mv]} )) || _terraform_state_mv() {
_arguments \
- "-force[Write the state even if lineages don't match or the remote serial is higher.]" \
- '-lock=[(true) Lock the state file when locking is supported.]:lock:(true false)' \
- "-lock-timeout=[(0s) Duration to retry a state lock.]" \
- "::" \
- ":destination:_files"
+ '-dry-run[If set, prints out what would'\''ve been moved but doesn'\''t actually move anything.]' \
+ '-backup=[(PATH) Path where Terraform should write the backup for the original state. This can"t be disabled. If not set, Terraform will write it to the same path as the statefile with a ".backup" extension.]:backupfile:_files -W __chdir -g "*.backup"' \
+ '-backup-out=[(PATH) Path where Terraform should write the backup for the destination state. This can"t be disabled. If not set, Terraform will write it to the same path as the destination state file with a backup extension. This only needs to be specified if -state-out is set to a different path than -state.]:backupfile:_files -W __chdir -g "*.backup"' \
+ '-ignore-remote-version[A rare option used for the remote backend only. See the remote backend documentation for more information.]' \
+ '-lock=[(true) Don'\''t hold a state lock during the operation. This is dangerous if others might concurrently run commands against the same workspace.]:lock:(true false)' \
+ '-lock-timeout=[(0s) Duration to retry a state lock.]:lock_timeout:' \
+ '-state=[(path) Path to the source state file. Defaults to the configured backend, or "terraform.tfstate"]:statefile:_files -W __chdir -g "*.tfstate"' \
+ '-state-out=[(path) Path to the destination state file to write to. If this isn"t specified, the source state file will be used. This can be a new or existing path.]:statefile:_files -W __chdir -g "*.tfstate"' \
+ '::' \
+ ':source:__terraform_state_resources' \
+ ':destination: '
}
-__state_replace_provider() {
+(( ${+functions[_terraform_state_push]} )) || _terraform_state_push() {
_arguments \
- '-auto-approve[Skip interactive approval.]' \
- '-backup=[(PATH) Path where Terraform should write the backup for the state file. This can"t be disabled. If not set, Terraform will write it to the same path as the state file with a ".backup" extension.]:backupfile:_files -g "*.backup"' \
- "-lock=[(true) Lock the state files when locking is supported.]:lock:(true false)" \
- "-lock-timeout=[(0s) Duration to retry a state lock.]" \
- '-state=[(PATH) Path to the source state file. Defaults to the configured backend, or "terraform.tfstate"]:statefile:_files -g "*.tfstate"' \
- ":from_provider_fqn:" \
- ":to_provider_fqn:"
+ '-force[Write the state even if lineages don'\''t match or the remote serial is higher.]' \
+ '-lock=[(true) Don'\''t hold a state lock during the operation. This is dangerous if others might concurrently run commands against the same workspace.]:lock:(true false)' \
+ '-lock-timeout=[(0s) Duration to retry a state lock.]:lock_timeout:' \
+ '::' \
+ ':destination:_files'
}
-__state_rm() {
+(( ${+functions[_terraform_state_replace-provider]} )) || _terraform_state_replace-provider() {
_arguments \
- "-dry-run[If set, prints out what would've been removed but doesn't actually remove anything.]" \
- '-backup=[(PATH) Path where Terraform should write the backup for the original state.]::backupfile:_files -g "*.backup"' \
- "-lock=[(true) Lock the state file when locking is supported.]:lock:(true false)" \
- "-lock-timeout=[(0s) Duration to retry a state lock.]" \
- '-state=[(PATH) Path to the state file to update. Defaults to the current workspace state.]:statefile:_files -g "*.tfstate"' \
- "*:address:__statelist"
+ '-auto-approve[Skip interactive approval.]' \
+ '-backup=[(PATH) Path where Terraform should write the backup for the state file. This can"t be disabled. If not set, Terraform will write it to the same path as the state file with a ".backup" extension.]:backupfile:_files -W __chdir -g "*.backup"' \
+ '-lock=[(true) Don'\''t hold a state lock during the operation. This is dangerous if others might concurrently run commands against the same workspace.]:lock:(true false)' \
+ '-lock-timeout=[(0s) Duration to retry a state lock.]:lock_timeout:' \
+ '-state=[(PATH) Path to the source state file. Defaults to the configured backend, or "terraform.tfstate"]:statefile:_files -W __chdir -g "*.tfstate"' \
+ '::' \
+ ':from_provider_fqn:' \
+ ':to_provider_fqn:'
}
+(( ${+functions[_terraform_state_rm]} )) || _terraform_state_rm() {
+ _arguments \
+ '-dry-run[If set, prints out what would'\''ve been removed but doesn'\''t actually remove anything.]' \
+ '-backup=[(PATH) Path where Terraform should write the backup for the original state.]::backupfile:_files -W __chdir -g "*.backup"' \
+ '-ignore-remote-version[Continue even if remote and local Terraform versions are incompatible. This may result in an unusable workspace, and should be used with extreme caution.]' \
+ '-lock=[(true) Don'\''t hold a state lock during the operation. This is dangerous if others might concurrently run commands against the same workspace.]:lock:(true false)' \
+ '-lock-timeout=[(0s) Duration to retry a state lock.]:lock_timeout:' \
+ '-state=[(PATH) Path to the state file to update. Defaults to the current workspace state.]:statefile:_files -W __chdir -g "*.tfstate"' \
+ '*:address:__terraform_state_resources'
+}
-__state_show() {
+(( ${+functions[_terraform_state_show]} )) || _terraform_state_show() {
_arguments \
- '-state=[(statefile) Path to a Terraform state file to use to look up Terraform-managed resources. By default it will use the state "terraform.tfstate" if it exists.]:statefile:_files -g "*.tfstate"' \
- "*:address:__statelist"
+ '-state=[(statefile) Path to a Terraform state file to use to look up Terraform-managed resources. By default it will use the state "terraform.tfstate" if it exists.]:statefile:_files -W __chdir -g "*.tfstate"' \
+ "*:address:__terraform_state_resources"
}
-__statelist() {
- compadd $(terraform state list $opt_args[-state])
+(( ${+functions[__terraform_state_resources]} )) || __terraform_state_resources() {
+ local resource
+ local -a resources
+ terraform -chdir="${__chdir}" state list -state="${opt_args[-state]}" 2>/dev/null | while read -r resource; do
+ resources+=( "${resource}" )
+ done
+ compadd "${@}" - "${resources[@]}"
}
-__taint() {
- _arguments \
- '-allow-missing[If specified, the command will succeed (exit code 0) even if the resource is missing.]' \
- '-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with ".backup" extension. Set to "-" to disable backup.]:backupfile:_files -g "*.backup"' \
- '-lock=[(true) Lock the state file when locking is supported.]:lock:(true false)' \
- '-lock-timeout=[(0s) Duration to retry a state lock.]' \
- '-module=[(path) The module path where the resource lives. By default this will be root. Child modules can be specified by names. Ex. "consul" or "consul.vpc" (nested modules).]' \
- '-state=[(path) Path to read and save state (unless state-out is specified). Defaults to "terraform.tfstate".]:statefile:_files -g "*.tfstate"' \
- '-state-out=[(path) Path to write updated state file. By default, the "-state" path will be used.]:statefile:_files -g "*.tfstate"' \
- "*:address:__statelist"
+(( ${+functions[_terraform_taint]} )) || _terraform_taint() {
+ _arguments \
+ '-allow-missing[If specified, the command will succeed (exit code 0) even if the resource is missing.]' \
+ '-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with ".backup" extension. Set to "-" to disable backup.]:backupfile:_files -W __chdir -g "*.backup"' \
+ '-ignore-remote-version[A rare option used for the remote backend only. See the remote backend documentation for more information.]' \
+ '-lock=[(true) Don'\''t hold a state lock during the operation. This is dangerous if others might concurrently run commands against the same workspace.]:lock:(true false)' \
+ '-lock-timeout=[(0s) Duration to retry a state lock.]:lock_timeout:' \
+ '-state=[(path) Path to read and save state (unless state-out is specified). Defaults to "terraform.tfstate".]:statefile:_files -W __chdir -g "*.tfstate"' \
+ '-state-out=[(path) Path to write updated state file. By default, the "-state" path will be used.]:statefile:_files -W __chdir -g "*.tfstate"' \
+ '*:address:__terraform_state_resources'
}
-__untaint() {
- _arguments \
+(( ${+functions[_terraform_test]} )) || _terraform_test() {
+ _arguments \
+ '-cloud-run=[(source) If specified, Terraform will execute this test run remotely using Terraform Cloud. You must specify the source of a module registered in a private module registry as the argument to this flag. This allows Terraform to associate the cloud run with the correct Terraform Cloud module and organization.]:cloud_run:' \
+ '*-filter=[(testfile) If specified, Terraform will only execute the test files specified by this flag. You can use this option multiple times to execute more than one test file.]:testfile:_files -W __chdir -g "*.tftest.hcl"' \
+ '-json[If specified, machine readable output will be printed in JSON format]' \
+ '-no-color[If specified, machine readable output will be printed in JSON format]' \
+ '-test-directory=[(path) Set the Terraform test directory, defaults to "tests".]:test_directory:_files -W __chdir -/' \
+ '*-var=[(for=bar) Set a value for one of the input variables in the root module of the configuration. Use this option more than once to set more than one variable.]:var:' \
+ '*-var-file=[(foo) Load variable values from the given file, in addition to the default files terraform.tfvars and *.auto.tfvars. Use this option more than once to include more than one variables file.]:file:_files -W __chdir -g "*.tfvars{,.json}"' \
+ '-verbose[Print the plan or state for each test run block as it executes.]' \
+}
+
+(( ${+functions[_terraform_untaint]} )) || _terraform_untaint() {
+ _arguments \
'-allow-missing[If specified, the command will succeed (exit code 0) even if the resource is missing.]' \
- '-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with ".backup" extension. Set to "-" to disable backup.]:backupfile:_files -g "*.backup"' \
- '-lock=[(true) Lock the state file when locking is supported.]:lock:(true false)' \
- '-lock-timeout=[(0s) Duration to retry a state lock.]' \
- '-module=[(path) The module path where the resource lives. By default this will be root. Child modules can be specified by names. Ex. "consul" or "consul.vpc" (nested modules).]' \
- '-state=[(path) Path to read and save state (unless state-out is specified). Defaults to "terraform.tfstate".]:statefile:_files -g "*.tfstate"' \
- '-state-out=[(path) Path to write updated state file. By default, the "-state" path will be used.]:statefile:_files -g "*.tfstate"'
+ '-backup=[(path) Path to backup the existing state file before modifying. Defaults to the "-state-out" path with ".backup" extension. Set to "-" to disable backup.]:backupfile:_files -W __chdir -g "*.backup"' \
+ '-lock=[(true) Don'\''t hold a state lock during the operation. This is dangerous if others might concurrently run commands against the same workspace.]:lock:(true false)' \
+ '-lock-timeout=[(0s) Duration to retry a state lock.]:lock_timeout:' \
+ '-state=[(path) Path to read and save state (unless state-out is specified). Defaults to "terraform.tfstate".]:statefile:_files -W __chdir -g "*.tfstate"' \
+ '-state-out=[(path) Path to write updated state file. By default, the "-state" path will be used.]:statefile:_files -W __chdir -g "*.tfstate"' \
+ ':name:__terraform_state_resources'
}
-__validate() {
- _arguments \
- '-no-color[If specified, output will not contain any color.]' \
+(( ${+functions[_terraform_validate]} )) || _terraform_validate() {
+ _arguments \
'-json[Produce output in a machine-readable JSON format, suitable for use in text editor integrations and other automated systems.]' \
- ':dir:_files -/'
+ '-no-color[If specified, output will not contain any color.]' \
+ '-no-tests[If specified, Terraform will not validate test files.]' \
+ '-test-directory=[(path) Set the Terraform test directory, defaults to "tests".]:test_directory:_files -W __chdir -/' \
+ ':dir:_files -W __chdir -/'
}
-__version() {
- _arguments \
- '-json[Output the version information as a JSON object.]'
+(( ${+functions[_terraform_version]} )) || _terraform_version() {
+ _arguments \
+ '-json[Output the version information as a JSON object.]' \
+ '::'
}
-__workspace() {
- local -a __workspace_cmds
- __workspace_cmds=(
- 'delete:Delete a workspace'
- 'list:List Workspaces'
- 'new:Create a new workspace'
- 'select:Select a workspace'
- 'show:Show the name of the current workspace'
- )
- _describe -t workspace "workspace commands" __workspace_cmds
+(( ${+functions[_terraform_workspace]} )) || _terraform_workspace() {
+ _arguments \
+ '*::terraform workspace command:_terraform_workspace_commands'
}
-_arguments '*:: :->command'
+(( ${+functions[_terraform_workspace_commands]} )) || _terraform_workspace_commands() {
+ local -a _workspace_cmds
+ _workspace_cmds=(
+ 'delete:Delete a workspace'
+ 'list:List Workspaces'
+ 'new:Create a new workspace'
+ 'select:Select a workspace'
+ 'show:Show the name of the current workspace'
+ )
+ if (( CURRENT == 1 )); then
+ _describe -t commands "terraform workspace commands" _workspace_cmds
+ return
+ fi
-if (( CURRENT == 1 )); then
- _describe -t commands "terraform command" _terraform_cmds
- return
-fi
+ local curcontext="${curcontext}"
+ cmd="${${_workspace_cmds[(r)$words[1]:*]%%:*}}"
+ curcontext="${curcontext%:*:*}:terraform-workspace-${cmd}:"
-local -a _command_args
-case "$words[1]" in
- 0.12upgrade)
- __012upgrade ;;
- 0.13upgrade)
- __013upgrade ;;
- apply)
- __apply ;;
- console)
- __console;;
- destroy)
- __destroy ;;
- fmt)
- __fmt;;
- force-unlock)
- __force_unlock;;
- get)
- __get ;;
- graph)
- __graph ;;
- import)
- __import;;
- init)
- __init ;;
- login)
- __login ;;
- logout)
- __logout ;;
- output)
- __output ;;
- plan)
- __plan ;;
- providers)
- test $CURRENT -lt 3 && __providers
- [[ $words[2] = "mirror" ]] && __providers_mirror
- [[ $words[2] = "schema" ]] && __providers_schema
- ;;
- refresh)
- __refresh ;;
- show)
- __show ;;
- state)
- test $CURRENT -lt 3 && __state
- [[ $words[2] = "list" ]] && __state_list
- [[ $words[2] = "mv" ]] && __state_mv
- [[ $words[2] = "push" ]] && __state_push
- [[ $words[2] = "replace-provider" ]] && __state_replace_provider
- [[ $words[2] = "rm" ]] && __state_rm
- [[ $words[2] = "show" ]] && __state_show
- ;;
- taint)
- __taint ;;
- untaint)
- __untaint ;;
- validate)
- __validate ;;
- version)
- __version ;;
- workspace)
- test $CURRENT -lt 3 && __workspace ;;
-esac
+ if (( ${+functions[_terraform_workspace_$cmd]} )); then
+ "_terraform_workspace_${cmd}"
+ else
+ _message "no more options"
+ fi
+}
+
+(( ${+functions[_terraform_workspace_delete]} )) || _terraform_workspace_delete() {
+ _arguments \
+ '-force[Remove a workspace even if it is managing resources. Terraform can no longer track or manage the workspace'\''s infrastructure.]' \
+ '-lock=[(true) Don'\''t hold a state lock during the operation. This is dangerous if others might concurrently run commands against the same workspace.]:lock:(true false)' \
+ '-lock-timeout=[(0s) Duration to retry a state lock.]:lock_timeout:' \
+ '::' \
+ ':name:__terraform_workspaces'
+}
+
+(( ${+functions[_terraform_workspace_list]} )) || _terraform_workspace_list() {
+ _arguments
+}
+
+(( ${+functions[_terraform_workspace_new]} )) || _terraform_workspace_new() {
+ _arguments \
+ '-lock=[(true) Don'\''t hold a state lock during the operation. This is dangerous if others might concurrently run commands against the same workspace.]:lock:(true false)' \
+ '-lock-timeout=[(0s) Duration to retry a state lock.]:lock_timeout:' \
+ '-state=[(path) Copy an existing state file into the new workspace.]:statefile:_files -W __chdir -g "*.tfstate"' \
+ '::' \
+ ':name:'
+}
+
+(( ${+functions[_terraform_workspace_select]} )) || _terraform_workspace_select() {
+ _arguments \
+ '-or-create=[(false) Create the Terraform workspace if it doesn'\''t exist.]:or_create:(true false)' \
+ '::' \
+ ':name:__terraform_workspaces'
+}
+
+(( ${+functions[_terraform_workspace_show]} )) || _terraform_workspace_show() {
+ _arguments
+}
+
+(( ${+functions[__terraform_workspaces]} )) || __terraform_workspaces() {
+ local workspace
+ local -a workspaces
+ terraform -chdir="${__chdir}" workspace list | while read -r workspace; do
+ if [[ -z "${workspace}" ]]; then
+ continue
+ fi
+ workspaces+=( "${workspace#[ *] }" )
+ done
+ compadd "${@}" - "${workspaces[@]}"
+}
+
+_terraform() {
+ _arguments \
+ '-chdir=[(DIR) Switch to a different working directory before executing the given subcommand.]:chdir:_files -W __chdir -/' \
+ '-help[Show this help output, or the help for a specified subcommand.]' \
+ '-version[An alias for the "version" subcommand.]' \
+ '*::terraform command:_terraform_commands'
+}
+
+# don't run the completion function when being source-ed or eval-ed
+if [ "${funcstack[1]}" = '_terraform' ]; then
+ _terraform
+fi
diff --git a/plugins/terraform/terraform.plugin.zsh b/plugins/terraform/terraform.plugin.zsh
index ccca54684..1359ddd44 100644
--- a/plugins/terraform/terraform.plugin.zsh
+++ b/plugins/terraform/terraform.plugin.zsh
@@ -2,9 +2,9 @@ function tf_prompt_info() {
# dont show 'default' workspace in home dir
[[ "$PWD" != ~ ]] || return
# check if in terraform dir and file exists
- [[ -d .terraform && -r .terraform/environment ]] || return
+ [[ -d "${TF_DATA_DIR:-.terraform}" && -r "${TF_DATA_DIR:-.terraform}/environment" ]] || return
- local workspace="$(< .terraform/environment)"
+ local workspace="$(< "${TF_DATA_DIR:-.terraform}/environment")"
echo "${ZSH_THEME_TF_PROMPT_PREFIX-[}${workspace:gs/%/%%}${ZSH_THEME_TF_PROMPT_SUFFIX-]}"
}
@@ -17,10 +17,24 @@ function tf_version_prompt_info() {
alias tf='terraform'
alias tfa='terraform apply'
+alias tfa!='terraform apply -auto-approve'
+alias tfap='terraform apply -parallelism=1'
alias tfc='terraform console'
alias tfd='terraform destroy'
+alias tfd!='terraform destroy -auto-approve'
+alias tfdp='terraform destroy -parallelism=1'
alias tff='terraform fmt'
+alias tffr='terraform fmt -recursive'
alias tfi='terraform init'
+alias tfir='terraform init -reconfigure'
+alias tfiu='terraform init -upgrade'
+alias tfiur='terraform init -upgrade -reconfigure'
alias tfo='terraform output'
alias tfp='terraform plan'
alias tfv='terraform validate'
+alias tfs='terraform state'
+alias tft='terraform test'
+alias tfsh='terraform show'
+alias tfw='terraform workspace'
+alias tfwl='terraform workspace list'
+alias tfws='terraform workspace select'
diff --git a/plugins/thor/README.md b/plugins/thor/README.md
index 09c705d9a..484c88b84 100644
--- a/plugins/thor/README.md
+++ b/plugins/thor/README.md
@@ -1,6 +1,6 @@
# Thor plugin
-This plugin adds completion for [Thor](http://whatisthor.com/),
+This plugin adds completion for [Thor](http://whatisthor.com/),
a ruby toolkit for building powerful command-line interfaces.
To use it, add `thor` to the plugins array in your zshrc file:
diff --git a/plugins/timer/timer.plugin.zsh b/plugins/timer/timer.plugin.zsh
index b261f71c5..6baf1f681 100644
--- a/plugins/timer/timer.plugin.zsh
+++ b/plugins/timer/timer.plugin.zsh
@@ -6,7 +6,7 @@ __timer_current_time() {
}
__timer_format_duration() {
- local mins=$(printf '%.0f' $(($1 / 60)))
+ local mins=$(printf '%.0f' $(($(IFS='.' read int dec <<< "$1"; echo $int) / 60)))
local secs=$(printf "%.${TIMER_PRECISION:-1}f" $(($1 - 60 * mins)))
local duration_str=$(echo "${mins}m${secs}s")
local format="${TIMER_FORMAT:-/%d}"
@@ -23,9 +23,12 @@ __timer_display_timer_precmd() {
local tdiff=$((cmd_end_time - __timer_cmd_start_time))
unset __timer_cmd_start_time
if [[ -z "${TIMER_THRESHOLD}" || ${tdiff} -ge "${TIMER_THRESHOLD}" ]]; then
+ local last_cmd="${history[$((HISTCMD - 1))]%% *}"
+ if [[ "$last_cmd" != clear ]]; then
local tdiffstr=$(__timer_format_duration ${tdiff})
local cols=$((COLUMNS - ${#tdiffstr} - 1))
echo -e "\033[1A\033[${cols}C ${tdiffstr}"
+ fi
fi
fi
}
diff --git a/plugins/timoni/README.md b/plugins/timoni/README.md
new file mode 100644
index 000000000..8701ede48
--- /dev/null
+++ b/plugins/timoni/README.md
@@ -0,0 +1,9 @@
+# Timoni plugin
+
+This plugin adds completion for [Timoni](https://timoni.sh), a package manager for Kubernetes, powered by CUE and inspired by Helm.
+
+To use it, add `timoni` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... timoni)
+```
diff --git a/plugins/timoni/timoni.plugin.zsh b/plugins/timoni/timoni.plugin.zsh
new file mode 100644
index 000000000..971eda0b4
--- /dev/null
+++ b/plugins/timoni/timoni.plugin.zsh
@@ -0,0 +1,14 @@
+# Autocompletion for the Timoni CLI (timoni).
+if (( ! $+commands[timoni] )); then
+ return
+fi
+
+# If the completion file doesn't exist yet, we need to autoload it and
+# bind it to `timoni`. Otherwise, compinit will have already done that.
+if [[ ! -f "$ZSH_CACHE_DIR/completions/_timoni" ]]; then
+ typeset -g -A _comps
+ autoload -Uz _timoni
+ _comps[timoni]=_timoni
+fi
+
+timoni completion zsh >| "$ZSH_CACHE_DIR/completions/_timoni" &|
diff --git a/plugins/tldr/README.md b/plugins/tldr/README.md
new file mode 100644
index 000000000..03b1dfc73
--- /dev/null
+++ b/plugins/tldr/README.md
@@ -0,0 +1,18 @@
+# tldr plugin
+
+This plugin adds a shortcut to insert tldr before the previous command.
+Heavily inspired from [Man plugin](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/man).
+
+To use it, add `tldr` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... tldr)
+```
+
+# Keyboard Shortcuts
+| Shortcut | Description |
+|------------------------------------|----------------------------------------------------------------------------|
+| <kbd>Esc</kbd> + tldr | add tldr before the previous command to see the tldr page for this command |
+
+## Note
+You also need to install ```tldr```.
diff --git a/plugins/tldr/tldr.plugin.zsh b/plugins/tldr/tldr.plugin.zsh
new file mode 100644
index 000000000..9f3de5f0c
--- /dev/null
+++ b/plugins/tldr/tldr.plugin.zsh
@@ -0,0 +1,19 @@
+tldr-command-line() {
+ # if there is no command typed, use the last command
+ [[ -z "$BUFFER" ]] && zle up-history
+
+ # if typed command begins with tldr, do nothing
+ [[ "$BUFFER" = tldr\ * ]] && return
+
+ # get command and possible subcommand
+ # http://zsh.sourceforge.net/Doc/Release/Expansion.html#Parameter-Expansion-Flags
+ local -a args
+ args=(${${(Az)BUFFER}[1]} ${${(Az)BUFFER}[2]})
+
+ BUFFER="tldr ${args[1]}"
+}
+
+zle -N tldr-command-line
+# Defined shortcut keys: [Esc]tldr
+bindkey "\e"tldr tldr-command-line
+
diff --git a/plugins/tmux/README.md b/plugins/tmux/README.md
index b4516ef26..aaa81aa17 100644
--- a/plugins/tmux/README.md
+++ b/plugins/tmux/README.md
@@ -1,7 +1,7 @@
# tmux
-This plugin provides aliases for [tmux](https://tmux.github.io/), the terminal multiplexer.
-To use it add `tmux` to the plugins array in your zshrc file.
+This plugin provides aliases for [tmux](https://tmux.github.io/), the terminal multiplexer. To use it add
+`tmux` to the plugins array in your zshrc file.
```zsh
plugins=(... tmux)
@@ -19,26 +19,30 @@ The plugin also supports the following:
| ---------- | -------------------------- | -------------------------------------------------------- |
| `ta` | tmux attach -t | Attach new tmux session to already running named session |
| `tad` | tmux attach -d -t | Detach named tmux session |
-| `ts` | tmux new-session -s | Create a new named tmux session |
-| `tl` | tmux list-sessions | Displays a list of running tmux sessions |
-| `tksv` | tmux kill-server | Terminate all running tmux sessions |
+| `tds` | `_tmux_directory_session` | Creates or attaches to a session for the current path |
| `tkss` | tmux kill-session -t | Terminate named running tmux session |
+| `tksv` | tmux kill-server | Terminate all running tmux sessions |
+| `tl` | tmux list-sessions | Displays a list of running tmux sessions |
+| `to` | tmux new-session -A -s | Create or attach to a named tmux session |
| `tmux` | `_zsh_tmux_plugin_run` | Start a new tmux session |
| `tmuxconf` | `$EDITOR $ZSH_TMUX_CONFIG` | Open .tmux.conf file with an editor |
-| `tds` | `_tmux_directory_session` | Creates or attaches to a session for the current path |
+| `ts` | tmux new-session -s | Create a new named tmux session |
## Configuration Variables
-| Variable | Description |
-| ----------------------------------- | ------------------------------------------------------------------------------------------- |
-| `ZSH_TMUX_AUTOSTART` | Automatically starts tmux (default: `false`) |
-| `ZSH_TMUX_AUTOSTART_ONCE` | Autostart only if tmux hasn't been started previously (default: `true`) |
-| `ZSH_TMUX_AUTOCONNECT` | Automatically connect to a previous session if it exits (default: `true`) |
-| `ZSH_TMUX_AUTOQUIT` | Automatically closes terminal once tmux exits (default: `ZSH_TMUX_AUTOSTART`) |
-| `ZSH_TMUX_FIXTERM` | Sets `$TERM` to 256-color term or not based on current terminal support |
-| `ZSH_TMUX_ITERM2` | Sets the `-CC` option for iTerm2 tmux integration (default: `false`) |
-| `ZSH_TMUX_FIXTERM_WITHOUT_256COLOR` | `$TERM` to use for non 256-color terminals (default: `screen`) |
-| `ZSH_TMUX_FIXTERM_WITH_256COLOR` | `$TERM` to use for 256-color terminals (default: `screen-256color` |
-| `ZSH_TMUX_CONFIG` | Set the configuration path (default: `$HOME/.tmux.conf`, `$XDG_CONFIG_HOME/tmux/tmux.conf`) |
-| `ZSH_TMUX_UNICODE` | Set `tmux -u` option to support unicode |
-| `ZSH_TMUX_DEFAULT_SESSION_NAME` | Set tmux default session name when autostart is enabled |
+| Variable | Description |
+| ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
+| `ZSH_TMUX_AUTOREFRESH` | Automatically refresh global environments (default: `false`) |
+| `ZSH_TMUX_AUTOSTART` | Automatically starts tmux (default: `false`) |
+| `ZSH_TMUX_AUTOSTART_ONCE` | Autostart only if tmux hasn't been started previously (default: `true`) |
+| `ZSH_TMUX_AUTOCONNECT` | Automatically connect to a previous session if it exits (default: `true`) |
+| `ZSH_TMUX_AUTOQUIT` | Automatically closes terminal once tmux exits (default: `ZSH_TMUX_AUTOSTART`) |
+| `ZSH_TMUX_CONFIG` | Set the configuration path (default: `$HOME/.tmux.conf`, `$XDG_CONFIG_HOME/tmux/tmux.conf`) |
+| `ZSH_TMUX_DEFAULT_SESSION_NAME` | Set tmux default session name when autostart is enabled |
+| `ZSH_TMUX_AUTONAME_SESSION` | Automatically name new sessions based on the basename of `$PWD` (default: `false`) |
+| `ZSH_TMUX_DETACHED` | Set the detached mode (default: `false`) |
+| `ZSH_TMUX_FIXTERM` | Sets `$TERM` to 256-color term or not based on current terminal support |
+| `ZSH_TMUX_FIXTERM_WITHOUT_256COLOR` | `$TERM` to use for non 256-color terminals (default: `tmux` if available, `screen` otherwise) |
+| `ZSH_TMUX_FIXTERM_WITH_256COLOR` | `$TERM` to use for 256-color terminals (default: `tmux-256color` if available, `screen-256color` otherwise) |
+| `ZSH_TMUX_ITERM2` | Sets the `-CC` option for [iTerm2 tmux integration](https://iterm2.com/documentation-tmux-integration.html) (default: `false`) |
+| `ZSH_TMUX_UNICODE` | Set `tmux -u` option to support unicode |
diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh
index 72cdd4818..b1d97e98f 100644
--- a/plugins/tmux/tmux.plugin.zsh
+++ b/plugins/tmux/tmux.plugin.zsh
@@ -13,18 +13,32 @@ fi
: ${ZSH_TMUX_AUTOCONNECT:=true}
# Automatically close the terminal when tmux exits
: ${ZSH_TMUX_AUTOQUIT:=$ZSH_TMUX_AUTOSTART}
+# Automatically name the new session based on the basename of PWD
+: ${ZSH_TMUX_AUTONAME_SESSION:=false}
+# Automatically pick up tmux environments
+: ${ZSH_TMUX_AUTOREFRESH:=false}
# Set term to screen or screen-256color based on current terminal support
+: ${ZSH_TMUX_DETACHED:=false}
+# Set detached mode
: ${ZSH_TMUX_FIXTERM:=true}
# Set '-CC' option for iTerm2 tmux integration
: ${ZSH_TMUX_ITERM2:=false}
# The TERM to use for non-256 color terminals.
-# Tmux states this should be screen, but you may need to change it on
+# Tmux states this should be tmux|screen, but you may need to change it on
# systems without the proper terminfo
-: ${ZSH_TMUX_FIXTERM_WITHOUT_256COLOR:=screen}
+if [[ -e /usr/share/terminfo/t/tmux ]]; then
+ : ${ZSH_TMUX_FIXTERM_WITHOUT_256COLOR:=tmux}
+else
+ : ${ZSH_TMUX_FIXTERM_WITHOUT_256COLOR:=screen}
+fi
# The TERM to use for 256 color terminals.
-# Tmux states this should be screen-256color, but you may need to change it on
+# Tmux states this should be (tmux|screen)-256color, but you may need to change it on
# systems without the proper terminfo
-: ${ZSH_TMUX_FIXTERM_WITH_256COLOR:=screen-256color}
+if [[ -e /usr/share/terminfo/t/tmux-256color ]]; then
+ : ${ZSH_TMUX_FIXTERM_WITH_256COLOR:=tmux-256color}
+else
+ : ${ZSH_TMUX_FIXTERM_WITH_256COLOR:=screen-256color}
+fi
# Set the configuration path
if [[ -e $HOME/.tmux.conf ]]; then
: ${ZSH_TMUX_CONFIG:=$HOME/.tmux.conf}
@@ -37,14 +51,42 @@ fi
: ${ZSH_TMUX_UNICODE:=false}
# ALIASES
-alias ta='tmux attach -t'
-alias tad='tmux attach -d -t'
-alias ts='tmux new-session -s'
-alias tl='tmux list-sessions'
+function _build_tmux_alias {
+ setopt localoptions no_rc_expand_param
+ eval "function $1 {
+ if [[ -z \$1 ]] || [[ \${1:0:1} == '-' ]]; then
+ tmux $2 \"\$@\"
+ else
+ tmux $2 $3 \"\$@\"
+ fi
+ }"
+
+ local f s
+ f="_omz_tmux_alias_${1}"
+ s=(${(z)2})
+
+ eval "function ${f}() {
+ shift words;
+ words=(tmux ${@:2} \$words);
+ ((CURRENT+=${#s[@]}+1))
+ _tmux
+ }"
+
+ compdef "$f" "$1"
+}
+
alias tksv='tmux kill-server'
-alias tkss='tmux kill-session -t'
+alias tl='tmux list-sessions'
alias tmuxconf='$EDITOR $ZSH_TMUX_CONFIG'
+_build_tmux_alias "ta" "attach" "-t"
+_build_tmux_alias "tad" "attach -d" "-t"
+_build_tmux_alias "to" "new-session -A" "-s"
+_build_tmux_alias "ts" "new-session" "-s"
+_build_tmux_alias "tkss" "kill-session" "-t"
+
+unfunction _build_tmux_alias
+
# Determine if the terminal supports 256 colors
if [[ $terminfo[colors] == 256 ]]; then
export ZSH_TMUX_TERM=$ZSH_TMUX_FIXTERM_WITH_256COLOR
@@ -77,11 +119,26 @@ function _zsh_tmux_plugin_run() {
[[ "$ZSH_TMUX_ITERM2" == "true" ]] && tmux_cmd+=(-CC)
[[ "$ZSH_TMUX_UNICODE" == "true" ]] && tmux_cmd+=(-u)
+ local _detached=""
+ [[ "$ZSH_TMUX_DETACHED" == "true" ]] && _detached="-d"
+
+ local session_name
+ if [[ "$ZSH_TMUX_AUTONAME_SESSION" == "true" ]]; then
+ # Name the session after the basename of the current directory
+ session_name=${PWD##*/}
+ # If the current directory is the home directory, name it 'HOME'
+ [[ "$PWD" == "$HOME" ]] && session_name="HOME"
+ # If the current directory is the root directory, name it 'ROOT'
+ [[ "$PWD" == "/" ]] && session_name="ROOT"
+ else
+ session_name="$ZSH_TMUX_DEFAULT_SESSION_NAME"
+ fi
+
# Try to connect to an existing session.
- if [[ -n "$ZSH_TMUX_DEFAULT_SESSION_NAME" ]]; then
- [[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]] && $tmux_cmd attach -t $ZSH_TMUX_DEFAULT_SESSION_NAME
+ if [[ -n "$session_name" ]]; then
+ [[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]] && $tmux_cmd attach $_detached -t "$session_name"
else
- [[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]] && $tmux_cmd attach
+ [[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]] && $tmux_cmd attach $_detached
fi
# If failed, just run tmux, fixing the TERM variable if requested.
@@ -91,8 +148,9 @@ function _zsh_tmux_plugin_run() {
elif [[ -e "$ZSH_TMUX_CONFIG" ]]; then
tmux_cmd+=(-f "$ZSH_TMUX_CONFIG")
fi
- if [[ -n "$ZSH_TMUX_DEFAULT_SESSION_NAME" ]]; then
- $tmux_cmd new-session -s $ZSH_TMUX_DEFAULT_SESSION_NAME
+
+ if [[ -n "$session_name" ]]; then
+ $tmux_cmd new-session -s "$session_name"
else
$tmux_cmd new-session
fi
@@ -103,6 +161,15 @@ function _zsh_tmux_plugin_run() {
fi
}
+# Refresh tmux environment variables.
+function _zsh_tmux_plugin_preexec()
+{
+ local -a tmux_cmd
+ tmux_cmd=(command tmux)
+
+ eval $($tmux_cmd show-environment -s)
+}
+
# Use the completions for tmux for our function
compdef _tmux _zsh_tmux_plugin_run
# Alias tmux to our wrapper function.
@@ -122,10 +189,16 @@ function _tmux_directory_session() {
alias tds=_tmux_directory_session
# Autostart if not already in tmux and enabled.
-if [[ -z "$TMUX" && "$ZSH_TMUX_AUTOSTART" == "true" && -z "$INSIDE_EMACS" && -z "$EMACS" && -z "$VIM" && -z "$INTELLIJ_ENVIRONMENT_READER" ]]; then
+if [[ -z "$TMUX" && "$ZSH_TMUX_AUTOSTART" == "true" && -z "$INSIDE_EMACS" && -z "$EMACS" && -z "$VIM" && -z "$INTELLIJ_ENVIRONMENT_READER" && -z "$ZED_TERM" ]]; then
# Actually don't autostart if we already did and multiple autostarts are disabled.
if [[ "$ZSH_TMUX_AUTOSTART_ONCE" == "false" || "$ZSH_TMUX_AUTOSTARTED" != "true" ]]; then
export ZSH_TMUX_AUTOSTARTED=true
_zsh_tmux_plugin_run
fi
fi
+
+# Automatically refresh tmux environments if tmux is running.
+if [[ -n "$TMUX" && "$ZSH_TMUX_AUTOREFRESH" == "true" ]] && tmux ls >/dev/null 2>/dev/null; then
+ autoload -U add-zsh-hook
+ add-zsh-hook preexec _zsh_tmux_plugin_preexec
+fi
diff --git a/plugins/toolbox/README.md b/plugins/toolbox/README.md
index bc04a906b..d957d9bc4 100644
--- a/plugins/toolbox/README.md
+++ b/plugins/toolbox/README.md
@@ -10,7 +10,8 @@ plugins=(... toolbox)
## Prompt function
-This plugins adds `toolbox_prompt_info()` function. Using it in your prompt, it will show the toolbox indicator ⬢ (if you are running in a toolbox container), and nothing if not.
+This plugins adds `toolbox_prompt_info()` function. Using it in your prompt, it will show the toolbox
+indicator ⬢ (if you are running in a toolbox container), and nothing if not.
You can use it by adding `$(toolbox_prompt_info)` to your `PROMPT` or `RPROMPT` variable:
@@ -18,9 +19,11 @@ You can use it by adding `$(toolbox_prompt_info)` to your `PROMPT` or `RPROMPT`
RPROMPT='$(toolbox_prompt_info)'
```
+In the same way, it adds `toolbox_prompt_name()`, showing the name of the containerized environment.
+
## Aliases
-| Alias | Command | Description |
-|-------|----------------------|----------------------------------------|
-| tbe | `toolbox enter` | Enters the toolbox environment |
-| tbr | `toolbox run` | Run a command in an existing toolbox |
+| Alias | Command | Description |
+| ----- | --------------- | ------------------------------------ |
+| tbe | `toolbox enter` | Enters the toolbox environment |
+| tbr | `toolbox run` | Run a command in an existing toolbox |
diff --git a/plugins/toolbox/toolbox.plugin.zsh b/plugins/toolbox/toolbox.plugin.zsh
index 377e498cd..efe3836f7 100644
--- a/plugins/toolbox/toolbox.plugin.zsh
+++ b/plugins/toolbox/toolbox.plugin.zsh
@@ -2,5 +2,15 @@ function toolbox_prompt_info() {
[[ -f /run/.toolboxenv ]] && echo "⬢"
}
+function toolbox_prompt_name() {
+ [[ -f /run/.containerenv ]] || return
+
+ # This command reads the /run/.containerenv file line by line and extracts the
+ # container name from it by looking for the `name="..."` line, and uses -F\" to
+ # split the line by double quotes. Then all % characters are replaced with %%
+ # to escape them for the prompt.
+ awk -F\" '/name/ { gsub(/%/, "%%", $2); print $2 }' /run/.containerenv
+}
+
alias tbe="toolbox enter"
alias tbr="toolbox run"
diff --git a/plugins/tt/README.MD b/plugins/tt/README.MD
new file mode 100644
index 000000000..6246488be
--- /dev/null
+++ b/plugins/tt/README.MD
@@ -0,0 +1,26 @@
+# TT
+
+This plugin provides mutual conversion of timestamp and date.
+
+To use it add tt to the plugins array in your zshrc file.
+
+```bash
+plugins=(... tt)
+```
+# Example
+
+print timestamp for "2019-10-16"
+```bash
+tt 2019-10-16
+```
+
+print timestamp for "2019-10-16 18:41:00"
+```bash
+tt "2019-10-16 18:41:00"
+```
+
+print date for "1571222561"
+```bash
+tt 1571222561
+```
+echo 2019-10-16 18:42:41
diff --git a/plugins/tt/tt.plugin.zsh b/plugins/tt/tt.plugin.zsh
new file mode 100644
index 000000000..cffb4b823
--- /dev/null
+++ b/plugins/tt/tt.plugin.zsh
@@ -0,0 +1,21 @@
+#
+# Functions
+#
+# timestamp to date Or date to timestamp
+#
+tt () {
+ if [[ $1 =~ "-" ]]
+ then
+ if [[ $1 =~ " " ]]
+ then
+ date -j -f "%Y-%m-%d %H:%M:%S" "$1" +%s 2> /dev/null
+ else
+ date -j -f "%Y-%m-%d %H:%M:%S" "$1 00:00:00" +%s 2> /dev/null
+ fi
+ elif [[ $1 = "" ]]
+ then
+ date +%s
+ else
+ date -r $1 "+%Y-%m-%d %H:%M:%S"
+ fi
+}
diff --git a/plugins/ubuntu/README.md b/plugins/ubuntu/README.md
index 20f5c65ee..4b09ba02b 100644
--- a/plugins/ubuntu/README.md
+++ b/plugins/ubuntu/README.md
@@ -10,10 +10,11 @@ plugins=(... ubuntu)
## Aliases
-Commands that use `$APT` will use `apt` if installed or defer to `apt-get` otherwise.
+Commands that use `$APT` will use `apt-fast` if installed, or `apt` if installed, or defer to `apt-get`
+otherwise.
| Alias | Command | Description |
-|---------|--------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------|
+| ------- | ------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------- |
| age | `sudo $APT` | Run apt-get with sudo |
| acs | `apt-cache search` | Search the apt-cache with the specified criteria |
| acsp | `apt-cache showpkg` | Shows information about the listed packages |
@@ -26,7 +27,7 @@ Commands that use `$APT` will use `apt` if installed or defer to `apt-get` other
| agd | `sudo $APT dselect-upgrade` | Follows dselect choices for package installation |
| agi | `sudo $APT install <pkg>` | Install the specified package |
| agli | `apt list --installed` | List the installed packages |
-| aglu | `sudo apt-get -u upgrade --assume-no` | Run an apt-get upgrade assuming no to all prompts |
+| aglu | `apt list --upgradable` | List available updates only |
| agp | `sudo $APT purge <pkg>` | Remove a package including any configuration files |
| agr | `sudo $APT remove <pkg>` | Remove a package |
| ags | `$APT source <pkg>` | Fetch the source for the specified package |
@@ -36,21 +37,20 @@ Commands that use `$APT` will use `apt` if installed or defer to `apt-get` other
| agar | `sudo $APT autoremove` | Remove automatically installed packages no longer needed |
| aguu | `sudo $APT update && sudo $APT upgrade` | Update packages list and upgrade available packages |
| allpkgs | `dpkg --get-selections \| grep -v deinstall` | Print all installed packages |
-| kclean | `sudo aptitude remove -P ?and(~i~nlinux-(ima\|hea) ?not(~n$(uname -r)))` |Remove ALL kernel images and headers EXCEPT the one in use |
+| kclean | `sudo aptitude remove -P ?and(~i~nlinux-(ima\|hea) ?not(~n$(uname -r)))` | Remove ALL kernel images and headers EXCEPT the one in use |
| mydeb | `time dpkg-buildpackage -rfakeroot -us -uc` | Create a basic .deb package |
| ppap | `sudo ppa-purge <ppa>` | Remove the specified PPA |
-
## Functions
-| Function | Usage |Description |
-|-------------------|---------------------------------------|--------------------------------------------------------------------------|
+| Function | Usage | Description |
+| ----------------- | ------------------------------------- | ------------------------------------------------------------------------ |
| aar | `aar ppa:xxxxxx/xxxxxx [packagename]` | apt-add-repository with automatic install/upgrade of the desired package |
| apt-history | `apt-history <action>` | Prints the Apt history of the specified action |
| apt-list-packages | `apt-list-packages` | List packages by size |
| kerndeb | `kerndeb` | Kernel-package building shortcut |
-## Authors:
+## Authors
- [@AlexBio](https://github.com/AlexBio)
- [@dbb](https://github.com/dbb)
@@ -59,3 +59,4 @@ Commands that use `$APT` will use `apt` if installed or defer to `apt-get` other
- [Nicolas Jonas](https://nextgenthemes.com)
- [@loctauxphilippe](https://github.com/loctauxphilippe)
- [@HaraldNordgren](https://github.com/HaraldNordgren)
+- [@AmrElsayyad](https://github.com/AmrElsayyad)
diff --git a/plugins/ubuntu/ubuntu.plugin.zsh b/plugins/ubuntu/ubuntu.plugin.zsh
index 7b765a406..66e2d52cb 100644
--- a/plugins/ubuntu/ubuntu.plugin.zsh
+++ b/plugins/ubuntu/ubuntu.plugin.zsh
@@ -1,11 +1,22 @@
-(( $+commands[apt] )) && APT=apt || APT=apt-get
+# Detect available package manager (prefer apt-fast > apt > apt-get)
+if (( $+commands[apt-fast] )); then
+ APT=apt-fast
+elif (( $+commands[apt] )); then
+ APT=apt
+else
+ APT=apt-get
+fi
alias acs='apt-cache search'
alias afs='apt-file search --regexp'
# These are apt/apt-get only
-alias ags="$APT source"
+if (( $+commands[apt] )); then
+ alias ags="apt source"
+else
+ alias ags="apt-get source"
+fi
alias acp='apt-cache policy'
diff --git a/plugins/ufw/README.md b/plugins/ufw/README.md
index ac377cd17..ffcc6d6f7 100644
--- a/plugins/ufw/README.md
+++ b/plugins/ufw/README.md
@@ -10,7 +10,7 @@ plugins=(... ufw)
Some of the commands include:
-* `allow <port>/<optional: protocol>` add an allow rule
+* `allow <port>/<optional: protocol>` add an allow rule
* `default` set default policy
* `delete <port>/<optional: protocol>` delete RULE
* `deny <port>/<optional: protocol>` add deny rule
diff --git a/plugins/universalarchive/README.md b/plugins/universalarchive/README.md
index 93a1bd9fc..bcd33cea0 100644
--- a/plugins/universalarchive/README.md
+++ b/plugins/universalarchive/README.md
@@ -1,46 +1,76 @@
# universalarchive plugin
-Lets you compress files by a command `ua <format> <files>`, supporting various
-compression formats (e.g. 7z, tar.gz, lzma, ...).
+The `universalarchive` plugin provides a convenient command-line interface for archiving files and directories using a wide variety of compression formats - without having to remember the exact syntax for each tool.
-To enable it, add `universalarchive` to the plugins array in your zshrc file:
+To enable it, add `universalarchive` to the plugins array in your `.zshrc` file:
```zsh
plugins=(... universalarchive)
```
+## Features
+ - Compress files and directories using a simple, unified command: ua <format> <files>
+ - Automatically detects file/directory names to generate appropriate output names
+ - Supports fallback naming if an output file already exists
+ - Works with many common and advanced compression formats
+ - Designed for simplicity and quick use in the terminal
+
## Usage
-Run `ua <format> <files>` to compress `<files>` into an archive file using `<format>`.
-For example:
+Basic command format:
+```sh
+ua <format> <files...>
+```
+- `<format>`: the archive format to use (e.g., `zip`, `tar.gz`, `xz`, `7z`, etc.)
+- `<files...>`: one or more files or directories to compress
+
+## Examples:
+
+Compresses `notes.txt` and `images` into `notes.zip`
+```sh
+ua zip notes.txt images/
+```
+
+Creates `myproject.tar.gz`
+```sh
+ua tar.gz myproject/
+```
+Compresses all .log files into `current_folder.xz`
```sh
-ua xz *.html
+ua xz *.log
```
-this command will compress all `.html` files in directory `folder` into `folder.xz`.
+The plugin will generate a default archive filename based on the input:
+ - For a file, the output is derived from the file name without its extension.
+ - For a directory, it uses the directory name.
+ - For multiple files, it uses the name of the common parent directory.
+
+ If the output file already exists, a unique filename is generated using `mktemp`.
+
+## Supported Archive Formats
-This plugin saves you from having to remember which command line arguments compress a file.
+| Format | Description | Tool Used |
+|:-----------------|:-------------------------------|:-----------------|
+| `7z` | 7zip archive | `7z` |
+| `bz2` | Bzip2-compressed file | `bzip2` |
+| `gz` | Gzip-compressed file | `gzip` |
+| `lzma` | LZMA-compressed file | `lzma` |
+| `lzo` | LZO-compressed file | `lzop` |
+| `rar` | WinRAR archive | `rar` |
+| `tar` | Uncompressed tarball | `tar` |
+| `tbz`,`tar.bz2` | Tarball compressed with Bzip2 | `tar + bzip2` |
+| `tgz`,`tar.gz` | Tarball compressed with Gzip | `tar + gzip` |
+| `tlz`,`tar.lzma` | Tarball compressed with LZMA | `tar + lzma` |
+| `txz`,`tar.xz` | Tarball compressed with LZMA2 | `tar + xz` |
+| `tZ`,`tar.Z` | Tarball compressed with LZW | `tar + compress` |
+| `xz` | XZ-compressed file | `xz` |
+| `Z` | LZW-compressed file | `compress` |
+| `zip` | Standard Zip archive | `zip` |
+| `zst` | Zstandard-compressed file | `zstd` |
-## Supported compression formats
+ > Note: Some formats may require specific tools to be installed on your system (e.g. `7z`, `rar`, `lzop`, `zstd`). Make sure these tools are available in your `$PATH`.
-| Extension | Description |
-|:-----------------|:-------------------------------|
-| `7z` | 7zip file |
-| `bz2` | Bzip2 file |
-| `gz` | Gzip file |
-| `lzma` | LZMA archive |
-| `lzo` | LZO archive |
-| `rar` | WinRAR archive |
-| `tar` | Tarball |
-| `tbz`/`tar.bz2` | Tarball with bzip2 compression |
-| `tgz`/`tar.gz` | Tarball with gzip compression |
-| `tlz`/`tar.lzma` | Tarball with lzma compression |
-| `txz`/`tar.xz` | Tarball with lzma2 compression |
-| `tZ`/`tar.Z` | Tarball with LZW compression |
-| `xz` | LZMA2 archive |
-| `Z` | Z archive (LZW) |
-| `zip` | Zip archive |
-| `zst` | Zstd archive |
+## Auto-Completion
-See [list of archive formats](https://en.wikipedia.org/wiki/List_of_archive_formats) for more information regarding the archive formats.
+The plugin provides tab-completion for supported formats and input files. Type `ua <TAB>` to see available formats, and `ua <format> <TAB>` to browse files.
diff --git a/plugins/uv/README.md b/plugins/uv/README.md
new file mode 100644
index 000000000..266963e18
--- /dev/null
+++ b/plugins/uv/README.md
@@ -0,0 +1,36 @@
+# uv plugin
+
+This plugin automatically installs [uv](https://github.com/astral-sh/uv)'s completions for you,
+and keeps them up to date. It also adds convenient aliases for common usage.
+
+To use it, add `uv` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... uv)
+```
+
+## Aliases
+
+| Alias | Command | Description |
+| :---- | ---------------------------------------------------------------------------------------- | :-------------------------------------------------------------------- |
+| uva | `uv add` | Add packages to the project |
+| uvexp | `uv export --format requirements-txt --no-hashes --output-file requirements.txt --quiet` | Export the lock file to `requirements.txt` |
+| uvi | `uv init` | Initialize a new project in current workspace and environment. |
+| uvinw | `uv init --no-workspace` | Initialize a new project in a new workspace and environment |
+| uvl | `uv lock` | Lock the dependencies |
+| uvlr | `uv lock --refresh` | Rebuild the lock file without upgrading dependencies |
+| uvlu | `uv lock --upgrade` | Lock the dependencies to the newest compatible versions |
+| uvp | `uv pip` | Manage pip packages |
+| uvpi | `uv python install` | Install a specific version of python |
+| uvpl | `uv python list` | Lists all python version installed |
+| uvpp | `uv python pin` | Pin the current project to use a specific Python version |
+| uvpu | `uv python uninstall` | Remove a specific version of python |
+| uvpy | `uv python` | Manage Python installs |
+| uvr | `uv run` | Run commands within the project's environment |
+| uvrm | `uv remove` | Remove packages from the project |
+| uvs | `uv sync` | Sync the environment with the lock file |
+| uvsr | `uv sync --refresh` | "Force" sync the environment with the lock file (ignore cache) |
+| uvsu | `uv sync --upgrade` | Sync the environment, allowing upgrades and ignoring the lock file |
+| uvtr | `uv tree` | Displays the full dependency tree for the current project environment |
+| uvup | `uv self update` | Update the UV tool to the latest version |
+| uvv | `uv venv` | Manage virtual environments |
diff --git a/plugins/uv/uv.plugin.zsh b/plugins/uv/uv.plugin.zsh
new file mode 100644
index 000000000..0c0795e56
--- /dev/null
+++ b/plugins/uv/uv.plugin.zsh
@@ -0,0 +1,47 @@
+# Return immediately if uv is not found
+if (( ! ${+commands[uv]} )); then
+ return
+fi
+
+alias uv="noglob uv"
+
+alias uva='uv add'
+alias uvexp='uv export --format requirements-txt --no-hashes --output-file requirements.txt --quiet'
+alias uvi='uv init'
+alias uvinw='uv init --no-workspace'
+alias uvl='uv lock'
+alias uvlr='uv lock --refresh'
+alias uvlu='uv lock --upgrade'
+alias uvp='uv pip'
+alias uvpi='uv python install'
+alias uvpl='uv python list'
+alias uvpu='uv python uninstall'
+alias uvpy='uv python'
+alias uvpp='uv python pin'
+alias uvr='uv run'
+alias uvrm='uv remove'
+alias uvs='uv sync'
+alias uvsr='uv sync --refresh'
+alias uvsu='uv sync --upgrade'
+alias uvtr='uv tree'
+alias uvup='uv self update'
+alias uvv='uv venv'
+
+# If the completion file doesn't exist yet, we need to autoload it and
+# bind it. Otherwise, compinit will have already done that.
+if [[ ! -f "$ZSH_CACHE_DIR/completions/_uv" ]]; then
+ typeset -g -A _comps
+ autoload -Uz _uv
+ _comps[uv]=_uv
+fi
+
+if [[ ! -f "$ZSH_CACHE_DIR/completions/_uvx" ]]; then
+ typeset -g -A _comps
+ autoload -Uz _uvx
+ _comps[uvx]=_uvx
+fi
+
+# uv and uvx are installed together (uvx is an alias to `uv tool run`)
+# Overwrites the file each time as completions might change with uv versions.
+uv generate-shell-completion zsh >| "$ZSH_CACHE_DIR/completions/_uv" &|
+uvx --generate-shell-completion zsh >| "$ZSH_CACHE_DIR/completions/_uvx" &|
diff --git a/plugins/vagrant-prompt/README.md b/plugins/vagrant-prompt/README.md
index c5bc55d17..f7bfce4f3 100644
--- a/plugins/vagrant-prompt/README.md
+++ b/plugins/vagrant-prompt/README.md
@@ -1,6 +1,52 @@
+# vagrant-prompt
+
This plugin prompts the status of the Vagrant VMs. It supports single-host and
multi-host configurations as well.
-Look inside the source for documentation about custom variables.
+To use it, add `vagrant-prompt` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... vagrant-prompt)
+```
+
+**Alberto Re <alberto.re@gmail.com>**
+
+## Usage
+
+To display Vagrant info on your prompt add the `vagrant_prompt_info` to the
+`$PROMPT` or `$RPROMPT` variable in your theme. Example:
+
+```zsh
+PROMPT="$PROMPT"' $(vagrant_prompt_info)'
+# or
+RPROMPT='$(vagrant_prompt_info)'
+```
+
+### Customization
+
+`vagrant_prompt_info` makes use of the following custom variables, which can be set in your
+`.zshrc` file:
+
+```zsh
+ZSH_THEME_VAGRANT_PROMPT_PREFIX="%{$fg_bold[blue]%}["
+ZSH_THEME_VAGRANT_PROMPT_SUFFIX="%{$fg_bold[blue]%}]%{$reset_color%} "
+ZSH_THEME_VAGRANT_PROMPT_RUNNING="%{$fg_no_bold[green]%}●"
+ZSH_THEME_VAGRANT_PROMPT_POWEROFF="%{$fg_no_bold[red]%}●"
+ZSH_THEME_VAGRANT_PROMPT_SUSPENDED="%{$fg_no_bold[yellow]%}●"
+ZSH_THEME_VAGRANT_PROMPT_NOT_CREATED="%{$fg_no_bold[white]%}○"
+```
+
+### State to variable mapping
+
+The plugin uses the output reported by `vagrant status` to print whichever symbol matches,
+according to the following table:
-Alberto Re <alberto.re@gmail.com>
+| State | Symbol |
+| ----------- | -------------------------------------- |
+| running | `ZSH_THEME_VAGRANT_PROMPT_RUNNING` |
+| not running | `ZSH_THEME_VAGRANT_PROMPT_POWEROFF` |
+| poweroff | `ZSH_THEME_VAGRANT_PROMPT_POWEROFF` |
+| paused | `ZSH_THEME_VAGRANT_PROMPT_SUSPENDED` |
+| saved | `ZSH_THEME_VAGRANT_PROMPT_SUSPENDED` |
+| suspended | `ZSH_THEME_VAGRANT_PROMPT_SUSPENDED` |
+| not created | `ZSH_THEME_VAGRANT_PROMPT_NOT_CREATED` |
diff --git a/plugins/vagrant-prompt/vagrant-prompt.plugin.zsh b/plugins/vagrant-prompt/vagrant-prompt.plugin.zsh
index d7c76c3c9..2d8455a53 100644
--- a/plugins/vagrant-prompt/vagrant-prompt.plugin.zsh
+++ b/plugins/vagrant-prompt/vagrant-prompt.plugin.zsh
@@ -1,33 +1,18 @@
-# vim:ft=zsh ts=2 sw=2 sts=2
-#
-# To display Vagrant infos on your prompt add the vagrant_prompt_info to the
-# $PROMPT variable in your theme. Example:
-#
-# PROMPT='%{$fg[$NCOLOR]%}%B%n%b%{$reset_color%}:%{$fg[blue]%}%B%c/%b%{$reset_color%} $(vagrant_prompt_info)$(svn_prompt_info)$(git_prompt_info)%(!.#.$) '
-#
-# `vagrant_prompt_info` makes use of some custom variables. This is an example
-# definition:
-#
-# ZSH_THEME_VAGRANT_PROMPT_PREFIX="%{$fg_bold[blue]%}["
-# ZSH_THEME_VAGRANT_PROMPT_SUFFIX="%{$fg_bold[blue]%}]%{$reset_color%} "
-# ZSH_THEME_VAGRANT_PROMPT_RUNNING="%{$fg_no_bold[green]%}●"
-# ZSH_THEME_VAGRANT_PROMPT_POWEROFF="%{$fg_no_bold[red]%}●"
-# ZSH_THEME_VAGRANT_PROMPT_SUSPENDED="%{$fg_no_bold[yellow]%}●"
-# ZSH_THEME_VAGRANT_PROMPT_NOT_CREATED="%{$fg_no_bold[white]%}○"
-
function vagrant_prompt_info() {
- local vm_states vm_state
- if [[ -d .vagrant && -f Vagrantfile ]]; then
- vm_states=(${(f)"$(vagrant status 2> /dev/null | sed -nE 's/^.*(saved|poweroff|running|not created) \([[:alnum:]_]+\)$/\1/p')"})
- printf '%s' $ZSH_THEME_VAGRANT_PROMPT_PREFIX
- for vm_state in $vm_states; do
- case "$vm_state" in
- saved) printf '%s' $ZSH_THEME_VAGRANT_PROMPT_SUSPENDED ;;
- running) printf '%s' $ZSH_THEME_VAGRANT_PROMPT_RUNNING ;;
- poweroff) printf '%s' $ZSH_THEME_VAGRANT_PROMPT_POWEROFF ;;
- "not created") printf '%s' $ZSH_THEME_VAGRANT_PROMPT_NOT_CREATED ;;
- esac
- done
- printf '%s' $ZSH_THEME_VAGRANT_PROMPT_SUFFIX
+ if [[ ! -d .vagrant || ! -f Vagrantfile ]]; then
+ return
fi
+
+ local vm_states vm_state
+ vm_states=(${(f)"$(vagrant status 2> /dev/null | sed -nE 's/^[^ ]* *([[:alnum:] ]*) \([[:alnum:]_]+\)$/\1/p')"})
+ printf '%s' $ZSH_THEME_VAGRANT_PROMPT_PREFIX
+ for vm_state in $vm_states; do
+ case "$vm_state" in
+ running) printf '%s' $ZSH_THEME_VAGRANT_PROMPT_RUNNING ;;
+ "not running"|poweroff) printf '%s' $ZSH_THEME_VAGRANT_PROMPT_POWEROFF ;;
+ paused|saved|suspended) printf '%s' $ZSH_THEME_VAGRANT_PROMPT_SUSPENDED ;;
+ "not created") printf '%s' $ZSH_THEME_VAGRANT_PROMPT_NOT_CREATED ;;
+ esac
+ done
+ printf '%s' $ZSH_THEME_VAGRANT_PROMPT_SUFFIX
}
diff --git a/plugins/vault/README.md b/plugins/vault/README.md
index 69051d2b2..cc270a385 100644
--- a/plugins/vault/README.md
+++ b/plugins/vault/README.md
@@ -1,15 +1,9 @@
# Vault plugin
-Note: this plugin is deprecated. Use the [official autocompletion](https://www.vaultproject.io/docs/commands/index.html#autocompletion) instead.
-
--------
-
-Adds autocomplete options for all [vault](https://www.vaultproject.io) commands.
+This plugin adds completion for [Vault](https://www.vaultproject.io/), the secrets and sensitive data manager.
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/vault/_vault b/plugins/vault/_vault
deleted file mode 100644
index f6bd3517e..000000000
--- a/plugins/vault/_vault
+++ /dev/null
@@ -1,400 +0,0 @@
-#compdef vault
-
-typeset -a main_args
-main_args=(
- '(-version)-version[Prints the Vault version]'
- '(-help)-help[Prints Vault Help]'
-)
-
-typeset -a general_args
-general_args=(
- '(-help)-help[Prints Help]'
- '(-address)-address=-[The address of the Vault server. Overrides the VAULT_ADDR environment variable if set.]:address:'
- '(-ca-cert)-ca-cert=-[Path to a PEM encoded CA cert file to use to verify the Vault server SSL certificate. Overrides the VAULT_CACERT environment variable if set.]:file:_files -g "*.pem"'
- '(-ca-path)-ca-path=-[Path to a directory of PEM encoded CA cert files to verify the Vault server SSL certificate. If both -ca-cert and -ca-path are specified, -ca-path is used.Overrides the VAULT_CAPATH environment variable if set.]:directory:_directories'
- '(-client-cert)-client-cert=-[Path to a PEM encoded client certificate for TLS authentication to the Vault server. Must also specify -client-key. Overrides the VAULT_CLIENT_CERT environment variable if set.]:file:_files -g "*.pem"'
- '(-client-key)-client-key=-[Path to an unencrypted PEM encoded private key matching the client certificate from -client-cert. Overrides the VAULT_CLIENT_KEY environment variable if set.]:file:_files -g "*.pem"'
- '(-tls-skip-verify)-tls-skip-verify[Do not verify TLS certificate. This is highly not recommended. Verification will also be skipped if VAULT_SKIP_VERIFY is set.]'
-)
-
-typeset -a audit_enable_args
-audit_enable_args=(
- '(-description)-description=-[A human-friendly description for the backend. This shows up only when querying the enabled backends.]:description:'
- '(-id)-id=-[Specify a unique ID for this audit backend. This is purely for referencing this audit backend. By default this will be the backend type.]:id:'
-)
-
-typeset -a auth_args
-auth_args=(
- '(-method)-method=-[Outputs help for the authentication method with the given name for the remote server. If this authentication method is not available, exit with code 1.]:method:(cert ldap github userpass app-id)'
- '(-method-help)-method-help[If set, the help for the selected method will be shown.]'
- '(-methods)-methods[List the available auth methods.]'
- '(-no-verify)-no-verify[Do not verify the token after creation; avoids a use count]'
-)
-
-typeset -a auth_enable_args
-auth_enable_args=(
- '(-description)-description=-[Human-friendly description of the purpose for the auth provider. This shows up in the auth-list command.]:description:'
- '(-path)-path=-[Mount point for the auth provider. This defaults to the type of the mount. This will make the auth provider available at "/auth/<path>"]:path:'
-)
-
-typeset -a init_args
-init_args=(
- '(-key-shares)-key-shares=-[(default: 5) The number of key shares to split the master key into.]:keyshares:'
- '(-key-threshold)-key-threshold=-[(default: 3) The number of key shares required to reconstruct the master key.]:keythreshold:'
- '(-pgp-keys)-pgp-keys[If provided, must be a comma-separated list of files on disk containing binary- or base64-format public PGP keys. The number of files must match "key-shares". The output unseal keys will encrypted and hex-encoded, in order, with the given public keys. If you want to use them with the "vault unseal" command, you will need to hex decode and decrypt; this will be the plaintext unseal key.]:pgpkeys:_files'
-)
-
-typeset -a mount_tune_args
-mount_tune_args=(
- '(-default-lease-ttl)-default-lease-ttl=-[Default lease time-to-live for this backend. If not specified, uses the system default, or the previously set value. Set to "system" to explicitly set it to use the system default.]:defaultleasettl:'
- '(-max-lease-ttl)-max-lease-ttl=-[Max lease time-to-live for this backend. If not specified, uses the system default, or the previously set value. Set to "system" to explicitly set it to use the system default.]:maxleasettl:'
-)
-
-typeset -a mount_args
-mount_args=(
- $mount_tune_args
- '(-path)-path=-[Mount point for the logical backend. This defaults to the type of the mount.]:path:'
- '(-description)-description=-[Human-friendly description of the purpose for the mount. This shows up in the mounts command.]:description:'
-)
-
-typeset -a rekey_args
-rekey_args=(
- $init_args
- '(-init)-init[Initialize the rekey operation by setting the desired number of shares and the key threshold. This can only be done if no rekey is already initiated.]:init:'
- '(-cancel)-cancel[Reset the rekey process by throwing away prior keys and the rekey configuration.]:cancel:'
- '(-status)-status[Prints the status of the current rekey operation. This can be used to see the status without attempting to provide an unseal key.]:status:'
-)
-
-typeset -a ssh_args
-ssh_args=(
- '(-role)-role[Role to be used to create the key. ]:role:'
- '(-no-exec)-no-exec[Shows the credentials but does not establish connection.]:noexec:'
- '(-mount-point)-mount-point[Mount point of SSH backend. If the backend is mounted at "ssh", which is the default as well, this parameter can be skipped.]:mountpoint:'
- '(-format)-format[If no-exec option is enabled, then the credentials will be printed out and SSH connection will not be established. The format of the output can be "json" or "table". JSON output is useful when writing scripts. Default is "table".]:format:(json table)'
-)
-
-typeset -a token_create_args
-token_create_args=(
- '(-id)-id=-[The token value that clients will use to authenticate with vault. If not provided this defaults to a 36 character UUID. A root token is required to specify the ID of a token.]:id:'
- '(-display-name)-display-name=-[A display name to associate with this token. This is a non-security sensitive value used to help identify created secrets, i.e. prefixes.]:displayname:'
- '(-ttl)-ttl=-[TTL to associate with the token. This option enables the tokens to be renewable.]:ttl:'
- '*-metadata=-[Metadata to associate with the token. This shows up in the audit log. This can be specified multiple times.]:metadata:'
- '(-orphan)-orphan[If specified, the token will have no parent. Only root tokens can create orphan tokens. This prevents the new token from being revoked with your token.]:orphan:'
- '(-no-default-policy)-no-default-policy[If specified, the token will not have the "default" policy included in its policy set.]:nodefaultpolicy:'
- '*-policy=-[Policy to associate with this token. This can be specified multiple times.]:policy:__vault_policies'
- '(-use-limit)-use-limit=-[The number of times this token can be used until it is automatically revoked.]:uselimit:'
- '(-format)-format=-[The format for output. By default it is a whitespace-delimited table. This can also be json.]:format:(json table)'
-)
-
-typeset -a server_args
-server_args=(
- '*-config=-[Path to the configuration file or directory. This can be specified multiple times. If it is a directory, all files with a ".hcl" or ".json" suffix will be loaded.]:config:_files'
- '-dev[Enables Dev mode. In this mode, Vault is completely in-memory and unsealed. Do not run the Dev server in production!]:dev:'
- '-log-level=-[Log verbosity. Defaults to "info", will be outputtedto stderr. Supported values: "trace", "debug", "info", "warn", "err"]:loglevel:(trace debug info warn err)'
-)
-
-_vault_audit-list() {
- _arguments : \
- ${general_args[@]} && ret=0
-}
-
-_vault_audit-disable() {
- # vault audit-list doesn't print the backend id so for now
- # no *smart* autocompletion for this subcommand.
- _arguments : \
- ${general_args[@]} \
- ':::(file syslog)' && ret=0
-}
-
-_vault_audit-enable() {
- _arguments : \
- ${general_args[@]} \
- ${audit_enable_args[@]} \
- ': :->backends' \
- '*:: :->backendconfig' && ret=0
-
- case $state in
- backends)
- local -a backends
- backends=(
- 'file:The "file" audit backend writes audit logs to a file.'
- 'syslog:The "syslog" audit backend writes audit logs to syslog.'
- )
- _describe -t backends 'vault audit backends' backends && ret=0
- ;;
- backendconfig)
- case ${line[1]} in
- file)
- _values -w "Audit Backend File" \
- 'path[(required) - The path to where the file will be written. If this path exists, the audit backend will append to it.]:file:_files' \
- 'log_raw[(optional) Should security sensitive information be logged raw. Defaults to "false".]:log_raw:(true false)' && ret=0
- ;;
- syslog)
- _values -w "Audit Backend Syslog" \
- 'facility[(optional) - The syslog facility to use. Defaults to "AUTH".]:facility:(kern user mail daemon auth syslog lpr news uucp authpriv ftp cron local0 local1 local2 local3 local4 local5 local6 local7)' \
- 'tag[(optional) - The syslog tag to use. Defaults to "vault".]:tag:' \
- 'log_raw[(optional) Should security sensitive information be logged raw.]:log_raw:(true false)' && ret=0
- ;;
- esac
- ;;
- esac
-}
-
-_vault_auth() {
- _arguments : \
- ${general_args[@]} \
- ${auth_args[@]} && ret=0
-}
-
-_vault_auth-enable() {
- _arguments : \
- ${general_args[@]} \
- ${auth_enable_args[@]} \
- ':::(cert ldap github userpass app-id)' && ret=0
-}
-
-__vault_auth_methods() {
- local -a authmethods
- authmethods=($(vault auth -methods | awk 'NR>1{split ($1,a,"/"); print a[1]":["$2"]"}'))
- _describe -t authmethods 'authmethods' authmethods && ret=0
-}
-
-_vault_auth-disable() {
- _arguments : \
- ${general_args[@]} \
- ':::__vault_auth_methods' && ret=0
-
-}
-
-_vault_init() {
- _arguments : \
- ${general_args[@]} \
- ${init_args[@]} && ret=0
-}
-
-_vault_key-status() {
- _arguments : \
- ${general_args[@]} && ret=0
-}
-
-__vault_mounts() {
- local -a mounts
- mounts=($(vault mounts | awk 'NR>1{split ($1,a,"/"); print a[1]":["$2"]"}'))
- _describe -t mounts 'mounts' mounts && ret=0
-}
-
-_vault_mounts() {
- _arguments : \
- ${general_args[@]} && ret=0
-}
-
-_vault_mount() {
- # to find out how many types of backends are there
- _arguments : \
- ${general_args[@]} \
- ${mount_args[@]} \
- ':::(generic ssh)' && ret=0
-}
-
-_vault_mount-tune() {
- _arguments : \
- ${general_args[@]} \
- ${mount_tune_args[@]} \
- ':::__vault_mounts' && ret=0
-}
-
-_vault_unmount() {
- _arguments : \
- ${general_args[@]} \
- ':::__vault_mounts' && ret=0
-}
-
-_vault_remount() {
- _arguments : \
- ${general_args[@]} \
- ':::__vault_mounts' \
- ':::' && ret=0
-}
-
-__vault_policies() {
- local -a policies
- policies=($(vault policies | awk '{print $1":["$1"]"}'))
- _describe -t policies 'policies' policies && ret=0
-}
-
-_vault_policies() {
- _arguments : \
- ${general_args[@]} \
- ':::__vault_policies' && ret=0
-}
-
-_vault_policy-delete() {
- _arguments : \
- ${general_args[@]} \
- ':::__vault_policies' && ret=0
-}
-
-_vault_policy-write() {
- _arguments : \
- ${general_args[@]} \
- ': ::' \
- '::policy:_files' && ret=0
-}
-
-_vault_status() {
- _arguments : \
- ${general_args[@]} && ret=0
-}
-
-_vault_rekey() {
- _arguments : \
- ${general_args[@]} \
- ${rekey_args[@]} \
- ': ::' && ret=0
-}
-
-_vault_rotate() {
- _arguments : \
- ${general_args[@]} && ret=0
-}
-
-_vault_seal() {
- _arguments : \
- ${general_args[@]} && ret=0
-}
-
-_vault_ssh() {
- _arguments : \
- ${general_args[@]} \
- ${ssh_args[@]} \
- ': ::' && ret=0
-}
-
-_vault_token-create() {
- _arguments : \
- ${general_args[@]} \
- ${token_create_args[@]} && ret=0
-}
-
-_vault_token-renew() {
- _arguments : \
- ${general_args[@]} \
- '(-format)-format=-[The format for output. By default it is a whitespace-delimited table. This can also be json.]:format:(json table)' \
- ': ::' \
- ': ::' && ret=0
-}
-
-_vault_token-revoke() {
- _arguments : \
- ${general_args[@]} \
- '(-mode)-mode=-[The type of revocation to do. See the documentation above for more information.]:mode:( orphan path)' \
- ': ::' && ret=0
-}
-
-_vault_unseal() {
- _arguments : \
- ${general_args[@]} \
- '(-reset)-reset[Reset the unsealing process by throwing away prior keys in process to unseal the vault.]:reset:' \
- ': ::' && ret=0
-}
-
-_vault_version() {
- # no args
-}
-
-_vault_delete() {
- _arguments : \
- ${general_args[@]} \
- ': ::' && ret=0
-}
-
-_vault_path-help() {
- _arguments : \
- ${general_args[@]} \
- ': ::' && ret=0
-}
-
-_vault_revoke() {
- _arguments : \
- ${general_args[@]} \
- '(-format)-format=-[The format for output. By default it is a whitespace-delimited table. This can also be json.]:format:(json table)' \
- ': ::' \
- ': ::' && ret=0
-}
-
-_vault_server() {
- _arguments : \
- ${server_args[@]} && ret=0
-
-}
-
-_vault_write() {
- _arguments : \
- ${general_args[@]} \
- '(-f -force)'{-f,-force}'[Force the write to continue without any data values specified. This allows writing to keys that do not need or expect any fields to be specified.]:force:' \
- ': ::' \
- ': ::' && ret=0
-}
-
-_vault_read() {
- _arguments : \
- ${general_args[@]} \
- '(-format)-format=-[The format for output. By default it is a whitespace-delimited table. This can also be json.]:format:(json table)' \
- '(-field)-field=-[If included, the raw value of the specified field will be output raw to stdout.]:field:' \
- ': ::' && ret=0
-}
-
-_vault_commands() {
- local -a commands
-
- commands=(
- "delete":"Delete operation on secrets in Vault"
- "path-help":"Look up the help for a path"
- "read":"Read data or secrets from Vault"
- "renew":"Renew the lease of a secret"
- "revoke":"Revoke a secret"
- "server":"Start a Vault server"
- "status":"Outputs status of whether Vault is sealed and if HA mode is enabled"
- "write":"Write secrets or configuration into Vault"
- "audit-disable":"Disable an audit backend"
- "audit-enable":"Enable an audit backend"
- "audit-list":"Lists enabled audit backends in Vault"
- "auth":"Prints information about how to authenticate with Vault"
- "auth-disable":"Disable an auth provider"
- "auth-enable":"Enable a new auth provider"
- "init":"Initialize a new Vault server"
- "key-status":"Provides information about the active encryption key"
- "mount":"Mount a logical backend"
- "mount-tune":"Tune mount configuration parameters"
- "mounts":"Lists mounted backends in Vault"
- "policies":"List the policies on the server"
- "policy-delete":"Delete a policy from the server"
- "policy-write":"Write a policy to the server"
- "rekey":"Rekeys Vault to generate new unseal keys"
- "remount":"Remount a secret backend to a new path"
- "rotate":"Rotates the backend encryption key used to persist data"
- "seal":"Seals the vault server"
- "ssh":"Initiate a SSH session"
- "token-create":"Create a new auth token"
- "token-renew":"Renew an auth token if there is an associated lease"
- "token-revoke":"Revoke one or more auth tokens"
- "unmount":"Unmount a secret backend"
- "unseal":"Unseals the vault server"
- "version":"Prints the Vault version"
- )
-
- _describe -t commands 'vault command' commands && ret=0
-}
-
-local curcontext=$curcontext ret=1
-_arguments : \
- ${main_args[@]} \
- '*:: :->subcommands' && ret=0
-if ((CURRENT == 1 )); then
- _vault_commands && ret=0
-fi
-if [[ $state == subcommands ]]; then
- # (( CURRENT -- ))
- curcontext="${curcontext%:*:*}:vault-$words[1]:"
- _call_function ret _vault_$words[1]
-fi
diff --git a/plugins/vault/vault.plugin.zsh b/plugins/vault/vault.plugin.zsh
new file mode 100644
index 000000000..996cd12ad
--- /dev/null
+++ b/plugins/vault/vault.plugin.zsh
@@ -0,0 +1,7 @@
+# Completion
+if (( ! $+commands[vault] )); then
+ return
+fi
+
+autoload -Uz bashcompinit && bashcompinit
+complete -o nospace -C vault vault
diff --git a/plugins/vi-mode/README.md b/plugins/vi-mode/README.md
index 84ba30105..bc78cfa3d 100644
--- a/plugins/vi-mode/README.md
+++ b/plugins/vi-mode/README.md
@@ -46,7 +46,7 @@ hasn't been defined by theme, *Insert mode* is not displayed by default.
You can change these indicators by setting the `MODE_INDICATOR` (*Normal mode*) and
`INSERT_MODE_INDICATORS` (*Insert mode*) variables.
-This settings support Prompt Expansion sequences. For example:
+These settings support Prompt Expansion sequences. For example:
```zsh
MODE_INDICATOR="%F{white}+%f"
@@ -55,7 +55,7 @@ INSERT_MODE_INDICATOR="%F{yellow}+%f"
### Adding mode indicators to your prompt
-`Vi-mode` by default will add mode indicators to `RPROMPT` **unless** that is defined by
+`Vi-mode` by default will add mode indicators to `RPROMPT` **unless** that is defined by
a preceding plugin.
If `PROMPT` or `RPROMPT` is not defined to your liking, you can add mode info manually. The `vi_mode_prompt_info` function is available to insert mode indicator information.
@@ -157,6 +157,27 @@ NOTE: delete/kill commands (`dd`, `D`, `c{motion}`, `C`, `x`,`X`) and yank comma
(`y`, `Y`) will copy to the clipboard. Contents can then be put back using paste commands
(`P`, `p`).
+## Text objects
+
+Standard text objects are supported with `i` ("inside") and `a` ("around"), e.g., for words; thus, you can select the word the cursor is in with `viw`, or delete the current word, including surrounding spaces, with `daw`.
+
+For other text objects, you can rely on the built-in functionality of Zsh and enable it accordingly.
+For example, for quoted strings, you can copy the commented snippet of <https://sourceforge.net/p/zsh/code/ci/master/tree/Functions/Zle/select-quoted>: place this in your `.zsrhc` file, e.g., after sourcing oh-my-zsh:
+
+```sh
+autoload -U select-quoted
+zle -N select-quoted
+for m in visual viopp; do
+ for c in {a,i}{\',\",\`}; do
+ bindkey -M $m $c select-quoted
+ done
+done
+```
+
+Now, in normal mode, you can select everything inside a double-quoted string with `vi"`.
+Note that this works even if you're not already inside a quoted string.
+For example, you can replace everything inside a single-quoted string in the current line, from wherever the cursor is, with `ci'`.
+
## Known issues
### Low `$KEYTIMEOUT`
diff --git a/plugins/vi-mode/vi-mode.plugin.zsh b/plugins/vi-mode/vi-mode.plugin.zsh
index 5c104f7bb..85208cfc9 100644
--- a/plugins/vi-mode/vi-mode.plugin.zsh
+++ b/plugins/vi-mode/vi-mode.plugin.zsh
@@ -18,12 +18,12 @@ typeset -g VI_MODE_SET_CURSOR
# if $VI_MODE_SET_CURSOR=true.
#
# See https://vt100.net/docs/vt510-rm/DECSCUSR for cursor styles
-typeset -g VI_MODE_CURSOR_NORMAL=2
-typeset -g VI_MODE_CURSOR_VISUAL=6
-typeset -g VI_MODE_CURSOR_INSERT=6
-typeset -g VI_MODE_CURSOR_OPPEND=0
+typeset -g VI_MODE_CURSOR_NORMAL=${VI_MODE_CURSOR_NORMAL:=2}
+typeset -g VI_MODE_CURSOR_VISUAL=${VI_MODE_CURSOR_VISUAL:=6}
+typeset -g VI_MODE_CURSOR_INSERT=${VI_MODE_CURSOR_INSERT:=6}
+typeset -g VI_MODE_CURSOR_OPPEND=${VI_MODE_CURSOR_OPPEND:=0}
-typeset -g VI_KEYMAP=main
+typeset -g VI_KEYMAP=${VI_KEYMAP:=main}
function _vi-mode-set-cursor-shape-for-keymap() {
[[ "$VI_MODE_SET_CURSOR" = true ]] || return
@@ -162,9 +162,7 @@ if [[ -z "${VI_MODE_DISABLE_CLIPBOARD:-}" ]]; then
fi
# if mode indicator wasn't setup by theme, define default, we'll leave INSERT_MODE_INDICATOR empty by default
-if [[ -z "$MODE_INDICATOR" ]]; then
- MODE_INDICATOR='%B%F{red}<%b<<%f'
-fi
+typeset -g MODE_INDICATOR=${MODE_INDICATOR:='%B%F{red}<%b<<%f'}
function vi_mode_prompt_info() {
echo "${${VI_KEYMAP/vicmd/$MODE_INDICATOR}/(main|viins)/$INSERT_MODE_INDICATOR}"
diff --git a/plugins/vim-interaction/README.md b/plugins/vim-interaction/README.md
index 681648018..437b48d99 100644
--- a/plugins/vim-interaction/README.md
+++ b/plugins/vim-interaction/README.md
@@ -1,22 +1,22 @@
# Vim Interaction #
+The idea for this script is to give you some decent interaction with a running
+GVim session. Normally you'll be running around your filesystem doing any
+number of amazing things and you'll need to load some files into GVim for
+editing, inspecting, destruction, or other bits of mayhem. This script lets you
+do that.
+
+## Usage
+
The plugin presents a function called `callvim` whose usage is:
usage: callvim [-b cmd] [-a cmd] [file ... fileN]
-
+
-b cmd Run this command in GVIM before editing the first file
-a cmd Run this command in GVIM after editing the first file
file The file to edit
... fileN The other files to add to the argslist
-## Rationale ##
-
-The idea for this script is to give you some decent interaction with a running
-GVim session. Normally you'll be running around your filesystem doing any
-number of amazing things and you'll need to load some files into GVim for
-editing, inspecting, destruction, or other bits of mayhem. This script lets you
-do that.
-
## Aliases ##
There are a few aliases presented as well:
diff --git a/plugins/vim-interaction/vim-interaction.plugin.zsh b/plugins/vim-interaction/vim-interaction.plugin.zsh
index b73f9b4da..a12b52bd5 100644
--- a/plugins/vim-interaction/vim-interaction.plugin.zsh
+++ b/plugins/vim-interaction/vim-interaction.plugin.zsh
@@ -2,7 +2,7 @@
# See README.md
#
# Derek Wyatt (derek@{myfirstnamemylastname}.org
-#
+#
function callvim {
if [[ $# == 0 ]]; then
diff --git a/plugins/virtualenv/virtualenv.plugin.zsh b/plugins/virtualenv/virtualenv.plugin.zsh
index 56707bb98..e339ef956 100644
--- a/plugins/virtualenv/virtualenv.plugin.zsh
+++ b/plugins/virtualenv/virtualenv.plugin.zsh
@@ -1,6 +1,6 @@
function virtualenv_prompt_info(){
[[ -n ${VIRTUAL_ENV} ]] || return
- echo "${ZSH_THEME_VIRTUALENV_PREFIX=[}${VIRTUAL_ENV:t:gs/%/%%}${ZSH_THEME_VIRTUALENV_SUFFIX=]}"
+ echo "${ZSH_THEME_VIRTUALENV_PREFIX=[}${VIRTUAL_ENV_PROMPT:-${VIRTUAL_ENV:t:gs/%/%%}}${ZSH_THEME_VIRTUALENV_SUFFIX=]}"
}
# disables prompt mangling in virtual_env/bin/activate
diff --git a/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh b/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh
index d359e0c21..1a3ae37b8 100644
--- a/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh
+++ b/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh
@@ -52,7 +52,7 @@ if [[ ! $DISABLE_VENV_CD -eq 1 ]]; then
else
ENV_NAME=""
fi
-
+
if [[ -n $CD_VIRTUAL_ENV && "$ENV_NAME" != "$CD_VIRTUAL_ENV" ]]; then
# We've just left the repo, deactivate the environment
# Note: this only happens if the virtualenv was activated automatically
@@ -88,4 +88,5 @@ if [[ ! $DISABLE_VENV_CD -eq 1 ]]; then
# http://zsh.sourceforge.net/Doc/Release/Functions.html
autoload -U add-zsh-hook
add-zsh-hook chpwd workon_cwd
+ [[ $PWD != ~ ]] && workon_cwd
fi
diff --git a/plugins/volta/volta.plugin.zsh b/plugins/volta/volta.plugin.zsh
index ab05ed5df..173b9c871 100644
--- a/plugins/volta/volta.plugin.zsh
+++ b/plugins/volta/volta.plugin.zsh
@@ -4,7 +4,7 @@ if (( ! $+commands[volta] )); then
fi
# If the completion file doesn't exist yet, we need to autoload it and
-# bind it to `deno`. Otherwise, compinit will have already done that.
+# bind it to `volta`. Otherwise, compinit will have already done that.
if [[ ! -f "$ZSH_CACHE_DIR/completions/_volta" ]]; then
typeset -g -A _comps
autoload -Uz _volta
diff --git a/plugins/vscode/README.md b/plugins/vscode/README.md
index 726b23d35..7c746d3d3 100644
--- a/plugins/vscode/README.md
+++ b/plugins/vscode/README.md
@@ -1,6 +1,6 @@
# VS Code
-This plugin provides useful aliases to simplify the interaction between the command line and VS Code or VSCodium editor.
+This plugin provides useful aliases to simplify the interaction between the command line and VS Code, VSCodium, or Cursor editor.
To start using it, add the `vscode` plugin to your `plugins` array in `~/.zshrc`:
@@ -14,31 +14,40 @@ This plugin requires to have a flavour of VS Code installed and it's executable
You can install either:
-* VS Code (code)
-* VS Code Insiders (code-insiders)
-* VSCodium (codium)
+- VS Code (code)
+- VS Code Insiders (code-insiders)
+- VSCodium (codium)
+- Cursor (cursor)
### MacOS
+
While Linux installations will add the executable to PATH, MacOS users might still have to do this manually:
-[For VS Code and VS Code Insiders](https://code.visualstudio.com/docs/setup/mac#_launching-from-the-command-line), open
-the Command Palette via (F1 or ⇧⌘P) and type shell command to find the Shell Command:
+[For VS Code and VS Code Insiders](https://code.visualstudio.com/docs/setup/mac#_launching-from-the-command-line),
+open the Command Palette via (F1 or ⇧⌘P) and type shell command to find the Shell Command:
+
> Shell Command: Install 'code' command in PATH
-[For VSCodium](https://github.com/VSCodium/vscodium/blob/master/DOCS.md#how-do-i-open-vscodium-from-the-terminal), open
-the Command Palette via (F1 or ⇧⌘P) and type shell command to find the Shell Command:
+[For VSCodium](https://github.com/VSCodium/vscodium/blob/master/DOCS.md#how-do-i-open-vscodium-from-the-terminal),
+open the Command Palette via (F1 or ⇧⌘P) and type shell command to find the Shell Command:
+
> Shell Command: Install 'codium' command in PATH
+For Cursor, open the Command Palette via (F1 or ⌘⇧P) and type shell command to find the Shell Command:
+
+> Shell Command: Install 'cursor' command in PATH
+
## Using multiple flavours
-If for any reason, you ever require to use multiple flavours of VS Code i.e. VS Code (stable) and VS Code Insiders, you can
-manually specify the flavour's executable. Add the following line to the .zshrc file (between the `ZSH_THEME` and the `plugins=()` lines).
-This will make the plugin use your manually defined executable.
+If for any reason, you ever require to use multiple flavours of VS Code i.e. VS Code (stable) and VS Code
+Insiders, you can manually specify the flavour's executable. Add the following line to the .zshrc file
+(between the `ZSH_THEME` and the `plugins=()` lines). This will make the plugin use your manually defined
+executable.
```zsh
ZSH_THEME=...
-# Choose between one [code, code-insiders or codium]
+# Choose between one [code, code-insiders, codium, or cursor]
# The following line will make the plugin to open VS Code Insiders
# Invalid entries will be ignored, no aliases will be added
VSCODE=code-insiders
@@ -61,6 +70,7 @@ source $ZSH/oh-my-zsh.sh
| vscr | code --reuse-window | Force to open a file or folder in the last active window. |
| vscw | code --wait | Wait for the files to be closed before returning. |
| vscu `dir` | code --user-data-dir `dir` | Specifies the directory that user data is kept in. Can be used to open multiple distinct instances of Code. |
+| vscp `profile` | code --profile `profile` | Specifies the profile to open Code with. |
## Extensions aliases
diff --git a/plugins/vscode/vscode.plugin.zsh b/plugins/vscode/vscode.plugin.zsh
index 356c62360..1635a9832 100644
--- a/plugins/vscode/vscode.plugin.zsh
+++ b/plugins/vscode/vscode.plugin.zsh
@@ -1,8 +1,9 @@
-# VS Code (stable / insiders) / VSCodium zsh plugin
+# VS Code (stable / insiders) / VSCodium / Cursor zsh plugin
# Authors:
# https://github.com/MarsiBarsi (original author)
# https://github.com/babakks
# https://github.com/SteelShot
+# https://github.com/AliSajid
# Verify if any manual user choice of VS Code exists first.
if [[ -n "$VSCODE" ]] && ! which $VSCODE &>/dev/null; then
@@ -18,6 +19,8 @@ if [[ -z "$VSCODE" ]]; then
VSCODE=code-insiders
elif which codium &>/dev/null; then
VSCODE=codium
+ elif which cursor &>/dev/null; then
+ VSCODE=cursor
else
return
fi
@@ -38,6 +41,7 @@ alias vscn="$VSCODE --new-window"
alias vscr="$VSCODE --reuse-window"
alias vscw="$VSCODE --wait"
alias vscu="$VSCODE --user-data-dir"
+alias vscp="$VSCODE --profile"
alias vsced="$VSCODE --extensions-dir"
alias vscie="$VSCODE --install-extension"
diff --git a/plugins/wd/README.md b/plugins/wd/README.md
index 1d1980632..1240afe57 100644
--- a/plugins/wd/README.md
+++ b/plugins/wd/README.md
@@ -57,6 +57,21 @@ wd() {
}
```
+### [Home Manager](https://github.com/nix-community/home-manager)
+
+Add the following to your `home.nix` then run `home-manager switch`:
+
+```nix
+programs.zsh.plugins = [
+ {
+ name = "wd";
+ src = pkgs.zsh-wd;
+ file = "share/wd/wd.plugin.zsh";
+ completions = [ "share/zsh/site-functions" ];
+ }
+];
+```
+
### [zplug](https://github.com/zplug/zplug)
```zsh
@@ -97,9 +112,11 @@ wd() {
3. Install manpage (optional):
+Move manpage into an appropriate directory, then trigger `mandb` to discover it
+
```zsh
-sudo cp ~/.local/wd/wd.1 /usr/share/man/man1/wd.1
-sudo chmod 644 /usr/share/man/man1/wd.1
+sudo install -m 644 ~/.local/wd/wd.1 /usr/share/man/man1/wd.1
+sudo mandb /usr/share/man/man1
```
**Note:** when pulling and updating `wd`, you'll need to repeat step 3 should the manpage change
@@ -119,6 +136,15 @@ Also, you may have to force a rebuild of `zcompdump` by running:
rm -f ~/.zcompdump; compinit
```
+## Browse
+
+`wd` comes with an `fzf`-powered browse feature to fuzzy search through all your warp points. It's available through the `wd browse` command. For quick access you can set up an alias or keybind in your `.zshrc`:
+
+```zsh
+# ctrl-b to open the fzf browser
+bindkey ${FZF_WD_BINDKEY:-'^B'} wd_browse_widget
+```
+
## Usage
* Add warp point to current working directory:
@@ -132,6 +158,19 @@ If a warp point with the same name exists, use `wd add foo --force` to overwrite
**Note:** a warp point cannot contain colons, or consist of only spaces and dots.
The first will conflict in how `wd` stores the warp points, and the second will conflict with other features, as below.
+* Add warp point to any directory with default name:
+
+```zsh
+wd addcd /foo/ bar
+```
+
+* Add warp point to any directory with a custom name:
+
+```zsh
+wd addcd /foo/
+```
+
+
You can omit point name to automatically use the current directory's name instead.
* From any directory, warp to `foo` with:
@@ -216,12 +255,6 @@ wd --version
wd --config ./file <command>
```
-* Force `exit` with return code after running. This is not default, as it will *exit your terminal*, though required for testing/debugging.
-
-```zsh
-wd --debug <command>
-```
-
* Silence all output:
```zsh
diff --git a/plugins/wd/_wd.sh b/plugins/wd/_wd.sh
index 8d5cf15a2..7c416086d 100644
--- a/plugins/wd/_wd.sh
+++ b/plugins/wd/_wd.sh
@@ -31,11 +31,13 @@ function _wd() {
commands=(
'add:Adds the current working directory to your warp points'
+ 'addcd:Adds a directory to your warp points'
'add!:Overwrites existing warp point'
'export:Export warp points as static named directories'
'rm:Removes the given warp point'
'list:Outputs all stored warp points'
'ls:Show files from given warp point'
+ 'open:Open warp point in the default file explorer'
'path:Show path to given warp point'
'show:Outputs all warp points that point to the current directory or shows a specific target directory for a point'
'help:Show this extremely helpful text'
@@ -63,12 +65,18 @@ function _wd() {
add)
_message 'Write the name of your warp point' && ret=0
;;
+ addcd)
+ _message 'Write the name of your path' && ret=0
+ ;;
show)
_describe -t points "Warp points" warp_points && ret=0
;;
ls)
_describe -t points "Warp points" warp_points && ret=0
;;
+ open)
+ _describe -t points "Warp points" warp_points && ret=0
+ ;;
path)
_describe -t points "Warp points" warp_points && ret=0
;;
@@ -77,7 +85,7 @@ function _wd() {
# complete sub directories from the warp point
_path_files -W "(${points[$target]})" -/ && ret=0
fi
-
+
# don't complete anything if warp point is not valid
;;
esac
diff --git a/plugins/wd/wd.plugin.zsh b/plugins/wd/wd.plugin.zsh
index ca2ca7c65..2397e6f31 100644
--- a/plugins/wd/wd.plugin.zsh
+++ b/plugins/wd/wd.plugin.zsh
@@ -1,4 +1,4 @@
-#!/bin/zsh
+#!/usr/bin/env zsh
# WARP DIRECTORY
# ==============
@@ -8,8 +8,13 @@
# @github.com/mfaerevaag/wd
# Handle $0 according to the standard:
-# https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html
+# # https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html
0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
0="${${(M)0:#/*}:-$PWD/$0}"
eval "wd() { source '${0:A:h}/wd.sh' }"
+wd > /dev/null
+zle -N wd_browse_widget
+zle -N wd_restore_buffer
+autoload -Uz add-zle-hook-widget
+add-zle-hook-widget line-init wd_restore_buffer
diff --git a/plugins/wd/wd.sh b/plugins/wd/wd.sh
index 840e92d61..56c029252 100644..100755
--- a/plugins/wd/wd.sh
+++ b/plugins/wd/wd.sh
@@ -1,4 +1,4 @@
-#!/bin/zsh
+#!/usr/bin/env zsh
# WARP DIRECTORY
# ==============
@@ -8,7 +8,7 @@
# @github.com/mfaerevaag/wd
# version
-readonly WD_VERSION=0.5.0
+readonly WD_VERSION=0.10.1
# colors
readonly WD_BLUE="\033[96m"
@@ -57,12 +57,11 @@ wd_print_msg()
{
if [[ -z $wd_quiet_mode ]]
then
- local color=$1
- local msg=$2
+ local color="${1:-$WD_BLUE}" # Default to blue if no color is provided
+ local msg="$2"
- if [[ $color == "" || $msg == "" ]]
- then
- print " ${WD_RED}*${WD_NOC} Could not print message. Sorry!"
+ if [[ -z "$msg" ]]; then
+ print "${WD_RED}*${WD_NOC} Could not print message. Sorry!"
else
print " ${color}*${WD_NOC} ${msg}"
fi
@@ -75,21 +74,23 @@ wd_print_usage()
Usage: wd [command] [point]
Commands:
- <point> Warps to the directory specified by the warp point
- <point> <path> Warps to the directory specified by the warp point with path appended
- add <point> Adds the current working directory to your warp points
- add Adds the current working directory to your warp points with current directory's name
- rm <point> Removes the given warp point
- rm Removes the given warp point with current directory's name
- show <point> Print path to given warp point
- show Print warp points to current directory
- list Print all stored warp points
- ls <point> Show files from given warp point (ls)
- path <point> Show the path to given warp point (pwd)
- clean Remove points warping to nonexistent directories (will prompt unless --force is used)
+ <point> Warps to the directory specified by the warp point
+ <point> <path> Warps to the directory specified by the warp point with path appended
+ add <point> Adds the current working directory to your warp points
+ add Adds the current working directory to your warp points with current directory's name
+ addcd <path> Adds a path to your warp points with the directory's name
+ addcd <path> <point> Adds a path to your warp points with a custom name
+ rm <point> Removes the given warp point
+ rm Removes the given warp point with current directory's name
+ show <point> Print path to given warp point
+ show Print warp points to current directory
+ list Print all stored warp points
+ ls <point> Show files from given warp point (ls)
+ open <point> Open the warp point in the default file explorer (open / xdg-open)
+ path <point> Show the path to given warp point (pwd)
+ clean Remove points warping to nonexistent directories (will prompt unless --force is used)
-v | --version Print version
- -d | --debug Exit after execution with exit codes (for testing)
-c | --config Specify config file (default ~/.warprc)
-q | --quiet Suppress all output
-f | --force Allows overwriting without warning (for add & clean)
@@ -145,14 +146,17 @@ wd_warp()
else
(( n = $#1 - 1 ))
cd -$n > /dev/null
+ WD_EXIT_CODE=$?
fi
elif [[ ${points[$point]} != "" ]]
then
if [[ $sub != "" ]]
then
cd ${points[$point]/#\~/$HOME}/$sub
+ WD_EXIT_CODE=$?
else
cd ${points[$point]/#\~/$HOME}
+ WD_EXIT_CODE=$?
fi
else
wd_exit_fail "Unknown warp point '${point}'"
@@ -170,6 +174,11 @@ wd_add()
point=$(basename "$PWD")
fi
+ if [ ! -w "$wd_config_file" ]; then
+ wd_exit_fail "\'$wd_config_file\' is not writeable."
+ return
+ fi
+
if [[ $point =~ "^[\.]+$" ]]
then
wd_exit_fail "Warp point cannot be just dots"
@@ -185,11 +194,11 @@ wd_add()
elif [[ ${points[$point]} == "" ]] || [ ! -z "$force" ]
then
wd_remove "$point" > /dev/null
- printf "%q:%s\n" "${point}" "${PWD/#$HOME/~}" >> "$WD_CONFIG"
+ printf "%q:%s\n" "${point}" "${PWD/#$HOME/~}" >> "$wd_config_file"
if (whence sort >/dev/null); then
local config_tmp=$(mktemp "${TMPDIR:-/tmp}/wd.XXXXXXXXXX")
- # use 'cat' below to ensure we respect $WD_CONFIG as a symlink
- command sort -o "${config_tmp}" "$WD_CONFIG" && command cat "${config_tmp}" >| "$WD_CONFIG" && command rm "${config_tmp}"
+ # use 'cat' below to ensure we respect $wd_config_file as a symlink
+ command sort -o "${config_tmp}" "$wd_config_file" && command cat "${config_tmp}" >| "$wd_config_file" && command rm "${config_tmp}"
fi
wd_export_static_named_directories
@@ -204,6 +213,28 @@ wd_add()
fi
}
+wd_addcd() {
+ local folder="$1"
+ local point=$2
+ local force=$3
+ local currentdir=$PWD
+
+ if [[ -z "$folder" ]]; then
+ wd_exit_fail "You must specify a path"
+ return
+ fi
+
+ if [[ ! -d "$folder" ]]; then
+ wd_exit_fail "The directory does not exist"
+ return
+ fi
+
+ cd "$folder" || return
+ wd_add "$point" "$force"
+ cd "$currentdir" || return
+}
+
+
wd_remove()
{
local point_list=$1
@@ -213,12 +244,17 @@ wd_remove()
point_list=$(basename "$PWD")
fi
+ if [ ! -w "$wd_config_file" ]; then
+ wd_exit_fail "\'$wd_config_file\' is not writeable."
+ return
+ fi
+
for point_name in $point_list ; do
if [[ ${points[$point_name]} != "" ]]
then
local config_tmp=$(mktemp "${TMPDIR:-/tmp}/wd.XXXXXXXXXX")
# Copy and delete in two steps in order to preserve symlinks
- if sed -n "/^${point_name}:.*$/!p" "$WD_CONFIG" >| "$config_tmp" && command cp "$config_tmp" "$WD_CONFIG" && command rm "$config_tmp"
+ if sed -n "/^${point_name}:.*$/!p" "$wd_config_file" >| "$config_tmp" && command cp "$config_tmp" "$wd_config_file" && command rm "$config_tmp"
then
wd_print_msg "$WD_GREEN" "Warp point removed"
else
@@ -230,11 +266,92 @@ wd_remove()
done
}
+wd_browse() {
+ # Check if fzf is installed
+ if ! command -v fzf >/dev/null; then
+ wd_print_msg "$WD_RED" "This functionality requires fzf. Please install fzf first."
+ return 1
+ fi
+
+ # Ensure wd_config_file is properly set
+ if [[ -z $wd_config_file ]]; then
+ wd_config_file="${WD_CONFIG:-$HOME/.warprc}"
+ fi
+
+ # Check if config file exists
+ if [[ ! -f $wd_config_file ]]; then
+ wd_print_msg "$WD_RED" "Config file $wd_config_file does not exist. Please create it first."
+ return 1
+ fi
+
+ # Read entries from the config file
+ local entries=("${(@f)$(sed "s:${HOME}:~:g" "$wd_config_file" | awk -F ':' '{print $1 " -> " $2}')}")
+ if [[ -z $entries ]]; then
+ wd_print_msg "$WD_YELLOW" "You don't have any warp points to browse"
+ return 1
+ fi
+
+ # Temp file for remove operations
+ local script_path="${${(%):-%x}:h}"
+ local wd_remove_output=$(mktemp "${TMPDIR:-/tmp}/wd.XXXXXXXXXX")
+
+ # Create fzf bindings
+ entries=("All warp points:" "Press enter to select. Press delete to remove" "${entries[@]}")
+ local fzf_bind="delete:execute(echo {} | awk -F ' -> ' '{print \$1}' | xargs -I {} \"$script_path/wd.sh\" rm {} > \"$wd_remove_output\")+abort"
+
+ # Run fzf
+ local selected_entry=$(printf '%s\n' "${entries[@]}" | fzf --height 100% --reverse --header-lines=2 --bind="$fzf_bind")
+
+ # Handle selection
+ if [[ -e $wd_remove_output ]]; then
+ cat "$wd_remove_output"
+ rm -f "$wd_remove_output"
+ fi
+
+ if [[ -n $selected_entry ]]; then
+ local selected_point="${selected_entry%% ->*}"
+ selected_point=$(echo "$selected_point" | xargs)
+ wd $selected_point
+ fi
+}
+
+wd_browse_widget() {
+ # Ensure wd_config_file is properly set
+ if [[ -z $wd_config_file ]]; then
+ wd_config_file="${WD_CONFIG:-$HOME/.warprc}"
+ fi
+
+ # Check if config file exists
+ if [[ ! -f $wd_config_file ]]; then
+ wd_print_msg "$WD_RED" "Config file $wd_config_file does not exist. Please create it first."
+ return 1
+ fi
+
+ # Call wd_browse to handle the selection
+ wd_browse
+
+ # Restore the zsh buffer and cursor after running wd_browse
+ saved_buffer=$BUFFER
+ saved_cursor=$CURSOR
+ BUFFER=
+ zle redisplay
+ zle accept-line
+}
+
+wd_restore_buffer() {
+ if [[ -n $saved_buffer ]]; then
+ BUFFER=$saved_buffer
+ CURSOR=$saved_cursor
+ fi
+ saved_buffer=
+ saved_cursor=1
+}
+
wd_list_all()
{
wd_print_msg "$WD_BLUE" "All warp points:"
- entries=$(sed "s:${HOME}:~:g" "$WD_CONFIG")
+ entries=$(sed "s:${HOME}:~:g" "$wd_config_file")
max_warp_point_length=0
while IFS= read -r line
@@ -271,6 +388,21 @@ wd_ls()
ls "${dir/#\~/$HOME}"
}
+wd_open()
+{
+ wd_getdir "$1"
+ if command -v open >/dev/null 2>&1; then
+ # MacOS, Ubuntu (alias)
+ open "${dir/#\~/$HOME}"
+ elif command -v xdg-open >/dev/null 2>&1; then
+ # Most Linux desktops
+ xdg-open "${dir/#\~/$HOME}"
+ else
+ echo "No known file opener found (need 'open' or 'xdg-open')." >&2
+ exit 1
+ fi
+}
+
wd_path()
{
wd_getdir "$1"
@@ -280,6 +412,7 @@ wd_path()
wd_show()
{
local name_arg=$1
+ local show_pwd
# if there's an argument we look up the value
if [[ -n $name_arg ]]
then
@@ -294,12 +427,12 @@ wd_show()
local wd_matches
wd_matches=()
# do a reverse lookup to check whether PWD is in $points
- PWD="${PWD/$HOME/~}"
- if [[ ${points[(r)$PWD]} == "$PWD" ]]
+ show_pwd="${PWD/$HOME/~}"
+ if [[ ${points[(r)$show_pwd]} == "$show_pwd" ]]
then
for name in ${(k)points}
do
- if [[ $points[$name] == "$PWD" ]]
+ if [[ $points[$name] == "$show_pwd" ]]
then
wd_matches[$(($#wd_matches+1))]=$name
fi
@@ -307,7 +440,7 @@ wd_show()
wd_print_msg "$WD_BLUE" "$#wd_matches warp point(s) to current directory: ${WD_GREEN}$wd_matches${WD_NOC}"
else
- wd_print_msg "$WD_YELLOW" "No warp point to $(echo "$PWD" | sed "s:$HOME:~:")"
+ wd_print_msg "$WD_YELLOW" "No warp point to $show_pwd"
fi
fi
}
@@ -317,6 +450,11 @@ wd_clean() {
local count=0
local wd_tmp=""
+ if [ ! -w "$wd_config_file" ]; then
+ wd_exit_fail "\'$wd_config_file\' is not writeable."
+ return
+ fi
+
while read -r line
do
if [[ $line != "" ]]
@@ -333,7 +471,7 @@ wd_clean() {
count=$((count+1))
fi
fi
- done < "$WD_CONFIG"
+ done < "$wd_config_file"
if [[ $count -eq 0 ]]
then
@@ -341,7 +479,7 @@ wd_clean() {
else
if [ ! -z "$force" ] || wd_yesorno "Removing ${count} warp points. Continue? (y/n)"
then
- echo "$wd_tmp" >! "$WD_CONFIG"
+ echo "$wd_tmp" >! "$wd_config_file"
wd_print_msg "$WD_GREEN" "Cleanup complete. ${count} warp point(s) removed"
else
wd_print_msg "$WD_BLUE" "Cleanup aborted"
@@ -352,16 +490,15 @@ wd_clean() {
wd_export_static_named_directories() {
if [[ ! -z $WD_EXPORT ]]
then
- command grep '^[0-9a-zA-Z_-]\+:' "$WD_CONFIG" | sed -e "s,~,$HOME," -e 's/:/=/' | while read -r warpdir ; do
+ command grep '^[0-9a-zA-Z_-]\+:' "$wd_config_file" | sed -e "s,~,$HOME," -e 's/:/=/' | while read -r warpdir ; do
hash -d "$warpdir"
done
fi
}
-local WD_CONFIG=${WD_CONFIG:-$HOME/.warprc}
+WD_CONFIG=${WD_CONFIG:-$HOME/.warprc}
local WD_QUIET=0
local WD_EXIT_CODE=0
-local WD_DEBUG=0
# Parse 'meta' options first to avoid the need to have them before
# other commands. The `-D` flag consumes recognized options so that
@@ -371,7 +508,6 @@ zparseopts -D -E \
c:=wd_alt_config -config:=wd_alt_config \
q=wd_quiet_mode -quiet=wd_quiet_mode \
v=wd_print_version -version=wd_print_version \
- d=wd_debug_mode -debug=wd_debug_mode \
f=wd_force_mode -force=wd_force_mode
if [[ ! -z $wd_print_version ]]
@@ -379,16 +515,19 @@ then
echo "wd version $WD_VERSION"
fi
+# set the config file from variable or default
+typeset wd_config_file=${WD_CONFIG:-$HOME/.warprc}
if [[ ! -z $wd_alt_config ]]
then
- WD_CONFIG=$wd_alt_config[2]
+ # prefer the flag if provided
+ wd_config_file=$wd_alt_config[2]
fi
# check if config file exists
-if [ ! -e "$WD_CONFIG" ]
+if [ ! -e "$wd_config_file" ]
then
# if not, create config file
- touch "$WD_CONFIG"
+ touch "$wd_config_file"
else
wd_export_static_named_directories
fi
@@ -396,7 +535,9 @@ fi
# disable extendedglob for the complete wd execution time
setopt | grep -q extendedglob
wd_extglob_is_set=$?
-(( ! $wd_extglob_is_set )) && setopt noextendedglob
+if (( wd_extglob_is_set == 0 )); then
+ setopt noextendedglob
+fi
# load warp points
typeset -A points
@@ -408,23 +549,15 @@ do
val=${(j,:,)arr[2,-1]}
points[$key]=$val
-done < "$WD_CONFIG"
+done < "$wd_config_file"
# get opts
-args=$(getopt -o a:r:c:lhs -l add:,rm:,clean,list,ls:,path:,help,show -- $*)
+args=$(getopt -o a:r:c:lhs -l add:,rm:,clean,list,ls:,open:,path:,help,show -- $*)
# check if no arguments were given, and that version is not set
if [[ ($? -ne 0 || $#* -eq 0) && -z $wd_print_version ]]
then
wd_print_usage
-
-# check if config file is writeable
-elif [ ! -w "$WD_CONFIG" ]
-then
- # do nothing
- # can't run `exit`, as this would exit the executing shell
- wd_exit_fail "\'$WD_CONFIG\' is not writeable."
-
else
# parse rest of options
local wd_o
@@ -436,6 +569,14 @@ else
wd_add "$2" "$wd_force_mode"
break
;;
+ "-b"|"browse")
+ wd_browse
+ break
+ ;;
+ "-c"|"--addcd"|"addcd")
+ wd_addcd "$2" "$3" "$wd_force_mode"
+ break
+ ;;
"-e"|"export")
wd_export_static_named_directories
break
@@ -453,6 +594,10 @@ else
wd_ls "$2"
break
;;
+ "-o"|"--open"|"open")
+ wd_open "$2"
+ break
+ ;;
"-p"|"--path"|"path")
wd_path "$2"
break
@@ -484,11 +629,14 @@ fi
# if not, next time warp will pick up variables from this run
# remember, there's no sub shell
-(( ! $wd_extglob_is_set )) && setopt extendedglob
+if (( wd_extglob_is_set == 0 )); then
+ setopt extendedglob
+fi
unset wd_extglob_is_set
unset wd_warp
unset wd_add
+unset wd_addcd
unset wd_remove
unset wd_show
unset wd_list_all
@@ -496,8 +644,10 @@ unset wd_print_msg
unset wd_yesorno
unset wd_print_usage
unset wd_alt_config
+#unset wd_config_file do not unset this - breaks keybind
unset wd_quiet_mode
unset wd_print_version
+unset wd_force_mode
unset wd_export_static_named_directories
unset wd_o
@@ -505,9 +655,4 @@ unset args
unset points
unset val &> /dev/null # fixes issue #1
-if [[ -n $wd_debug_mode ]]
-then
- exit $WD_EXIT_CODE
-else
- unset wd_debug_mode
-fi
+return $WD_EXIT_CODE
diff --git a/plugins/web-search/README.md b/plugins/web-search/README.md
index 6e4b4d7b8..8d74a08c0 100644
--- a/plugins/web-search/README.md
+++ b/plugins/web-search/README.md
@@ -45,16 +45,29 @@ Available search contexts are:
| `scholar` | `https://scholar.google.com/scholar?q=` |
| `ask` | `https://www.ask.com/web?q=` |
| `youtube` | `https://www.youtube.com/results?search_query=` |
+| `deepl` | `https://www.deepl.com/translator#auto/auto/` |
+| `dockerhub` | `https://hub.docker.com/search?q=` |
+| `gems` | `https://rubygems.org/search?query=` |
+| `npmpkg` | `https://www.npmjs.com/search?q=` |
+| `packagist` | `https://packagist.org/?query=` |
+| `gopkg` | `https://pkg.go.dev/search?m=package&q=` |
+| `chatgpt` | `https://chatgpt.com/?q=` |
+| `claudeai` | `https://claude.ai/new?q=` |
+| `grok` | `https://grok.com/?q=` |
+| `reddit` | `https://www.reddit.com/search/?q=` |
+| `ppai` | `https://www.perplexity.ai/search/new?q=` |
+| `rscrate` | `https://crates.io/search?q=` |
+| `rsdoc` | `https://docs.rs/releases/search?query=` |
Also there are aliases for bang-searching DuckDuckGo:
-| Context | Bang |
-| --------- | ----- |
-| `wiki` | `!w` |
-| `news` | `!n` |
-| `map` | `!m` |
-| `image` | `!i` |
-| `ducky` | `!` |
+| Context | Bang |
+| ------- | ---- |
+| `wiki` | `!w` |
+| `news` | `!n` |
+| `map` | `!m` |
+| `image` | `!i` |
+| `ducky` | `!` |
### Custom search engines
diff --git a/plugins/web-search/web-search.plugin.zsh b/plugins/web-search/web-search.plugin.zsh
index a8848fd95..93237f4e2 100644
--- a/plugins/web-search/web-search.plugin.zsh
+++ b/plugins/web-search/web-search.plugin.zsh
@@ -26,6 +26,19 @@ function web_search() {
scholar "https://scholar.google.com/scholar?q="
ask "https://www.ask.com/web?q="
youtube "https://www.youtube.com/results?search_query="
+ deepl "https://www.deepl.com/translator#auto/auto/"
+ dockerhub "https://hub.docker.com/search?q="
+ gems "https://rubygems.org/search?query="
+ npmpkg "https://www.npmjs.com/search?q="
+ packagist "https://packagist.org/?query="
+ gopkg "https://pkg.go.dev/search?m=package&q="
+ chatgpt "https://chatgpt.com/?q="
+ grok "https://grok.com/?q="
+ claudeai "https://claude.ai/new?q="
+ reddit "https://www.reddit.com/search/?q="
+ ppai "https://www.perplexity.ai/search/new?q="
+ rscrate "https://crates.io/search?q="
+ rsdoc "https://docs.rs/releases/search?query="
)
# check whether the search engine is supported
@@ -36,9 +49,14 @@ function web_search() {
# search or go to main page depending on number of arguments passed
if [[ $# -gt 1 ]]; then
+ # if search goes in the query string ==> space as +, otherwise %20
+ # see https://stackoverflow.com/questions/1634271/url-encoding-the-space-character-or-20
+ local param="-P"
+ [[ "$urls[$1]" == *\?*= ]] && param=""
+
# build search url:
# join arguments passed with '+', then append to search engine URL
- url="${urls[$1]}$(omz_urlencode ${@[2,-1]})"
+ url="${urls[$1]}$(omz_urlencode $param ${(s: :)@[2,-1]})"
else
# build main page url:
# split by '/', then rejoin protocol (1) and domain (2) parts with '//'
@@ -68,6 +86,19 @@ alias archive='web_search archive'
alias scholar='web_search scholar'
alias ask='web_search ask'
alias youtube='web_search youtube'
+alias deepl='web_search deepl'
+alias dockerhub='web_search dockerhub'
+alias gems='web_search gems'
+alias npmpkg='web_search npmpkg'
+alias packagist='web_search packagist'
+alias gopkg='web_search gopkg'
+alias chatgpt='web_search chatgpt'
+alias grok='web_search grok'
+alias claudeai='web_search claudeai'
+alias reddit='web_search reddit'
+alias ppai='web_search ppai'
+alias rscrate='web_search rscrate'
+alias rsdoc='web_search rsdoc'
#add your own !bang searches here
alias wiki='web_search duckduckgo \!w'
@@ -85,3 +116,4 @@ if [[ ${#ZSH_WEB_SEARCH_ENGINES} -gt 0 ]]; then
done
unset engines key
fi
+
diff --git a/plugins/xcode/README.md b/plugins/xcode/README.md
index 27d6a228b..ac79f728d 100644
--- a/plugins/xcode/README.md
+++ b/plugins/xcode/README.md
@@ -1,7 +1,5 @@
# Xcode
-## Description
-
This plugin provides a few utilities that can help you on your daily use of Xcode and iOS development.
To start using it, add the `xcode` plugin to your `plugins` array in `~/.zshrc`:
diff --git a/plugins/yarn/README.md b/plugins/yarn/README.md
index 5c7c7f323..f1d089b1f 100644
--- a/plugins/yarn/README.md
+++ b/plugins/yarn/README.md
@@ -1,7 +1,7 @@
# Yarn plugin
-This plugin adds completion for the [Yarn package manager](https://yarnpkg.com/en/),
-as well as some aliases for common Yarn commands.
+This plugin adds completion for the [Yarn package manager](https://yarnpkg.com/en/), as well as some aliases
+for common Yarn commands.
To use it, add `yarn` to the plugins array in your zshrc file:
@@ -11,48 +11,64 @@ plugins=(... yarn)
## Global scripts directory
-It also adds `yarn` global scripts dir (commonly `~/.yarn/bin`) to the `$PATH`.
-To disable this feature, set the following style in your `.zshrc`:
+It also adds `yarn` global scripts dir (commonly `~/.yarn/bin`) to the `$PATH`. To disable this feature, set
+the following style in your `.zshrc`:
```zsh
zstyle ':omz:plugins:yarn' global-path no
```
+## Yarn Berry
+
+If you are using Yarn berry (a.k.a. Yarn version 2 or higher) as your global Yarn version you should configure
+this plugin to configure its aliases accordingly, set the following style in your `.zshrc`:
+
+```zsh
+zstyle ':omz:plugins:yarn' berry yes
+```
+
## Aliases
-| Alias | Command | Description |
-| ----- | ----------------------------------------- | ----------------------------------------------------------------------------- |
-| y | `yarn` | The Yarn command |
-| ya | `yarn add` | Install a package in dependencies (`package.json`) |
-| yad | `yarn add --dev` | Install a package in devDependencies (`package.json`) |
-| yap | `yarn add --peer` | Install a package in peerDependencies (`package.json`) |
-| yb | `yarn build` | Run the build script defined in `package.json` |
-| ycc | `yarn cache clean` | Clean yarn's global cache of packages |
-| yd | `yarn dev` | Run the dev script defined in `package.json` |
-| yf | `yarn format` | Run the dev script defined in `package.json` |
-| yga | `yarn global add` | Install packages globally on your operating system |
-| ygls | `yarn global list` | Lists global installed packages |
-| ygrm | `yarn global remove` | Remove global installed packages from your OS |
-| ygu | `yarn global upgrade` | Upgrade packages installed globally to their latest version |
-| yh | `yarn help` | Show help for a yarn command |
-| yi | `yarn init` | Interactively creates or updates a package.json file |
-| yin | `yarn install` | Install dependencies defined in `package.json` |
-| yln | `yarn lint` | Run the lint script defined in `package.json` |
-| ylnf | `yarn lint --fix` | Run the lint script defined in `package.json`to automatically fix problems |
-| yls | `yarn list` | List installed packages |
-| yout | `yarn outdated` | Check for outdated package dependencies |
-| yp | `yarn pack` | Create a compressed gzip archive of package dependencies |
-| yrm | `yarn remove` | Remove installed packages |
-| yrun | `yarn run` | Run a defined package script |
-| ys | `yarn serve` | Start the dev server |
-| yst | `yarn start` | Run the start script defined in `package.json` |
-| yt | `yarn test` | Run the test script defined in `package.json` |
-| ytc | `yarn test --coverage` | Run the test script defined in `package.json` with coverage |
-| yuc | `yarn global upgrade && yarn cache clean` | Upgrade global packages and clean yarn's global cache |
-| yui | `yarn upgrade-interactive` | Prompt for which outdated packages to upgrade |
-| yuil | `yarn upgrade-interactive --latest` | Prompt for which outdated packages to upgrade to the latest available version |
-| yup | `yarn upgrade` | Upgrade packages to their latest version |
-| yv | `yarn version` | Update the version of your package |
-| yw | `yarn workspace` | Run a command within a single workspace. |
-| yws | `yarn workspaces` | Run a command within all defined workspaces. |
-| yy | `yarn why` | Show why a package has been installed, detailing which other packages depend on it |
+- Aliases marked with <sup>`*`</sup> are only available when using Yarn v1 (non-berry)
+- Aliases marked with <sup>`b`</sup> are only available when using Yarn berry
+
+| Alias | Command | Description |
+| ------------------ | ----------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
+| y | `yarn` | The Yarn command |
+| ya | `yarn add` | Install a package in dependencies (`package.json`) |
+| yad | `yarn add --dev` | Install a package in devDependencies (`package.json`) |
+| yap | `yarn add --peer` | Install a package in peerDependencies (`package.json`) |
+| yb | `yarn build` | Run the build script defined in `package.json` |
+| ycc | `yarn cache clean` | Clean yarn's global cache of packages |
+| yd | `yarn dev` | Run the dev script defined in `package.json` |
+| yf | `yarn format` | Run the dev script defined in `package.json` |
+| yh | `yarn help` | Show help for a yarn command |
+| yi | `yarn init` | Interactively creates or updates a package.json file |
+| yin | `yarn install` | Install dependencies defined in `package.json` |
+| yln | `yarn lint` | Run the lint script defined in `package.json` |
+| ylnf | `yarn lint --fix` | Run the lint script defined in `package.json`to automatically fix problems |
+| yp | `yarn pack` | Create a compressed gzip archive of package dependencies |
+| yrm | `yarn remove` | Remove installed packages |
+| yrun | `yarn run` | Run a defined package script |
+| ys | `yarn serve` | Start the dev server |
+| yst | `yarn start` | Run the start script defined in `package.json` |
+| yt | `yarn test` | Run the test script defined in `package.json` |
+| ytc | `yarn test --coverage` | Run the test script defined in `package.json` with coverage |
+| yui | `yarn upgrade-interactive` | Prompt for which outdated packages to upgrade |
+| yuil | `yarn upgrade-interactive --latest` (or see `yui` when using [yarn berry](#yarn-berry)) | Prompt for which outdated packages to upgrade to the latest available version |
+| yii | `yarn install --frozen-lockfile` (or `yarn install --immutable` when using [yarn berry](#yarn-berry)) | Install dependencies and abort if the lockfile was to be modified |
+| yifl | `yii` | Install dependencies and abort if the lockfile was to be modified |
+| yup | `yarn upgrade` | Upgrade packages to their latest version |
+| yv | `yarn version` | Update the version of your package |
+| yw | `yarn workspace` | Run a command within a single workspace. |
+| yws | `yarn workspaces` | Run a command within all defined workspaces. |
+| yy | `yarn why` | Show why a package has been installed, detailing which other packages depend on it |
+| yga<sup>`*`</sup> | `yarn global add` | Install packages globally on your operating system |
+| ygls<sup>`*`</sup> | `yarn global list` | Lists global installed packages |
+| ygrm<sup>`*`</sup> | `yarn global remove` | Remove global installed packages from your OS |
+| ygu<sup>`*`</sup> | `yarn global upgrade` | Upgrade packages installed globally to their latest version |
+| yls<sup>`*`</sup> | `yarn list` | List installed packages |
+| yout<sup>`*`</sup> | `yarn outdated` | Check for outdated package dependencies |
+| yuca<sup>`*`</sup> | `yarn global upgrade && yarn cache clean` | Upgrade global packages and clean yarn's global cache |
+| ydlx<sup>`b`</sup> | `yarn dlx` | Run a package in a temporary environment. |
+| yn<sup>`b`</sup> | `yarn node` | Run node with the hook already setup. |
diff --git a/plugins/yarn/_yarn b/plugins/yarn/_yarn
index f15756ff4..9ffe5660c 100644
--- a/plugins/yarn/_yarn
+++ b/plugins/yarn/_yarn
@@ -86,7 +86,7 @@ _global_commands=(
)
_yarn_find_package_json() {
- local dir=$(cd "$1" && pwd)
+ local dir=$(builtin cd "$1" && pwd)
while true
do
@@ -109,7 +109,7 @@ _yarn_commands_scripts() {
if [[ -n $opt_args[--cwd] ]]; then
packageJson=$(_yarn_find_package_json $opt_args[--cwd])
- binaries=($(cd $opt_args[--cwd] && echo node_modules/.bin/*(x:t)))
+ binaries=($(builtin cd $opt_args[--cwd] && echo node_modules/.bin/*(x:t)))
else
packageJson=$(_yarn_find_package_json $pwd)
binaries=($(echo node_modules/.bin/*(x:t)))
@@ -130,9 +130,9 @@ _yarn_scripts() {
if [[ -n $_yarn_run_cwd ]]; then
packageJson=$(_yarn_find_package_json $_yarn_run_cwd)
if [[ -d "${_yarn_run_cwd}/node_modules" ]]; then
- binaries=($(cd $_yarn_run_cwd && echo node_modules/.bin/*(x:t)))
+ binaries=($(builtin cd $_yarn_run_cwd && echo node_modules/.bin/*(x:t)))
else
- binaries=($(cd $_yarn_run_cwd && yarn bin | perl -wln -e 'm{^[^:]+: (\S+)$} and print $1'))
+ binaries=($(builtin cd $_yarn_run_cwd && yarn bin | perl -wln -e 'm{^[^:]+: (\S+)$} and print $1'))
fi
else
packageJson=$(_yarn_find_package_json $pwd)
diff --git a/plugins/yarn/yarn.plugin.zsh b/plugins/yarn/yarn.plugin.zsh
index 157044d71..5dd329698 100644
--- a/plugins/yarn/yarn.plugin.zsh
+++ b/plugins/yarn/yarn.plugin.zsh
@@ -18,17 +18,11 @@ alias yb="yarn build"
alias ycc="yarn cache clean"
alias yd="yarn dev"
alias yf="yarn format"
-alias yga="yarn global add"
-alias ygls="yarn global list"
-alias ygrm="yarn global remove"
-alias ygu="yarn global upgrade"
alias yh="yarn help"
alias yi="yarn init"
alias yin="yarn install"
alias yln="yarn lint"
alias ylnf="yarn lint --fix"
-alias yls="yarn list"
-alias yout="yarn outdated"
alias yp="yarn pack"
alias yrm="yarn remove"
alias yrun="yarn run"
@@ -36,11 +30,35 @@ alias ys="yarn serve"
alias yst="yarn start"
alias yt="yarn test"
alias ytc="yarn test --coverage"
-alias yuc="yarn global upgrade && yarn cache clean"
alias yui="yarn upgrade-interactive"
-alias yuil="yarn upgrade-interactive --latest"
alias yup="yarn upgrade"
alias yv="yarn version"
alias yw="yarn workspace"
alias yws="yarn workspaces"
alias yy="yarn why"
+
+# Commands that are specific to the yarn version being used
+if zstyle -t ':omz:plugins:yarn' berry; then
+ # aliases that differ
+ alias yuil='yui' # --latest flag was removed in yarn berry
+ alias yii='yarn install --immutable'
+ alias yifl='yarn install --immutable'
+
+ # unique aliases
+ alias ydlx="yarn dlx"
+ alias yn="yarn node"
+else
+ # aliases that differ
+ alias yuil='yarn upgrade-interactive --latest'
+ alias yii='yarn install --frozen-lockfile'
+ alias yifl='yarn install --frozen-lockfile'
+
+ # unique aliases
+ alias yga="yarn global add"
+ alias ygls="yarn global list"
+ alias ygrm="yarn global remove"
+ alias ygu="yarn global upgrade"
+ alias yls="yarn list"
+ alias yout="yarn outdated"
+ alias yuca="yarn global upgrade && yarn cache clean"
+fi
diff --git a/plugins/yii2/README.md b/plugins/yii2/README.md
index 345b66eb6..e6c71f23e 100644
--- a/plugins/yii2/README.md
+++ b/plugins/yii2/README.md
@@ -1,7 +1,7 @@
# Yii2 autocomplete plugin
-* Adds autocomplete commands and subcommands for yii.
+Adds autocomplete commands and subcommands for [yii](https://www.yiiframework.com/).
## Requirements
-Autocomplete works from directory where your `yii` file contains.
+Autocomplete works from directory where your `yii` file is contained.
diff --git a/plugins/z/LICENSE b/plugins/z/LICENSE
index 6af13b9e0..b36aeb408 100644
--- a/plugins/z/LICENSE
+++ b/plugins/z/LICENSE
@@ -1,6 +1,6 @@
MIT License
-Copyright (c) 2018-2023 Alexandros Kozak
+Copyright (c) 2018-2025 Alexandros Kozak
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/plugins/z/MANUAL.md b/plugins/z/MANUAL.md
index d367c3026..eddf787dd 100644
--- a/plugins/z/MANUAL.md
+++ b/plugins/z/MANUAL.md
@@ -4,15 +4,17 @@
![Zsh version 4.3.11 and higher](img/zsh_4.3.11_plus.svg)
[![GitHub stars](https://img.shields.io/github/stars/agkozak/zsh-z.svg)](https://github.com/agkozak/zsh-z/stargazers)
-Zsh-z is a command line tool that allows you to jump quickly to directories that you have visited frequently in the past, or recently -- but most often a combination of the two (a concept known as ["frecency"](https://en.wikipedia.org/wiki/Frecency)). It works by keeping track of when you go to directories and how much time you spend in them. It is then in the position to guess where you want to go when you type a partial string, e.g., `z src` might take you to `~/src/zsh`. `z zsh` might also get you there, and `z c/z` might prove to be even more specific -- it all depends on your habits and how much time you have been using Zsh-z to build up a database. After using Zsh-z for a little while, you will get to where you want to be by typing considerably less than you would need if you were using `cd`.
+![Zsh-z demo](img/demo.gif)
-Zsh-z is a native Zsh port of [rupa/z](https://github.com/rupa/z), a tool written for `bash` and Zsh that uses embedded `awk` scripts to do the heavy lifting. It was quite possibly my most used command line tool for a couple of years. I decided to translate it, `awk` parts and all, into pure Zsh script, to see if by eliminating calls to external tools (`awk`, `sort`, `date`, `sed`, `mv`, `rm`, and `chown`) and reducing forking through subshells I could make it faster. The performance increase is impressive, particularly on systems where forking is slow, such as Cygwin, MSYS2, and WSL. I have found that, in those environments, switching directories using Zsh-z can be over 100% faster than it is using `rupa/z`.
+Zsh-z is a command-line tool that allows you to jump quickly to directories that you have visited frequently or recently -- but most often a combination of the two (a concept known as ["frecency"](https://en.wikipedia.org/wiki/Frecency)). It works by keeping track of when you go to directories and how much time you spend in them. Based on this data, it predicts where you want to go when you type a partial string. For example, `z src` might take you to `~/src/zsh`. `z zsh` might also get you there, and `z c/z` might prove to be even more specific -- it all depends on your habits and how long you have been using Zsh-z to build up a database. After using Zsh-z for a little while, you will get to where you want to be by typing considerably less than you would need to if you were using `cd`.
-There is a noteworthy stability increase as well. Race conditions have always been a problem with `rupa/z`, and users of that utility will occasionally lose their `.z` databases. By having Zsh-z only use Zsh (`rupa/z` uses a hybrid shell code that works on `bash` as well), I have been able to implement a `zsh/system`-based file-locking mechanism similar to [the one @mafredri once proposed for `rupa/z`](https://github.com/rupa/z/pull/199). It is now nearly impossible to crash the database, even through extreme testing.
+Zsh-z is a native Zsh port of [`rupa/z`](https://github.com/rupa/z), a tool written for `bash` and Zsh that uses embedded `awk` scripts to do the heavy lifting. `rupa/z` was my most used command-line tool for a couple of years. I decided to translate it, `awk` parts and all, into pure Zsh script, to see if by eliminating calls to external tools (`awk`, `sort`, `date`, `sed`, `mv`, `rm`, and `chown`) and reducing forking through subshells I could make it faster. The performance increase is impressive, particularly on systems where forking is slow, such as Cygwin, MSYS2, and WSL. I have found that in those environments, switching directories using Zsh-z can be over 100% faster than it is using `rupa/z`.
-There are other, smaller improvements which I try to document in [Improvements and Fixes](#improvements-and-fixes). These include the new default behavior of sorting your tab completions by frecency rather than just letting Zsh sort the raw results alphabetically (a behavior which can be restored if you like it -- [see below](#settings)).
+There is also a significant stability improvement. Race conditions have always been a problem with `rupa/z`, and users of that utility occasionally lose their `~/.z` databases. By having Zsh-z only use Zsh (`rupa/z` uses a hybrid shell code standard that works on `bash` as well), I have been able to implement a `zsh/system`-based file-locking mechanism similar to [the one @mafredri once proposed for `rupa/z`](https://github.com/rupa/z/pull/199). It is now nearly impossible to crash the database.
-Zsh-z is a drop-in replacement for `rupa/z` and will, by default, use the same database (`~/.z`), so you can go on using `rupa/z` when you launch `bash`.
+There are other, smaller improvements which I document below in [Improvements and Fixes](#improvements-and-fixes). For instance, tab completions are now sorted by frecency by default rather than alphabetically (the latter behavior can be restored if you like it -- [see below](#settings)).
+
+Zsh-z is a drop-in replacement for `rupa/z` and will, by default, use the same database (`~/.z`, or whatever database file you specify), so you can go on using `rupa/z` when you launch `bash`.
## Table of Contents
- [News](#news)
@@ -32,10 +34,16 @@ Zsh-z is a drop-in replacement for `rupa/z` and will, by default, use the same d
<details>
<summary>Here are the latest features and updates.</summary>
+- August 24, 2023
+ + Zsh-z will now run when `setopt NO_UNSET` has been enabled (props @ntninja).
+- August 23, 2023
+ + Better logic for loading `zsh/files` (props @z0rc).
+- August 2, 2023
+ + Zsh-z still uses the `zsh/files` module when possible but will fall back on the standard `chown`, `mv`, and `rm` commands in its absence.
- April 27, 2023
+ Zsh-z now allows the user to specify the directory-changing command using the `ZSHZ_CD` environment variable (default: `builtin cd`; props @basnijholt).
- January 27, 2023
- + If the datafile directory specified by `ZSHZ_DATA` or `_Z_DATA` does not already exist, create it (props @mattmc3).
+ + If the database file directory specified by `ZSHZ_DATA` or `_Z_DATA` does not already exist, create it (props @mattmc3).
- June 29, 2022
+ Zsh-z is less likely to leave temporary files sitting around (props @mafredri).
- June 27, 2022
@@ -61,10 +69,10 @@ Zsh-z is a drop-in replacement for `rupa/z` and will, by default, use the same d
+ Fixed the explanation string printed during completion so that it may be formatted with `zstyle`.
+ Zsh-z now declares `ZSHZ_EXCLUDE_DIRS` as an array with unique elements so that you do not have to.
- July 29, 2021
- + Temporarily disabling use of `print -v`, which seems to be mangling CJK multibyte strings.
+ + Temporarily disabling the use of `print -v`, which was mangling CJK multibyte strings.
- July 27, 2021
+ Internal escaping of path names now works with older versions of ZSH.
- + Zsh-z now detects and discards any incomplete or incorrectly formattted database entries.
+ + Zsh-z now detects and discards any incomplete or incorrectly formatted database entries.
- July 10, 2021
+ Setting `ZSHZ_TRAILING_SLASH=1` makes it so that a search pattern ending in `/` can match the end of a path; e.g. `z foo/` can match `/path/to/foo`.
- June 25, 2021
@@ -85,7 +93,7 @@ Zsh-z is a drop-in replacement for `rupa/z` and will, by default, use the same d
- January 11, 2021
+ Major refactoring of the code.
+ `z -lr` and `z -lt` work as expected.
- + `EXTENDED_GLOB` has been disabled within the plugin to accomodate old-fashioned Windows directories with names such as `Progra~1`.
+ + `EXTENDED_GLOB` has been disabled within the plugin to accommodate old-fashioned Windows directories with names such as `Progra~1`.
+ Removed `zshelldoc` documentation.
- January 6, 2021
+ I have corrected the frecency routine so that it matches `rupa/z`'s math, but for the present, Zsh-z will continue to display ranks as 1/10000th of what they are in `rupa/z` -- [they had to multiply theirs by 10000](https://github.com/rupa/z/commit/f1f113d9bae9effaef6b1e15853b5eeb445e0712) to work around `bash`'s inadequacies at dealing with decimal fractions.
@@ -94,7 +102,7 @@ Zsh-z is a drop-in replacement for `rupa/z` and will, by default, use the same d
- December 22, 2020
+ `ZSHZ_CASE`: when set to `ignore`, pattern matching is case-insensitive; when set to `smart`, patterns are matched case-insensitively when they are all lowercase and case-sensitively when they have uppercase characters in them (a behavior very much like Vim's `smartcase` setting).
+ `ZSHZ_KEEP_DIRS` is an array of directory names that should not be removed from the database, even if they are not currently available (useful when a drive is not always mounted).
- + Symlinked datafiles were having their symlinks overwritten; this bug has been fixed.
+ + Symlinked database files were having their symlinks overwritten; this bug has been fixed.
</details>
@@ -102,15 +110,15 @@ Zsh-z is a drop-in replacement for `rupa/z` and will, by default, use the same d
### General observations
-This script can be installed simply by downloading it and sourcing it from your `.zshrc`:
+This plugin can be installed simply by putting the various files in a directory together and by sourcing `zsh-z.plugin.zsh` in your `.zshrc`:
source /path/to/zsh-z.plugin.zsh
-For tab completion to work, you will want to have loaded `compinit`. The frameworks handle this themselves. If you are not using a framework, put
+For tab completion to work, `_zshz` *must* be in the same directory as `zsh-z.plugin.zsh`, and you will want to have loaded `compinit`. The frameworks handle this themselves. If you are not using a framework, put
- autoload -U compinit && compinit
+ autoload -U compinit; compinit
-in your .zshrc somewhere below where you source `zsh-z.plugin.zsh`.
+in your `.zshrc` somewhere below where you source `zsh-z.plugin.zsh`.
If you add
@@ -220,7 +228,7 @@ Add the line
to your `.zshrc`.
-`zsh-z` supports `zinit`'s `unload` feature; just run `zinit unload agkozak/zshz` to restore the shell to its state before `zsh-z` was loaded.
+Zsh-z supports `zinit`'s `unload` feature; just run `zinit unload agkozak/zsh-z` to restore the shell to its state before Zsh-z was loaded.
### For [Znap](https://github.com/marlonrichert/zsh-snap) users
@@ -241,7 +249,7 @@ somewhere above the line that says `zplug load`. Then run
zplug install
zplug load
-to install `zsh-z`.
+to install Zsh-z.
## Command Line Options
@@ -255,9 +263,9 @@ to install `zsh-z`.
- `-x` Remove a directory (by default, the current directory) from the database
- `-xR` Remove a directory (by default, the current directory) and its subdirectories from the database
-# Settings
+## Settings
-Zsh-z has environment variables (they all begin with `ZSHZ_`) that change its behavior if you set them; you can also keep your old ones if you have been using `rupa/z` (they begin with `_Z_`).
+Zsh-z has environment variables (they all begin with `ZSHZ_`) that change its behavior if you set them. You can also keep your old ones if you have been using `rupa/z` (whose environment variables begin with `_Z_`).
* `ZSHZ_CMD` changes the command name (default: `z`)
* `ZSHZ_CD` specifies the default directory-changing command (default: `builtin cd`)
@@ -316,19 +324,18 @@ A good example might involve a directory tree that has Git repositories within i
(As a Zsh user, I tend to use `**` instead of `find`, but it is good to see how deep your directory trees go before doing that.)
-
## Other Improvements and Fixes
* `z -x` works, with the help of `chpwd_functions`.
-* Zsh-z works on Solaris.
+* Zsh-z is compatible with Solaris.
* Zsh-z uses the "new" `zshcompsys` completion system instead of the old `compctl` one.
-* There is no error message when the database file has not yet been created.
-* There is support for special characters (e.g., `[`) in directory names.
-* If `z -l` only returns one match, a common root is not printed.
-* Exit status codes increasingly make sense.
-* Completions work with options `-c`, `-r`, and `-t`.
-* If `~/foo` and `~/foob` are matches, `~/foo` is *not* the common root. Only a common parent directory can be a common root.
-* `z -x` and the new, recursive `z -xR` can take an argument so that you can remove directories other than `PWD` from the database.
+* No error message is displayed when the database file has not yet been created.
+* Special characters (e.g., `[`) in directory names are now supported.
+* If `z -l` returns only one match, a common root is not printed.
+* Exit status codes are more logical.
+* Completions now work with options `-c`, `-r`, and `-t`.
+* If `~/foo` and `~/foob` are matches, `~/foo` is no longer considered the common root. Only a common parent directory can be a common root.
+* `z -x` and the new, recursive `z -xR` can now accept an argument so that you can remove directories other than `PWD` from the database.
## Migrating from Other Tools
@@ -350,7 +357,7 @@ the line
That will re-bind `z` or the command of your choice to the underlying Zsh-z function.
-## Known Bugs
+## Known Bug
It is possible to run a completion on a string with spaces in it, e.g., `z us bi<TAB>` might take you to `/usr/local/bin`. This works, but as things stand, after the completion the command line reads
z us /usr/local/bin.
diff --git a/plugins/z/img/demo.gif b/plugins/z/img/demo.gif
new file mode 100644
index 000000000..247f52f4d
--- /dev/null
+++ b/plugins/z/img/demo.gif
Binary files differ
diff --git a/plugins/z/z.plugin.zsh b/plugins/z/z.plugin.zsh
index 60a630624..39b832292 100644
--- a/plugins/z/z.plugin.zsh
+++ b/plugins/z/z.plugin.zsh
@@ -4,7 +4,7 @@
#
# https://github.com/agkozak/zsh-z
#
-# Copyright (c) 2018-2023 Alexandros Kozak
+# Copyright (c) 2018-2025 Alexandros Kozak
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@@ -100,20 +100,29 @@ With no ARGUMENT, list the directory history in ascending rank.
}
# Load zsh/datetime module, if necessary
-(( $+EPOCHSECONDS )) || zmodload zsh/datetime
-
-# Load zsh/files, if necessary
-[[ ${builtins[zf_chown]} == 'defined' &&
- ${builtins[zf_mv]} == 'defined' &&
- ${builtins[zf_rm]} == 'defined' ]] ||
- zmodload -F zsh/files b:zf_chown b:zf_mv b:zf_rm
-
-# Load zsh/system, if necessary
-[[ ${modules[zsh/system]} == 'loaded' ]] || zmodload zsh/system &> /dev/null
+(( ${+EPOCHSECONDS} )) || zmodload zsh/datetime
# Global associative array for internal use
typeset -gA ZSHZ
+# Fallback utilities in case Zsh lacks zsh/files (as is the case with MobaXterm)
+ZSHZ[CHOWN]='chown'
+ZSHZ[MV]='mv'
+ZSHZ[RM]='rm'
+# Try to load zsh/files utilities
+if [[ ${builtins[zf_chown]-} != 'defined' ||
+ ${builtins[zf_mv]-} != 'defined' ||
+ ${builtins[zf_rm]-} != 'defined' ]]; then
+ zmodload -F zsh/files b:zf_chown b:zf_mv b:zf_rm &> /dev/null
+fi
+# Use zsh/files, if it is available
+[[ ${builtins[zf_chown]-} == 'defined' ]] && ZSHZ[CHOWN]='zf_chown'
+[[ ${builtins[zf_mv]-} == 'defined' ]] && ZSHZ[MV]='zf_mv'
+[[ ${builtins[zf_rm]-} == 'defined' ]] && ZSHZ[RM]='zf_rm'
+
+# Load zsh/system, if necessary
+[[ ${modules[zsh/system]-} == 'loaded' ]] || zmodload zsh/system &> /dev/null
+
# Make sure ZSHZ_EXCLUDE_DIRS has been declared so that other scripts can
# simply append to it
(( ${+ZSHZ_EXCLUDE_DIRS} )) || typeset -gUa ZSHZ_EXCLUDE_DIRS
@@ -145,7 +154,7 @@ is-at-least 5.3.0 && ZSHZ[PRINTV]=1
zshz() {
# Don't use `emulate -L zsh' - it breaks PUSHD_IGNORE_DUPS
- setopt LOCAL_OPTIONS NO_KSH_ARRAYS NO_SH_WORD_SPLIT EXTENDED_GLOB
+ setopt LOCAL_OPTIONS NO_KSH_ARRAYS NO_SH_WORD_SPLIT EXTENDED_GLOB UNSET
(( ZSHZ_DEBUG )) && setopt LOCAL_OPTIONS WARN_CREATE_GLOBAL
local REPLY
@@ -277,7 +286,7 @@ zshz() {
if (( ret != 0 )); then
# Avoid clobbering the datafile if the write to tempfile failed
- zf_rm -f "$tempfile"
+ ${ZSHZ[RM]} -f "$tempfile"
return $ret
fi
@@ -285,16 +294,26 @@ zshz() {
owner=${ZSHZ_OWNER:-${_Z_OWNER}}
if (( ZSHZ[USE_FLOCK] )); then
- zf_mv "$tempfile" "$datafile" 2> /dev/null || zf_rm -f "$tempfile"
+ # An unsual case: if inside Docker container where datafile could be bind
+ # mounted
+ if [[ -r '/proc/1/cgroup' && "$(< '/proc/1/cgroup')" == *docker* ]]; then
+ print "$(< "$tempfile")" > "$datafile" 2> /dev/null
+ ${ZSHZ[RM]} -f "$tempfile"
+ # All other cases
+ else
+ ${ZSHZ[MV]} "$tempfile" "$datafile" 2> /dev/null ||
+ ${ZSHZ[RM]} -f "$tempfile"
+ fi
if [[ -n $owner ]]; then
- zf_chown ${owner}:"$(id -ng ${owner})" "$datafile"
+ ${ZSHZ[CHOWN]} ${owner}:"$(id -ng ${owner})" "$datafile"
fi
else
if [[ -n $owner ]]; then
- zf_chown "${owner}":"$(id -ng "${owner}")" "$tempfile"
+ ${ZSHZ[CHOWN]} "${owner}":"$(id -ng "${owner}")" "$tempfile"
fi
- zf_mv -f "$tempfile" "$datafile" 2> /dev/null || zf_rm -f "$tempfile"
+ ${ZSHZ[MV]} -f "$tempfile" "$datafile" 2> /dev/null ||
+ ${ZSHZ[RM]} -f "$tempfile"
fi
# In order to make z -x work, we have to disable zsh-z's adding
@@ -306,7 +325,7 @@ zshz() {
}
############################################################
- # Read the curent datafile contents, update them, "age" them
+ # Read the current datafile contents, update them, "age" them
# when the total rank gets high enough, and print the new
# contents to STDOUT.
#
@@ -884,6 +903,9 @@ alias ${ZSHZ_CMD:-${_Z_CMD:-z}}='zshz 2>&1'
# ZSHZ
############################################################
_zshz_precmd() {
+ # Protect against `setopt NO_UNSET'
+ setopt LOCAL_OPTIONS UNSET
+
# Do not add PWD to datafile when in HOME directory, or
# if `z -x' has just been run
[[ $PWD == "$HOME" ]] || (( ZSHZ[DIRECTORY_REMOVED] )) && return
@@ -931,7 +953,7 @@ add-zsh-hook chpwd _zshz_chpwd
# Completion
############################################################
-# Standarized $0 handling
+# Standardized $0 handling
# https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html
0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
0="${${(M)0:#/*}:-$PWD/$0}"
@@ -958,7 +980,7 @@ ZSHZ[FUNCTIONS]='_zshz_usage
# Enable WARN_NESTED_VAR for functions listed in
# ZSHZ[FUNCTIONS]
############################################################
-(( ZSHZ_DEBUG )) && () {
+(( ${+ZSHZ_DEBUG} )) && () {
if is-at-least 5.4.0; then
local x
for x in ${=ZSHZ[FUNCTIONS]}; do
diff --git a/plugins/zoxide/README.md b/plugins/zoxide/README.md
index f326effe6..45f77bdf5 100644
--- a/plugins/zoxide/README.md
+++ b/plugins/zoxide/README.md
@@ -10,5 +10,8 @@ To use it, add `zoxide` to the plugins array in your `.zshrc` file:
```zsh
plugins=(... zoxide)
```
+## Overriding `z` Alias
+
+You can set the `ZOXIDE_CMD_OVERRIDE`, which will be passed to the `--cmd` flag of `zoxide init`. This allows you to set your `z` command to a default of `cd`.
**Note:** you have to [install zoxide](https://github.com/ajeetdsouza/zoxide#step-1-install-zoxide) first.
diff --git a/plugins/zoxide/zoxide.plugin.zsh b/plugins/zoxide/zoxide.plugin.zsh
index e5658b8f0..25d2e8377 100644
--- a/plugins/zoxide/zoxide.plugin.zsh
+++ b/plugins/zoxide/zoxide.plugin.zsh
@@ -1,5 +1,5 @@
if (( $+commands[zoxide] )); then
- eval "$(zoxide init zsh)"
+ eval "$(zoxide init --cmd ${ZOXIDE_CMD_OVERRIDE:-z} zsh)"
else
echo '[oh-my-zsh] zoxide not found, please install it from https://github.com/ajeetdsouza/zoxide'
fi
diff --git a/plugins/zsh-interactive-cd/README.md b/plugins/zsh-interactive-cd/README.md
index 4bffbf04a..29812a295 100644
--- a/plugins/zsh-interactive-cd/README.md
+++ b/plugins/zsh-interactive-cd/README.md
@@ -1,5 +1,7 @@
# zsh-interactive-cd
+This plugin provides an interactive way to change directories in zsh using fzf.
+
## Demo
![demo](demo.gif)
@@ -8,7 +10,11 @@
1. Install [fzf](https://github.com/junegunn/fzf) by following its [installation instruction](https://github.com/junegunn/fzf#installation).
-2. Source `zsh-interactive-cd.plugin.zsh` in `.zshrc`.
+2. Add `zsh-interactive-cd` to your plugin list in `~/.zshrc`:
+
+ ```zsh
+ plugins=(... zsh-interactive-cd)
+ ```
## Usage
diff --git a/plugins/zsh-navigation-tools/README.md b/plugins/zsh-navigation-tools/README.md
index 4dc9cdba2..6d6c22f4f 100644
--- a/plugins/zsh-navigation-tools/README.md
+++ b/plugins/zsh-navigation-tools/README.md
@@ -185,7 +185,7 @@ Result is stored as `$reply[REPLY]` (`$` isn't needed before `REPLY` because
of arithmetic context inside `[]`). The returned array might be different from
input arguments as `n-list` can process them via incremental search or uniq
mode. `$REPLY` is the index in that possibly processed array. If `$REPLY`
-equals `-1` it means that no selection have been made (user quitted via `q`
+equals `-1` it means that no selection have been made (user quit via `q`
key).
To set up entries that can be jumped to with `[`,`]` keys add their indices to
diff --git a/plugins/zsh-navigation-tools/doc/n-preview b/plugins/zsh-navigation-tools/doc/n-preview
index 2d8eea3fb..bcbbb88c7 100644
--- a/plugins/zsh-navigation-tools/doc/n-preview
+++ b/plugins/zsh-navigation-tools/doc/n-preview
@@ -170,7 +170,7 @@ while (( 1 )); do
elif [ -n "$keypad" ]; then
final_key="$keypad"
else
- _vpreview_status_msg "Inproper input detected"
+ _vpreview_status_msg "Improper input detected"
zcurses refresh status
fi