From 08cc808d717c3cf61118dd47ba451e22c984d3cf Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Sat, 9 May 2020 12:27:56 +0200 Subject: magic-enter: define bindkey for vi mode as well Closes #8906 --- plugins/magic-enter/magic-enter.plugin.zsh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/magic-enter/magic-enter.plugin.zsh b/plugins/magic-enter/magic-enter.plugin.zsh index 8e1859678..2d4d578b6 100644 --- a/plugins/magic-enter/magic-enter.plugin.zsh +++ b/plugins/magic-enter/magic-enter.plugin.zsh @@ -3,7 +3,6 @@ # Pressing enter in a git directory runs `git status` # in other directories `ls` magic-enter () { - # If commands are not already set, use the defaults [ -z "$MAGIC_ENTER_GIT_COMMAND" ] && MAGIC_ENTER_GIT_COMMAND="git status -u ." [ -z "$MAGIC_ENTER_OTHER_COMMAND" ] && MAGIC_ENTER_OTHER_COMMAND="ls -lh ." @@ -20,5 +19,9 @@ magic-enter () { zle accept-line fi } + zle -N magic-enter -bindkey "^M" magic-enter + +bindkey -M emacs "^M" magic-enter +bindkey -M vicmd "^M" magic-enter +bindkey -M viins "^M" magic-enter -- cgit v1.2.3-70-g09d2 From f6a03b2396588598e0347241b0feecdef3f0ac23 Mon Sep 17 00:00:00 2001 From: Michael Stucki Date: Tue, 6 Mar 2018 22:10:34 +0100 Subject: composer: use cache to fix slowness during startup Fixes #6647 Closes #6664 --- plugins/composer/composer.plugin.zsh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/composer/composer.plugin.zsh b/plugins/composer/composer.plugin.zsh index 2c6044aef..22ecbf299 100644 --- a/plugins/composer/composer.plugin.zsh +++ b/plugins/composer/composer.plugin.zsh @@ -49,7 +49,17 @@ alias cget='curl -s https://getcomposer.org/installer | php' # Add Composer's global binaries to PATH, using Composer if available. if (( $+commands[composer] )); then - export PATH=$PATH:$(composer global config bin-dir --absolute 2>/dev/null) + _retrieve_cache composer + + if [[ -z $__composer_bin_dir ]]; then + __composer_bin_dir=$(composer global config bin-dir --absolute 2>/dev/null) + _store_cache composer __composer_bin_dir + fi + + # Add Composer's global binaries to PATH + export PATH="$PATH:$__composer_bin_dir" + + unset __composer_bin_dir else [ -d $HOME/.composer/vendor/bin ] && export PATH=$PATH:$HOME/.composer/vendor/bin [ -d $HOME/.config/composer/vendor/bin ] && export PATH=$PATH:$HOME/.config/composer/vendor/bin -- cgit v1.2.3-70-g09d2 From 2ecf2846cd7328c304364dd0c618036ea1675726 Mon Sep 17 00:00:00 2001 From: Gilles Date: Mon, 30 May 2016 10:03:40 +0200 Subject: composer: add aliases for 'outdated' commands Added `co` alias for `composer outdated` and `cod` for `composer outdated --direct` Closes #5127 --- plugins/composer/composer.plugin.zsh | 2 ++ 1 file changed, 2 insertions(+) (limited to 'plugins') diff --git a/plugins/composer/composer.plugin.zsh b/plugins/composer/composer.plugin.zsh index 22ecbf299..330360cdd 100644 --- a/plugins/composer/composer.plugin.zsh +++ b/plugins/composer/composer.plugin.zsh @@ -43,6 +43,8 @@ alias cdo='composer dump-autoload -o' alias cgu='composer global update' alias cgr='composer global require' alias cgrm='composer global remove' +alias co='composer outdated' +alias cod='composer outdated --direct' # install composer in the current directory alias cget='curl -s https://getcomposer.org/installer | php' -- cgit v1.2.3-70-g09d2 From fd786291bab7468c7cdd5066ac436218a1fba9e2 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Mon, 11 May 2020 20:10:36 +0200 Subject: composer: fix documented aliases --- plugins/composer/README.md | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) (limited to 'plugins') diff --git a/plugins/composer/README.md b/plugins/composer/README.md index 85eef3cc7..7a5f7256e 100644 --- a/plugins/composer/README.md +++ b/plugins/composer/README.md @@ -12,18 +12,20 @@ plugins=(... composer) ## Aliases -| Alias | Command | Description | -| ------ | ---------------------------------------------- | -------------------------------------------------------------------------------------- | -| `c` | `composer` | Starts composer | -| `csu` | `composer self-update` | Updates composer to the latest version | -| `cu` | `composer update` | Updates composer dependencies and `composer.lock` file | -| `cr` | `composer require` | Adds new packages to `composer.json` | -| `crm` | `composer remove` | Removes packages from `composer.json` | -| `ci` | `composer install` | Resolves and installs dependencies from `composer.json` | -| `ccp` | `composer create-project` | Create new project from an existing package | -| `cdu` | `composer dump-autoload` | Updates the autoloader | -| `cdo` | `composer dump-autoload --optimize-autoloader` | Converts PSR-0/4 autoloading to classmap for a faster autoloader (good for production) | -| `cgu` | `composer global update` | Allows update command to run on COMPOSER_HOME directory | -| `cgr` | `composer global require` | Allows require command to run on COMPOSER_HOME directory | -| `cgrm` | `composer global remove` | Allows remove command to run on COMPOSER_HOME directory | -| `cget` | `curl -s https://getcomposer.org/installer` | Installs composer in the current directory | +| Alias | Command | Description | +| ------ | ------------------------------------------- | --------------------------------------------------------------------------------------- | +| `c` | `composer` | Starts composer | +| `csu` | `composer self-update` | Updates composer to the latest version | +| `cu` | `composer update` | Updates composer dependencies and `composer.lock` file | +| `cr` | `composer require` | Adds new packages to `composer.json` | +| `crm` | `composer remove` | Removes packages from `composer.json` | +| `ci` | `composer install` | Resolves and installs dependencies from `composer.json` | +| `ccp` | `composer create-project` | Create new project from an existing package | +| `cdu` | `composer dump-autoload` | Updates the autoloader | +| `cdo` | `composer dump-autoload -o` | Converts PSR-0/4 autoloading to classmap for a faster autoloader (good for production) | +| `cgu` | `composer global update` | Allows update command to run on COMPOSER_HOME directory | +| `cgr` | `composer global require` | Allows require command to run on COMPOSER_HOME directory | +| `cgrm` | `composer global remove` | Allows remove command to run on COMPOSER_HOME directory | +| `cget` | `curl -s https://getcomposer.org/installer` | Installs composer in the current directory | +| `co` | `composer outdated` | Shows a list of installed packages with available updates | +| `cod` | `composer outdated --direct` | Shows a list of installed packages with available updates which are direct dependencies | -- cgit v1.2.3-70-g09d2 From 587b5545803a40bc5dcff81f7fa79d84879b27fd Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Sat, 16 May 2020 16:55:29 +0200 Subject: zsh-navigation-tools: update to 5937e57e Fixes #8476 --- plugins/zsh-navigation-tools/LICENSE | 8 +- plugins/zsh-navigation-tools/Makefile | 35 ++ plugins/zsh-navigation-tools/README.md | 383 +++++++++++++++------ plugins/zsh-navigation-tools/_n-kill | 6 +- plugins/zsh-navigation-tools/n-kill | 4 +- plugins/zsh-navigation-tools/n-list | 2 + .../zsh-navigation-tools.plugin.zsh | 25 +- 7 files changed, 354 insertions(+), 109 deletions(-) create mode 100644 plugins/zsh-navigation-tools/Makefile (limited to 'plugins') diff --git a/plugins/zsh-navigation-tools/LICENSE b/plugins/zsh-navigation-tools/LICENSE index 4ee028112..075c80ccd 100644 --- a/plugins/zsh-navigation-tools/LICENSE +++ b/plugins/zsh-navigation-tools/LICENSE @@ -27,7 +27,7 @@ GPLv3 License GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @@ -671,7 +671,7 @@ the "copyright" line and a pointer to where the full notice is found. 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, see . + along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. @@ -690,11 +690,11 @@ might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see -. +. The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read -. +. diff --git a/plugins/zsh-navigation-tools/Makefile b/plugins/zsh-navigation-tools/Makefile new file mode 100644 index 000000000..f34af0cc3 --- /dev/null +++ b/plugins/zsh-navigation-tools/Makefile @@ -0,0 +1,35 @@ +NAME=zsh-navigation-tools + +INSTALL?=install -c +PREFIX?=/usr/local +SHARE_DIR?=$(DESTDIR)$(PREFIX)/share/$(NAME) +DOC_DIR?=$(DESTDIR)$(PREFIX)/share/doc/$(NAME) + +all: + +install: + $(INSTALL) -d $(SHARE_DIR) + $(INSTALL) -d $(SHARE_DIR)/.config + $(INSTALL) -d $(SHARE_DIR)/.config/znt + $(INSTALL) -d $(DOC_DIR) + cp zsh-navigation-tools.plugin.zsh _n-kill doc/znt-tmux.zsh $(SHARE_DIR) + cp README.md NEWS LICENSE doc/img/n-history2.png $(DOC_DIR) + if [ x"true" = x"`git rev-parse --is-inside-work-tree 2>/dev/null`" ]; then \ + git rev-parse HEAD; \ + else \ + cat .revision-hash; \ + fi > $(SHARE_DIR)/.revision-hash + : + for fname in n-*; do cp "$$fname" $(SHARE_DIR); done; \ + for fname in znt-*; do cp "$$fname" $(SHARE_DIR); done; \ + for fname in .config/znt/n-*; do cp "$$fname" $(SHARE_DIR)/.config/znt; done; + +uninstall: + rm -f $(SHARE_DIR)/.revision-hash $(SHARE_DIR)/_* $(SHARE_DIR)/zsh-* $(SHARE_DIR)/n-* $(SHARE_DIR)/znt-* $(SHARE_DIR)/.config/znt/n-* + [ -d $(SHARE_DIR)/.config/znt ] && rmdir $(SHARE_DIR)/.config/znt || true + [ -d $(SHARE_DIR)/.config ] && rmdir $(SHARE_DIR)/.config || true + [ -d $(SHARE_DIR) ] && rmdir $(SHARE_DIR) || true + rm -f $(DOC_DIR)/README.md $(DOC_DIR)/LICENSE $(DOC_DIR)/n-history2.png + [ -d $(DOC_DIR) ] && rmdir $(DOC_DIR) || true + +.PHONY: all install uninstall diff --git a/plugins/zsh-navigation-tools/README.md b/plugins/zsh-navigation-tools/README.md index ed532a161..7d2ce99f4 100644 --- a/plugins/zsh-navigation-tools/README.md +++ b/plugins/zsh-navigation-tools/README.md @@ -1,58 +1,68 @@ +[![License (GPL version 3)](https://img.shields.io/badge/license-GNU%20GPL%20version%203-blue.svg?style=flat-square)](./LICENSE) +[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](./LICENSE) +![ZSH 5.0.0](https://img.shields.io/badge/zsh-v5.0.0-orange.svg?style=flat-square) + +![znt logo](http://imageshack.com/a/img905/2629/WK9qjN.png) + +[![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=D6XDCHDSBDSDG) + # Zsh Navigation Tools -https://raw.githubusercontent.com/psprint/zsh-navigation-tools/master/doc/img/n-history2.png +Also check out [![ZCA](http://imageshack.com/a/img911/8084/qSpO8a.png) Zsh Command Architect](https://github.com/psprint/zsh-cmd-architect) +and [Zconvey](https://github.com/psprint/zconvey) -Set of tools like n-history – multi-word history searcher, n-cd – directory -bookmark manager, n-kill – htop like kill utility, and more. Based on -n-list, a tool generating selectable curses-based list of elements that has -access to current Zsh session, i.e. has broad capabilities to work together -with it. Feature highlights include incremental multi-word searching, ANSI -coloring, unique mode, horizontal scroll, non-selectable elements, grepping and -various integrations with Zsh. -## History Widget -To have n-history as multi-word incremental searcher bound to Ctrl-R copy znt-* -files into the */site-functions dir (unless you use Oh My Zsh) and -add: +Videos: +- [https://youtu.be/QwZ8IJEgXRE](https://youtu.be/QwZ8IJEgXRE) +- [https://youtu.be/DN9QqssAYB8](https://youtu.be/DN9QqssAYB8) - autoload znt-history-widget - zle -N znt-history-widget - bindkey "^R" znt-history-widget +Screenshots: -to .zshrc. This is done automatically when using Oh My Zsh. Two other -widgets exist, znt-cd-widget and znt-kill-widget, they can be too assigned -to key combinations (no need for autoload when using Oh My Zsh): +![n-history](http://imageshack.com/a/img921/5046/bqr0mk.png) - zle -N znt-cd-widget - bindkey "^A" znt-cd-widget - zle -N znt-kill-widget - bindkey "^Y" znt-kill-widget +![n-history](http://imageshack.com/a/img633/9905/WzfSdl.gif) -Oh My Zsh stores history into ~/.zsh_history. When you switch to OMZ you could -want to copy your previous data (from e.g. ~/.zhistory) into the new location. +Set of tools like `n-history` – multi-word history searcher, `n-cd` – directory +bookmark manager, `n-kill` – `htop` like kill utility, and more. Based on +`n-list`, a tool generating selectable curses-based list of elements that has +access to current `Zsh` session, i.e. has broad capabilities to work together +with it. Feature highlights include incremental multi-word searching, approximate +matching, ANSI coloring, themes, unique mode, horizontal scroll, grepping, advanced +history management and various integrations with `Zsh`. ## News - * 06-10-2016 - - Tmux-integration – Ctrl-b-h in Tmux to open n-history in new window. + - **Tmux-integration** – `Ctrl-B H` in Tmux to open `n-history` in new window. Then select history entry, it will be copied to the original Tmux window. - Use this to execute local commands on remote hosts. All that is needed is - this line added to ~/.tmux.conf: + Use this to execute local commands on remote hosts: + ![tmux integration](http://imageshack.com/a/img922/4760/oyX7eN.gif) + + All that is needed is this line added to `~/.tmux.conf`: + + ``` + bind h run-shell -b "$ZNT_REPO_DIR/doc/znt-tmux.zsh" + ``` + + or – if Homebrew or other package manager is used: + + ``` bind h run-shell -b "$ZNT_REPO_DIR/znt-tmux.zsh" + ``` * 16-05-2016 - - n-kill has completion. It proposes *words* from what's in `ps -A`. Giving n-kill + - `n-kill` has completion. It proposes **words** from what's in `ps -A`. Giving `n-kill` arguments means grepping – it will start only with matching `ps` entries. * 15-05-2016 - - Fixed problem where zsh-syntax-highlighting could render n-history slow (for + - Fixed problem where zsh-syntax-highlighting could render `n-history` slow (for long history entries). * 14-05-2016 - - Configuration can be set from zshrc. Example: + - Configuration can be set from `zshrc` (starting from `v2.1.12`). Documentation is [below](#configuration). Example: + ```zsh znt_list_instant_select=1 znt_list_border=0 znt_list_bold=1 @@ -63,76 +73,197 @@ want to copy your previous data (from e.g. ~/.zhistory) into the new location. znt_cd_hotlist=( "~/.config/znt" "/usr/share/zsh/site-functions" "/usr/share/zsh" "/usr/local/share/zsh/site-functions" "/usr/local/share/zsh" "/usr/local/bin" ) + ``` * 10-05-2016 - - Search query rotation – use Ctrl-A to rotate entered words right. + - Search query rotation – use `Ctrl-A` to rotate entered words right. Words `1 2 3` become `3 1 2`. * 09-05-2016 - - New feature: n-help tool, available also from n-history via H key. It - displays help screen with various information on ZNT. + - New feature: n-help tool, available also from n-history via `H` key. It + displays help screen with various information on `ZNT`. + + ![n-help](http://imageshack.com/a/img922/7595/MvtJdI.gif) * 08-05-2016 - - Approximate matching – pressing f or Ctrl-F will enter FIX mode, in - which 1 or 2 errors are allowed in what is searched. This utilizes + - Approximate matching – pressing `f` or `Ctrl-F` will enter "`FIX`" mode, + in which `1` or `2` errors are allowed in what's searched. This utilizes original Zsh approximate matching features and is intended to be used after entering search query, when a typo is discovered. + ![fix mode](http://imageshack.com/a/img921/5756/64lFnv.gif) + * 06-05-2016 - - Private history can be edited. Use e key or Ctrl-E for that when in - n-history. Your $EDITOR will start. This is a way to have handy set - of bookmarks prepared in private history's file. - - Border can be disabled. Use following snippet in ~/.config/znt/n-list.conf + - Private history can be edited. Use `e` key or `Ctrl-E` for that when in + n-history. Your `$EDITOR` will start. This is a way to have handy set of + bookmarks prepared in private history's file. + - Border can be disabled. Use following snippet in `~/.config/znt/n-list.conf` or any other tool-targetted config file: + ```zsh # Should draw the border? local border=0 + ``` * 30-04-2016 - - New feature: color themes. Use Ctrl-T and Ctrl-G to browse predefined - themes. They are listed in ~/.config/znt/n-list.conf. Use the file to - permanently set a color scheme. Also, I sent a patch to Zsh developers + - New feature: color themes. Use `Ctrl-T` and `Ctrl-G` to browse predefined + themes. They are listed in [~/.config/znt/n-list.conf](https://github.com/psprint/zsh-navigation-tools/blob/master/.config/znt/n-list.conf). + Use the file to permanently set a color scheme. Also, I sent a patch to Zsh developers and starting from Zsh > 5.2 (not yet released) supported will be 256 colors. - The file ~/.config/znt/n-list.conf already has set of 256-color themes prepared :) + The file [~/.config/znt/n-list.conf](https://github.com/psprint/zsh-navigation-tools/blob/master/.config/znt/n-list.conf) + already has set of 256-color themes prepared :) + + ![themes](http://imageshack.com/a/img924/4310/EbRh30.gif) * 29-04-2016 - New feature: private history – n-history tracks selected history entries, - exposes them via new view (activated with F1) + exposes them via new view (activated with `F1`). It is shared across all + sessions * 28-04-2016 - New features: - 1. New n-history view (activated with F1): Most Frequent History Words + 1. New n-history view (activated with `F1`): Most Frequent History Words 2. Predefined search keywords – use F2 to quickly search for chosen keywords (video: [https://youtu.be/DN9QqssAYB8](https://youtu.be/DN9QqssAYB8)) 3. Configuration option for doing instant selection in search mode +## Installation + +``` +sh -c "$(curl -fsSL https://raw.githubusercontent.com/psprint/zsh-navigation-tools/master/doc/install.sh)" +``` + +To update run the command again. + +`ZNT` will be installed at `~/.config/znt/zsh-navigation-tools`, config files will be copied to `~/.config/znt`. `.zshrc` +will be updated with only `8` lines of code, which will be added at the bottom. + +After installing and reloading shell give `ZNT` a quick try with `Ctrl-R` – this keyboard shortcut will open `n-history`. + +## Installation With [Zplugin](https://github.com/psprint/zplugin) +Add `zplugin load psprint/zsh-navigation-tools` to `.zshrc`. The config files will be in `~/.config/znt`. + +## Installation With Zgen + +Add `zgen load psprint/zsh-navigation-tools` to `.zshrc` and issue a `zgen reset` (this assumes that there is a proper `zgen save` construct in `.zshrc`). +The config files will be available in `~/.config/znt`. + +## Installation With Antigen +Add `antigen bundle psprint/zsh-navigation-tools` to `.zshrc`. There also +should be `antigen apply`. The config files will be in `~/.config/znt`. + +## Single File Manual Installation + +Running script `doc/generate_single_file` will create single-file version of `ZNT`. +It can be sourced from `.zshrc`. Don't forget about configuration files as described +above. + +## Manual Installation + +After extracting `ZNT` to `{some-directory}` add following two lines +to `~/.zshrc`: + +```zsh +fpath+=( {some-directory} ) +source "{some-directory}/zsh-navigation-tools.plugin.zsh" +``` + +As you can see, no plugin manager is needed to use the `*.plugin.zsh` +file. The above two lines of code are all that almost **all** plugin +managers do. In fact, what's actually needed is only: + +```zsh +source "{some-directory}/zsh-navigation-tools.plugin.zsh" +``` + +because `ZNT` detects if it is used by **any** plugin manager and can +handle `$fpath` update by itself. + +## Truly Manual Installation +Copy (or link) all `n-*` and `znt-*` files to **/usr/share/zsh/site-functions/** +(or **/usr/local/share/zsh/site-functions/**, check with `echo $fpath[1]`) and then add: + + autoload n-list n-cd n-env n-kill n-panelize n-options n-aliases n-functions n-history n-help + +to `~/.zshrc`. + +Create aliases to avoid typing of the minus sign "-": + +```zsh +alias naliases=n-aliases ncd=n-cd nenv=n-env nfunctions=n-functions nhistory=n-history +alias nkill=n-kill noptions=n-options npanelize=n-panelize nhelp=n-help +``` + +Don't forget to copy [configuration files](https://github.com/psprint/zsh-navigation-tools/tree/master/.config/znt). They should go to `~/.config/znt`. Moreover, `n-cd` works together with option `AUTO_PUSHD` and you should have: + +```zsh +setopt AUTO_PUSHD +``` + +in `.zshrc` (also recommend `PUSHD_IGNORE_DUPS`). Without the option `n-cd` +will just work as incremental searcher of directory bookmarks. + +## History Widget + +To have `n-history` as the incremental searcher bound to `Ctrl-R` copy `znt-*` +files into the `*/site-functions` dir (unless you do single file install) and +add: + +```zsh +autoload znt-history-widget +zle -N znt-history-widget +bindkey "^R" znt-history-widget +``` + +to `.zshrc`. This is done automatically when using the installer, zgen, antigen +or single file install. Two other widgets exist, `znt-cd-widget` and +`znt-kill-widget`, they too can be assigned to key combinations (`autoload` is done +in `.zshrc` so no need of it): + +```zsh +zle -N znt-cd-widget +bindkey "^B" znt-cd-widget +zle -N znt-kill-widget +bindkey "^Y" znt-kill-widget +``` + ## Introduction The tools are: -- n-aliases - browses aliases, relegates editing to vared -- n-cd - browses dirstack and bookmarked directories, allows to enter selected directory -- n-functions - browses functions, relegates editing to zed or vared -- n-history - browses history, allows to edit and run commands from it -- n-kill - browses processes list, allows to send signal to selected process -- n-env - browses environment, relegates editing to vared -- n-options - browses options, allows to toggle their state -- n-panelize - loads output of given command into the list for browsing - -All tools support horizontal scroll with <,>, {,}, h,l or left and right -cursors. Other keys are: - -- [,] - jump directory bookmarks in n-cd and typical signals in n-kill -- Ctrl-d, Ctrl-u - half page up or down -- Ctrl-p, Ctrl-n - previous and next (also done with vim's j,k) -- Ctrl-l - redraw of whole display -- g, G - beginning and end of the list -- Ctrl-o, o - enter uniq mode (no duplicate lines) -- / - start incremental search -- Enter - finish incremental search, retaining filter -- Esc - exit incremental search, clearing filter -- Ctrl-w (in incremental search) - delete whole word -- Ctrl-k (in incremental search) - delete whole line +- `n-aliases` - browses aliases, relegates editing to `vared` +- `n-cd` - browses dirstack and bookmarked directories, allows to enter selected directory +- `n-functions` - browses functions, relegates editing to `zed` or `vared` +- `n-history` - browses history, allows to edit and run commands from it +- `n-kill` - browses processes list, allows to send signal to selected process +- `n-env` - browses environment, relegates editing to `vared` +- `n-options` - browses options, allows to toggle their state +- `n-panelize` - loads output of given command into the list for browsing + +All tools support horizontal scroll with `<`,`>`, `{`,`}`, `h`,`l` or left and right cursors. Other keys are: + +- `H`, `?` (from n-history) - run n-help +- `Ctrl-R` - start n-history, the incremental, multi-keyword history searcher (Zsh binding) +- `Ctrl-A` - rotate entered words (1+2+3 -> 3+1+2) +- `Ctrl-F` - fix mode (approximate matching) +- `Ctrl-L` - redraw of whole display +- `Ctrl-T` - browse themes (next theme) +- `Ctrl-G` - browse themes (previous theme) +- `Ctrl-U` - half page up +- `Ctrl-D` - half page down +- `Ctrl-P` - previous element (also done with vim's k) +- `Ctrl-N` - next element (also done with vim's j) +- `[`, `]` - jump directory bookmarks in n-cd and typical signals in n-kill +- `g`, `G` - beginning and end of the list +- `/` - show incremental search +- `F3` - show/hide incremental search +- `Esc` - exit incremental search, clearing filter +- `Ctrl-W` (in incremental search) - delete whole word +- `Ctrl-K` (in incremental search) - delete whole line +- `Ctrl-O`, `o` - enter uniq mode (no duplicate lines) +- `Ctrl-E`, `e` - edit private history (when in private history view) +- `F1` - (in n-history) - switch view +- `F2`, `Ctrl-X`, `Ctrl-/` - search predefined keywords (defined in config files) ## Configuration @@ -177,7 +308,7 @@ znt_history_active_text - underline or reverse - how should be active element hi znt_history_nlist_coloring_pattern - pattern that can be used to colorize elements znt_history_nlist_coloring_color - color with which to colorize znt_history_nlist_coloring_match_multiple - should multiple matches be colorized (0 or 1) -znt_history_keywords (array) - search keywords activated with `Ctrl-X` +znt_history_keywords (array) - search keywords activated with `Ctrl-X`, `F2` or `Ctrl-/`, e.g. ( "git" "vim" ) ``` Above variables will work for `n-history` tool. For other tools, change `_history_` to @@ -193,52 +324,108 @@ znt_list_themes (array) - list of themes to try out with Ctrl-T, e.g. ( "white/b znt_list_instant_select - should pressing enter in search mode leave tool (0 or 1) ``` +If you used `ZNT` before `v2.1.12`, remove old configuration files `~/.config/znt/*.conf` so that `ZNT` +can update them to the latest versions that support integration with `Zshrc`. If you used installer +then run it again (after the remove of configuration files). + ## Programming -The function n-list is used as follows: +The function `n-list` is used as follows: - n-list {element1} [element2] ... [elementN] +```zsh +n-list {element1} [element2] ... [elementN] +``` This is all that is needed to be done to have the features like ANSI coloring, incremental multi-word search, unique mode, horizontal scroll, non-selectable -elements (grepping is done outside n-list, see the tools for how it can be +elements (grepping is done outside `n-list`, see the tools for how it can be done). To set up non-selectable entries add their indices into array -NLIST_NONSELECTABLE_ELEMENTS: +`NLIST_NONSELECTABLE_ELEMENTS`: - typeset -a NLIST_NONSELECTABLE_ELEMENTS - NLIST_NONSELECTABLE_ELEMENTS=( 1 ) +```zsh +typeset -a NLIST_NONSELECTABLE_ELEMENTS +NLIST_NONSELECTABLE_ELEMENTS=( 1 ) +``` -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 +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` key). -To set up entries that can be jumped to with [,] keys add their indices to -NLIST_HOP_INDEXES array: +To set up entries that can be jumped to with `[`,`]` keys add their indices to +`NLIST_HOP_INDEXES` array: - typeset -a NLIST_HOP_INDEXES - NLIST_HOP_INDEXES=( 1 10 ) +```zsh +typeset -a NLIST_HOP_INDEXES +NLIST_HOP_INDEXES=( 1 10 ) +``` -n-list can automatically colorize entries according to a Zsh pattern. +`n-list` can automatically colorize entries according to a `Zsh` pattern. Following example will colorize all numbers with blue: - local NLIST_COLORING_PATTERN="[0-9]##" - local NLIST_COLORING_COLOR=$'\x1b[00;34m' - local NLIST_COLORING_END_COLOR=$'\x1b[0m' - local NLIST_COLORING_MATCH_MULTIPLE=1 - n-list "This is a number 123" "This line too has a number: 456" +```zsh +local NLIST_COLORING_PATTERN="[0-9]##" +local NLIST_COLORING_COLOR=$'\x1b[00;34m' +local NLIST_COLORING_END_COLOR=$'\x1b[0m' +local NLIST_COLORING_MATCH_MULTIPLE=1 + +n-list "This is a number 123" "This line too has a number: 456" +``` -Blue is the default color, it doesn't have to be set. See zshexpn man page -for more information on Zsh patterns. Briefly, comparing to regular -expressions, (#s) is ^, (#e) is $, # is *, ## is +. Alternative -will work when in parenthesis, i.e. (a|b). BTW by using this method you can +Blue is the default color, it doesn't have to be set. See `zshexpn` man page +for more information on `Zsh` patterns. Briefly, comparing to regular +expressions, `(#s)` is `^`, `(#e)` is `$`, `#` is `*`, `##` is `+`. Alternative +will work when in parenthesis, i.e. `(a|b)`. BTW by using this method you can colorize output of the tools, via their config files (check out e.g. n-cd.conf, -it uses this). +it is using this). ## Performance -ZNT are fastest with Zsh before 5.0.6 and starting from 5.2 +`ZNT` are fastest with `Zsh` before `5.0.6` and starting from `5.2` + +## A tip + +Zsh plugins may look scary, as they seem to have some "architecture". In fact, what a plugin really is, is that: + +1. It has its directory added to `fpath` +2. It has any first `*.plugin.zsh` file sourced + +That's it. When one contributes to Oh-My-Zsh or creates a plugin for any plugin manager, he only needs to account for this. +The same with doing any non-typical Zsh Navigation Tools installation. + +## More + +- be aware of [this](https://github.com/psprint/zsh-navigation-tools/blob/f49f910d239ae5bc6e1a5bb34930307b4f4e3ffe/zsh-navigation-tools.plugin.zsh#L35-L49) + +## IRC Channel + +Channel `#zplugin@freenode` is a support place for all author's projects. Connect to: +[chat.freenode.net:6697](ircs://chat.freenode.net:6697/%23zplugin) (SSL) or [chat.freenode.net:6667](irc://chat.freenode.net:6667/%23zplugin) + and join #zplugin. + +Following is a quick access via Webchat [![IRC](https://kiwiirc.com/buttons/chat.freenode.net/zplugin.png)](https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin) + +# Fixing tmux, screen and linux vt + +If `TERM=screen-256color` (often a case for `tmux` and `screen` sessions) then +`ncv` terminfo capability will have `2`nd bit set. This in general means that +underline won't work. To fix this by creating your own `ncv=0`-equipped +terminfo file, run: + +```zsh +{ infocmp -x screen-256color; printf '\t%s\n' 'ncv@,'; } > /tmp/t && tic -x /tmp/t +``` + +A file will be created in directory `~/.terminfo` and will be automatically +used, `tmux` and `screen` will work. Similar is for Linux virtual terminal: + +```zsh +{ infocmp -x linux; printf '\t%s\n' 'ncv@,'; } > /tmp/t && tic -x /tmp/t +``` + +It will not display underline properly, but will instead highlight by a color, +which is quite nice. The same will not work for FreeBSD's vt, `ZNT` will detect +if that vt is used and will revert to highlighting elements via `reverse` mode. -vim:filetype=conf diff --git a/plugins/zsh-navigation-tools/_n-kill b/plugins/zsh-navigation-tools/_n-kill index 6f5d47971..9da68b9ec 100644 --- a/plugins/zsh-navigation-tools/_n-kill +++ b/plugins/zsh-navigation-tools/_n-kill @@ -10,8 +10,8 @@ integer cygwin=0 local IFS=" " -case "$OSTYPE" in - cygwin*) list=( `command ps -Wa` ); cygwin=1 ;; +case "$(uname)" in + CYGWIN*) list=( `command ps -Wa` ); cygwin=1 ;; *) list=( `command ps -o pid,uid,command -A` ) ;; esac @@ -36,6 +36,6 @@ for line in "${list[@]}"; do done _wanted bits expl "Processes' name bits" \ - compadd "$@" -a - words && ret=0 + compadd -M 'm:{a-z}={A-Z}' "$@" -a - words && ret=0 return "$ret" diff --git a/plugins/zsh-navigation-tools/n-kill b/plugins/zsh-navigation-tools/n-kill index 76050f969..0d10565e4 100644 --- a/plugins/zsh-navigation-tools/n-kill +++ b/plugins/zsh-navigation-tools/n-kill @@ -42,8 +42,8 @@ NLIST_NONSELECTABLE_ELEMENTS=( 1 ) type ps 2>/dev/null 1>&2 || { echo >&2 "Error: \`ps' not found"; return 1 } -case "$OSTYPE" in - cygwin*) list=( `command ps -Wa` ) ;; +case "$(uname)" in + CYGWIN*) list=( `command ps -Wa` ) ;; *) list=( `command ps -o pid,uid,command -A` ) ;; esac diff --git a/plugins/zsh-navigation-tools/n-list b/plugins/zsh-navigation-tools/n-list index 3fe5542a6..f25db8f60 100644 --- a/plugins/zsh-navigation-tools/n-list +++ b/plugins/zsh-navigation-tools/n-list @@ -261,6 +261,8 @@ done last_element="$#list" +zcurses clear main redraw +zcurses clear inner redraw while (( 1 )); do # Do searching (filtering with string) if [ -n "$NLIST_SEARCH_BUFFER" ]; then diff --git a/plugins/zsh-navigation-tools/zsh-navigation-tools.plugin.zsh b/plugins/zsh-navigation-tools/zsh-navigation-tools.plugin.zsh index 32b4ca064..f015620f5 100644 --- a/plugins/zsh-navigation-tools/zsh-navigation-tools.plugin.zsh +++ b/plugins/zsh-navigation-tools/zsh-navigation-tools.plugin.zsh @@ -1,9 +1,30 @@ #!/usr/bin/env zsh -0="${(%):-%N}" # this gives immunity to functionargzero being unset -export ZNT_REPO_DIR="${0%/*}" +# +# No plugin manager is needed to use this file. All that is needed is adding: +# source {where-znt-is}/zsh-navigation-tools.plugin.zsh +# +# to ~/.zshrc. +# + +# According to the standard: +# http://zdharma.org/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html +0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}" +0="${${(M)0:#/*}:-$PWD/$0}" +export ZNT_REPO_DIR="${0:h}" export ZNT_CONFIG_DIR="$HOME/.config/znt" +# +# Update FPATH if: +# 1. Not loading with a plugin manager +# 2. Not having fpath already updated +# + +if [[ ${zsh_loaded_plugins[-1]} != */zsh-navigation-tools && -z ${fpath[(r)${0:h}]} ]] +then + fpath+=( "${0:h}" ) +fi + # # Copy configs # -- cgit v1.2.3-70-g09d2 From 0e4b638c3f983e3d7f168417bf7db2219cbdf609 Mon Sep 17 00:00:00 2001 From: Raphaël Brulé Date: Sat, 16 May 2020 11:15:43 -0400 Subject: Add plugin for rustup completion (#8914) --- plugins/rustup/README.md | 9 + plugins/rustup/_rustup | 1143 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 1152 insertions(+) create mode 100644 plugins/rustup/README.md create mode 100644 plugins/rustup/_rustup (limited to 'plugins') diff --git a/plugins/rustup/README.md b/plugins/rustup/README.md new file mode 100644 index 000000000..ba037f8f6 --- /dev/null +++ b/plugins/rustup/README.md @@ -0,0 +1,9 @@ +# rustup + +This plugin adds completion for [`rustup`](https://rustup.rs/), the toolchain installer for the Rust programming language. + +To use it, add `rustup` to the plugins array in your zshrc file: + +```zsh +plugins=(... rustup) +``` diff --git a/plugins/rustup/_rustup b/plugins/rustup/_rustup new file mode 100644 index 000000000..dab33533a --- /dev/null +++ b/plugins/rustup/_rustup @@ -0,0 +1,1143 @@ +#compdef rustup + +autoload -U is-at-least + +_rustup() { + typeset -A opt_args + typeset -a _arguments_options + local ret=1 + + if is-at-least 5.2; then + _arguments_options=(-s -S -C) + else + _arguments_options=(-s -C) + fi + + local context curcontext="$curcontext" state line + _arguments "${_arguments_options[@]}" \ +'-v[Enable verbose output]' \ +'--verbose[Enable verbose output]' \ +'(-v --verbose)-q[Disable progress output]' \ +'(-v --verbose)--quiet[Disable progress output]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +'::+toolchain -- release channel (e.g. +stable) or custom toolchain to set override:_files' \ +":: :_rustup_commands" \ +"*::: :->rustup" \ +&& ret=0 + case $state in + (rustup) + words=($line[2] "${words[@]}") + (( CURRENT += 1 )) + curcontext="${curcontext%:*:*}:rustup-command-$line[2]:" + case $line[2] in + (dump-testament) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; +(show) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +":: :_rustup__show_commands" \ +"*::: :->show" \ +&& ret=0 +case $state in + (show) + words=($line[1] "${words[@]}") + (( CURRENT += 1 )) + curcontext="${curcontext%:*:*}:rustup-show-command-$line[1]:" + case $line[1] in + (active-toolchain) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; +(home) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; +(profile) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; +(keys) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; +(help) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; + esac + ;; +esac +;; +(install) +_arguments "${_arguments_options[@]}" \ +'--profile=[]: :(minimal default complete)' \ +'--no-self-update[Don'\''t perform self-update when running the `rustup install` command]' \ +'--force[Force an update, even if some components are missing]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ +&& ret=0 +;; +(uninstall) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ +&& ret=0 +;; +(update) +_arguments "${_arguments_options[@]}" \ +'--no-self-update[Don'\''t perform self update when running the `rustup update` command]' \ +'--force[Force an update, even if some components are missing]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +'::toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ +&& ret=0 +;; +(check) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; +(default) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +'::toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ +&& ret=0 +;; +(toolchain) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +":: :_rustup__toolchain_commands" \ +"*::: :->toolchain" \ +&& ret=0 +case $state in + (toolchain) + words=($line[1] "${words[@]}") + (( CURRENT += 1 )) + curcontext="${curcontext%:*:*}:rustup-toolchain-command-$line[1]:" + case $line[1] in + (list) +_arguments "${_arguments_options[@]}" \ +'-v[Enable verbose output with toolchain information]' \ +'--verbose[Enable verbose output with toolchain information]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; +(update) +_arguments "${_arguments_options[@]}" \ +'--profile=[]: :(minimal default complete)' \ +'*-c+[Add specific components on installation]' \ +'*--component=[Add specific components on installation]' \ +'*-t+[Add specific targets on installation]' \ +'*--target=[Add specific targets on installation]' \ +'--no-self-update[Don'\''t perform self update when running the`rustup toolchain install` command]' \ +'--force[Force an update, even if some components are missing]' \ +'--allow-downgrade[Allow rustup to downgrade the toolchain to satisfy your component choice]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ +&& ret=0 +;; +(add) +_arguments "${_arguments_options[@]}" \ +'--profile=[]: :(minimal default complete)' \ +'*-c+[Add specific components on installation]' \ +'*--component=[Add specific components on installation]' \ +'*-t+[Add specific targets on installation]' \ +'*--target=[Add specific targets on installation]' \ +'--no-self-update[Don'\''t perform self update when running the`rustup toolchain install` command]' \ +'--force[Force an update, even if some components are missing]' \ +'--allow-downgrade[Allow rustup to downgrade the toolchain to satisfy your component choice]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ +&& ret=0 +;; +(install) +_arguments "${_arguments_options[@]}" \ +'--profile=[]: :(minimal default complete)' \ +'*-c+[Add specific components on installation]' \ +'*--component=[Add specific components on installation]' \ +'*-t+[Add specific targets on installation]' \ +'*--target=[Add specific targets on installation]' \ +'--no-self-update[Don'\''t perform self update when running the`rustup toolchain install` command]' \ +'--force[Force an update, even if some components are missing]' \ +'--allow-downgrade[Allow rustup to downgrade the toolchain to satisfy your component choice]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ +&& ret=0 +;; +(remove) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ +&& ret=0 +;; +(uninstall) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ +&& ret=0 +;; +(link) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ +':path:_files' \ +&& ret=0 +;; +(help) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; + esac + ;; +esac +;; +(target) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +":: :_rustup__target_commands" \ +"*::: :->target" \ +&& ret=0 +case $state in + (target) + words=($line[1] "${words[@]}") + (( CURRENT += 1 )) + curcontext="${curcontext%:*:*}:rustup-target-command-$line[1]:" + case $line[1] in + (list) +_arguments "${_arguments_options[@]}" \ +'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \ +'--installed[List only installed targets]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; +(install) +_arguments "${_arguments_options[@]}" \ +'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +':target -- List of targets to install; "all" installs all available targets:_files' \ +&& ret=0 +;; +(add) +_arguments "${_arguments_options[@]}" \ +'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +':target -- List of targets to install; "all" installs all available targets:_files' \ +&& ret=0 +;; +(uninstall) +_arguments "${_arguments_options[@]}" \ +'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +':target:_files' \ +&& ret=0 +;; +(remove) +_arguments "${_arguments_options[@]}" \ +'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +':target:_files' \ +&& ret=0 +;; +(help) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; + esac + ;; +esac +;; +(component) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +":: :_rustup__component_commands" \ +"*::: :->component" \ +&& ret=0 +case $state in + (component) + words=($line[1] "${words[@]}") + (( CURRENT += 1 )) + curcontext="${curcontext%:*:*}:rustup-component-command-$line[1]:" + case $line[1] in + (list) +_arguments "${_arguments_options[@]}" \ +'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \ +'--installed[List only installed components]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; +(add) +_arguments "${_arguments_options[@]}" \ +'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \ +'--target=[]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +':component:_files' \ +&& ret=0 +;; +(remove) +_arguments "${_arguments_options[@]}" \ +'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \ +'--target=[]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +':component:_files' \ +&& ret=0 +;; +(help) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; + esac + ;; +esac +;; +(override) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +":: :_rustup__override_commands" \ +"*::: :->override" \ +&& ret=0 +case $state in + (override) + words=($line[1] "${words[@]}") + (( CURRENT += 1 )) + curcontext="${curcontext%:*:*}:rustup-override-command-$line[1]:" + case $line[1] in + (list) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; +(add) +_arguments "${_arguments_options[@]}" \ +'--path=[Path to the directory]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ +&& ret=0 +;; +(set) +_arguments "${_arguments_options[@]}" \ +'--path=[Path to the directory]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ +&& ret=0 +;; +(remove) +_arguments "${_arguments_options[@]}" \ +'--path=[Path to the directory]' \ +'--nonexistent[Remove override toolchain for all nonexistent directories]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; +(unset) +_arguments "${_arguments_options[@]}" \ +'--path=[Path to the directory]' \ +'--nonexistent[Remove override toolchain for all nonexistent directories]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; +(help) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; + esac + ;; +esac +;; +(run) +_arguments "${_arguments_options[@]}" \ +'--install[Install the requested toolchain if needed]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ +':command:_files' \ +&& ret=0 +;; +(which) +_arguments "${_arguments_options[@]}" \ +'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +':command:_files' \ +&& ret=0 +;; +(docs) +_arguments "${_arguments_options[@]}" \ +'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \ +'--path[Only print the path to the documentation]' \ +'--alloc[The Rust core allocation and collections library]' \ +'--book[The Rust Programming Language book]' \ +'--cargo[The Cargo Book]' \ +'--core[The Rust Core Library]' \ +'--edition-guide[The Rust Edition Guide]' \ +'--nomicon[The Dark Arts of Advanced and Unsafe Rust Programming]' \ +'--proc_macro[A support library for macro authors when defining new macros]' \ +'--reference[The Rust Reference]' \ +'--rust-by-example[A collection of runnable examples that illustrate various Rust concepts and standard libraries]' \ +'--rustc[The compiler for the Rust programming language]' \ +'--rustdoc[Generate documentation for Rust projects]' \ +'--std[Standard library API documentation]' \ +'--test[Support code for rustc'\''s built in unit-test and micro-benchmarking framework]' \ +'--unstable-book[The Unstable Book]' \ +'--embedded-book[The Embedded Rust Book]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +'::topic -- Topic such as 'core', 'fn', 'usize', 'eprintln!', 'core::arch', 'alloc::format!', 'std::fs', 'std::fs::read_dir', 'std::io::Bytes', 'std::iter::Sum', 'std::io::error::Result' etc...:_files' \ +&& ret=0 +;; +(doc) +_arguments "${_arguments_options[@]}" \ +'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \ +'--path[Only print the path to the documentation]' \ +'--alloc[The Rust core allocation and collections library]' \ +'--book[The Rust Programming Language book]' \ +'--cargo[The Cargo Book]' \ +'--core[The Rust Core Library]' \ +'--edition-guide[The Rust Edition Guide]' \ +'--nomicon[The Dark Arts of Advanced and Unsafe Rust Programming]' \ +'--proc_macro[A support library for macro authors when defining new macros]' \ +'--reference[The Rust Reference]' \ +'--rust-by-example[A collection of runnable examples that illustrate various Rust concepts and standard libraries]' \ +'--rustc[The compiler for the Rust programming language]' \ +'--rustdoc[Generate documentation for Rust projects]' \ +'--std[Standard library API documentation]' \ +'--test[Support code for rustc'\''s built in unit-test and micro-benchmarking framework]' \ +'--unstable-book[The Unstable Book]' \ +'--embedded-book[The Embedded Rust Book]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +'::topic -- Topic such as 'core', 'fn', 'usize', 'eprintln!', 'core::arch', 'alloc::format!', 'std::fs', 'std::fs::read_dir', 'std::io::Bytes', 'std::iter::Sum', 'std::io::error::Result' etc...:_files' \ +&& ret=0 +;; +(man) +_arguments "${_arguments_options[@]}" \ +'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +':command:_files' \ +&& ret=0 +;; +(self) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +":: :_rustup__self_commands" \ +"*::: :->self" \ +&& ret=0 +case $state in + (self) + words=($line[1] "${words[@]}") + (( CURRENT += 1 )) + curcontext="${curcontext%:*:*}:rustup-self-command-$line[1]:" + case $line[1] in + (update) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; +(uninstall) +_arguments "${_arguments_options[@]}" \ +'-y[]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; +(upgrade-data) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; +(help) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; + esac + ;; +esac +;; +(set) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +":: :_rustup__set_commands" \ +"*::: :->set" \ +&& ret=0 +case $state in + (set) + words=($line[1] "${words[@]}") + (( CURRENT += 1 )) + curcontext="${curcontext%:*:*}:rustup-set-command-$line[1]:" + case $line[1] in + (default-host) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +':host_triple:_files' \ +&& ret=0 +;; +(profile) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +':profile-name:(minimal default complete)' \ +&& ret=0 +;; +(help) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; + esac + ;; +esac +;; +(completions) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +'::shell:(zsh bash fish powershell elvish)' \ +'::command:(rustup cargo)' \ +&& ret=0 +;; +(help) +_arguments "${_arguments_options[@]}" \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +&& ret=0 +;; + esac + ;; +esac +} + +(( $+functions[_rustup_commands] )) || +_rustup_commands() { + local commands; commands=( + "dump-testament:Dump information about the build" \ +"show:Show the active and installed toolchains or profiles" \ +"install:Update Rust toolchains" \ +"uninstall:Uninstall Rust toolchains" \ +"update:Update Rust toolchains and rustup" \ +"check:Check for updates to Rust toolchains" \ +"default:Set the default toolchain" \ +"toolchain:Modify or query the installed toolchains" \ +"target:Modify a toolchain's supported targets" \ +"component:Modify a toolchain's installed components" \ +"override:Modify directory toolchain overrides" \ +"run:Run a command with an environment configured for a given toolchain" \ +"which:Display which binary will be run for a given command" \ +"doc:Open the documentation for the current toolchain" \ +"man:View the man page for a given command" \ +"self:Modify the rustup installation" \ +"set:Alter rustup settings" \ +"completions:Generate tab-completion scripts for your shell" \ +"help:Prints this message or the help of the given subcommand(s)" \ + ) + _describe -t commands 'rustup commands' commands "$@" +} +(( $+functions[_rustup__show__active-toolchain_commands] )) || +_rustup__show__active-toolchain_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup show active-toolchain commands' commands "$@" +} +(( $+functions[_rustup__add_commands] )) || +_rustup__add_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup add commands' commands "$@" +} +(( $+functions[_rustup__component__add_commands] )) || +_rustup__component__add_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup component add commands' commands "$@" +} +(( $+functions[_rustup__override__add_commands] )) || +_rustup__override__add_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup override add commands' commands "$@" +} +(( $+functions[_rustup__target__add_commands] )) || +_rustup__target__add_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup target add commands' commands "$@" +} +(( $+functions[_rustup__toolchain__add_commands] )) || +_rustup__toolchain__add_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup toolchain add commands' commands "$@" +} +(( $+functions[_rustup__check_commands] )) || +_rustup__check_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup check commands' commands "$@" +} +(( $+functions[_rustup__completions_commands] )) || +_rustup__completions_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup completions commands' commands "$@" +} +(( $+functions[_rustup__component_commands] )) || +_rustup__component_commands() { + local commands; commands=( + "list:List installed and available components" \ +"add:Add a component to a Rust toolchain" \ +"remove:Remove a component from a Rust toolchain" \ +"help:Prints this message or the help of the given subcommand(s)" \ + ) + _describe -t commands 'rustup component commands' commands "$@" +} +(( $+functions[_rustup__default_commands] )) || +_rustup__default_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup default commands' commands "$@" +} +(( $+functions[_rustup__set__default-host_commands] )) || +_rustup__set__default-host_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup set default-host commands' commands "$@" +} +(( $+functions[_rustup__doc_commands] )) || +_rustup__doc_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup doc commands' commands "$@" +} +(( $+functions[_docs_commands] )) || +_docs_commands() { + local commands; commands=( + + ) + _describe -t commands 'docs commands' commands "$@" +} +(( $+functions[_rustup__docs_commands] )) || +_rustup__docs_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup docs commands' commands "$@" +} +(( $+functions[_rustup__dump-testament_commands] )) || +_rustup__dump-testament_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup dump-testament commands' commands "$@" +} +(( $+functions[_rustup__component__help_commands] )) || +_rustup__component__help_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup component help commands' commands "$@" +} +(( $+functions[_rustup__help_commands] )) || +_rustup__help_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup help commands' commands "$@" +} +(( $+functions[_rustup__override__help_commands] )) || +_rustup__override__help_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup override help commands' commands "$@" +} +(( $+functions[_rustup__self__help_commands] )) || +_rustup__self__help_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup self help commands' commands "$@" +} +(( $+functions[_rustup__set__help_commands] )) || +_rustup__set__help_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup set help commands' commands "$@" +} +(( $+functions[_rustup__show__help_commands] )) || +_rustup__show__help_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup show help commands' commands "$@" +} +(( $+functions[_rustup__target__help_commands] )) || +_rustup__target__help_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup target help commands' commands "$@" +} +(( $+functions[_rustup__toolchain__help_commands] )) || +_rustup__toolchain__help_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup toolchain help commands' commands "$@" +} +(( $+functions[_rustup__show__home_commands] )) || +_rustup__show__home_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup show home commands' commands "$@" +} +(( $+functions[_rustup__install_commands] )) || +_rustup__install_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup install commands' commands "$@" +} +(( $+functions[_rustup__target__install_commands] )) || +_rustup__target__install_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup target install commands' commands "$@" +} +(( $+functions[_rustup__toolchain__install_commands] )) || +_rustup__toolchain__install_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup toolchain install commands' commands "$@" +} +(( $+functions[_rustup__show__keys_commands] )) || +_rustup__show__keys_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup show keys commands' commands "$@" +} +(( $+functions[_rustup__toolchain__link_commands] )) || +_rustup__toolchain__link_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup toolchain link commands' commands "$@" +} +(( $+functions[_rustup__component__list_commands] )) || +_rustup__component__list_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup component list commands' commands "$@" +} +(( $+functions[_rustup__override__list_commands] )) || +_rustup__override__list_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup override list commands' commands "$@" +} +(( $+functions[_rustup__target__list_commands] )) || +_rustup__target__list_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup target list commands' commands "$@" +} +(( $+functions[_rustup__toolchain__list_commands] )) || +_rustup__toolchain__list_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup toolchain list commands' commands "$@" +} +(( $+functions[_rustup__man_commands] )) || +_rustup__man_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup man commands' commands "$@" +} +(( $+functions[_rustup__override_commands] )) || +_rustup__override_commands() { + local commands; commands=( + "list:List directory toolchain overrides" \ +"set:Set the override toolchain for a directory" \ +"unset:Remove the override toolchain for a directory" \ +"help:Prints this message or the help of the given subcommand(s)" \ + ) + _describe -t commands 'rustup override commands' commands "$@" +} +(( $+functions[_rustup__set__profile_commands] )) || +_rustup__set__profile_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup set profile commands' commands "$@" +} +(( $+functions[_rustup__show__profile_commands] )) || +_rustup__show__profile_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup show profile commands' commands "$@" +} +(( $+functions[_rustup__component__remove_commands] )) || +_rustup__component__remove_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup component remove commands' commands "$@" +} +(( $+functions[_rustup__override__remove_commands] )) || +_rustup__override__remove_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup override remove commands' commands "$@" +} +(( $+functions[_rustup__remove_commands] )) || +_rustup__remove_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup remove commands' commands "$@" +} +(( $+functions[_rustup__target__remove_commands] )) || +_rustup__target__remove_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup target remove commands' commands "$@" +} +(( $+functions[_rustup__toolchain__remove_commands] )) || +_rustup__toolchain__remove_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup toolchain remove commands' commands "$@" +} +(( $+functions[_rustup__run_commands] )) || +_rustup__run_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup run commands' commands "$@" +} +(( $+functions[_rustup__self_commands] )) || +_rustup__self_commands() { + local commands; commands=( + "update:Download and install updates to rustup" \ +"uninstall:Uninstall rustup." \ +"upgrade-data:Upgrade the internal data format." \ +"help:Prints this message or the help of the given subcommand(s)" \ + ) + _describe -t commands 'rustup self commands' commands "$@" +} +(( $+functions[_rustup__override__set_commands] )) || +_rustup__override__set_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup override set commands' commands "$@" +} +(( $+functions[_rustup__set_commands] )) || +_rustup__set_commands() { + local commands; commands=( + "default-host:The triple used to identify toolchains when not specified" \ +"profile:The default components installed" \ +"help:Prints this message or the help of the given subcommand(s)" \ + ) + _describe -t commands 'rustup set commands' commands "$@" +} +(( $+functions[_rustup__show_commands] )) || +_rustup__show_commands() { + local commands; commands=( + "active-toolchain:Show the active toolchain" \ +"home:Display the computed value of RUSTUP_HOME" \ +"profile:Show the current profile" \ +"keys:Display the known PGP keys" \ +"help:Prints this message or the help of the given subcommand(s)" \ + ) + _describe -t commands 'rustup show commands' commands "$@" +} +(( $+functions[_rustup__target_commands] )) || +_rustup__target_commands() { + local commands; commands=( + "list:List installed and available targets" \ +"add:Add a target to a Rust toolchain" \ +"remove:Remove a target from a Rust toolchain" \ +"help:Prints this message or the help of the given subcommand(s)" \ + ) + _describe -t commands 'rustup target commands' commands "$@" +} +(( $+functions[_rustup__toolchain_commands] )) || +_rustup__toolchain_commands() { + local commands; commands=( + "list:List installed toolchains" \ +"install:Install or update a given toolchain" \ +"uninstall:Uninstall a toolchain" \ +"link:Create a custom toolchain by symlinking to a directory" \ +"help:Prints this message or the help of the given subcommand(s)" \ + ) + _describe -t commands 'rustup toolchain commands' commands "$@" +} +(( $+functions[_rustup__self__uninstall_commands] )) || +_rustup__self__uninstall_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup self uninstall commands' commands "$@" +} +(( $+functions[_rustup__target__uninstall_commands] )) || +_rustup__target__uninstall_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup target uninstall commands' commands "$@" +} +(( $+functions[_rustup__toolchain__uninstall_commands] )) || +_rustup__toolchain__uninstall_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup toolchain uninstall commands' commands "$@" +} +(( $+functions[_rustup__uninstall_commands] )) || +_rustup__uninstall_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup uninstall commands' commands "$@" +} +(( $+functions[_rustup__override__unset_commands] )) || +_rustup__override__unset_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup override unset commands' commands "$@" +} +(( $+functions[_rustup__self__update_commands] )) || +_rustup__self__update_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup self update commands' commands "$@" +} +(( $+functions[_rustup__toolchain__update_commands] )) || +_rustup__toolchain__update_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup toolchain update commands' commands "$@" +} +(( $+functions[_rustup__update_commands] )) || +_rustup__update_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup update commands' commands "$@" +} +(( $+functions[_rustup__self__upgrade-data_commands] )) || +_rustup__self__upgrade-data_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup self upgrade-data commands' commands "$@" +} +(( $+functions[_rustup__which_commands] )) || +_rustup__which_commands() { + local commands; commands=( + + ) + _describe -t commands 'rustup which commands' commands "$@" +} + +_rustup "$@" \ No newline at end of file -- cgit v1.2.3-70-g09d2 From 3e14fdd6b4cbe156da6a59a33af36b11859ad554 Mon Sep 17 00:00:00 2001 From: Emanuel Alarcón Date: Mon, 18 May 2020 06:48:44 -0300 Subject: bundler: add alias for bundle check (#5000) --- plugins/bundler/bundler.plugin.zsh | 1 + 1 file changed, 1 insertion(+) (limited to 'plugins') diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh index 665cb5e43..b1fd8339b 100644 --- a/plugins/bundler/bundler.plugin.zsh +++ b/plugins/bundler/bundler.plugin.zsh @@ -6,6 +6,7 @@ alias bout="bundle outdated" alias bu="bundle update" alias bi="bundle_install" alias bcn="bundle clean" +alias bck="bundle check" bundled_commands=( annotate -- cgit v1.2.3-70-g09d2 From 4012df8fbb449bd551400c66f7602452bbae0bd1 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Mon, 18 May 2020 11:53:34 +0200 Subject: bundler: add alias for bundle add Fixes #8892 --- plugins/bundler/README.md | 19 ++++++++++++++----- plugins/bundler/bundler.plugin.zsh | 1 + 2 files changed, 15 insertions(+), 5 deletions(-) (limited to 'plugins') diff --git a/plugins/bundler/README.md b/plugins/bundler/README.md index 9f211b02f..a3bceb0ae 100644 --- a/plugins/bundler/README.md +++ b/plugins/bundler/README.md @@ -1,7 +1,9 @@ # Bundler -- adds completion for basic bundler commands -- adds short aliases for common bundler commands +- Adds completion for basic bundler commands + +- Adds short aliases for common bundler commands + - `ba` aliased to `bundle add` - `be` aliased to `bundle exec`. It also supports aliases (if `rs` is `rails server`, `be rs` will bundle-exec `rails server`). - `bl` aliased to `bundle list` @@ -10,9 +12,12 @@ - `bout` aliased to `bundle outdated` - `bu` aliased to `bundle update` - `bi` aliased to `bundle install --jobs=` (only for bundler `>= 1.4.0`) -- adds a wrapper for common gems: - - looks for a binstub under `./bin/` and executes it (if present) - - calls `bundle exec ` otherwise + - `bcn` aliased to `bundle clean` + - `bck` aliased to `bundle check` + +- Adds a wrapper for common gems: + - Looks for a binstub under `./bin/` and executes it (if present) + - Calls `bundle exec ` otherwise Common gems wrapped by default (by name of the executable): `annotate`, `cap`, `capify`, `cucumber`, `foodcritic`, `guard`, `hanami`, `irb`, `jekyll`, `kitchen`, `knife`, `middleman`, `nanoc`, `pry`, `puma`, `rackup`, `rainbows`, `rake`, `rspec`, `rubocop`, `shotgun`, `sidekiq`, `spec`, `spork`, `spring`, `strainer`, `tailor`, `taps`, `thin`, `thor`, `unicorn` and `unicorn_rails`. @@ -24,20 +29,24 @@ Please use the exact name of the executable and not the gem name. ### Add additional gems to be wrapped Add this before the plugin-list in your `.zshrc`: + ```sh BUNDLED_COMMANDS=(rubocop) plugins=(... bundler ...) ``` + This will add the wrapper for the `rubocop` gem (i.e. the executable). ### Exclude gems from being wrapped Add this before the plugin-list in your `.zshrc`: + ```sh UNBUNDLED_COMMANDS=(foreman spin) plugins=(... bundler ...) ``` + This will exclude the `foreman` and `spin` gems (i.e. their executable) from being wrapped. ## Excluded gems diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh index b1fd8339b..65b0ffa6e 100644 --- a/plugins/bundler/bundler.plugin.zsh +++ b/plugins/bundler/bundler.plugin.zsh @@ -1,3 +1,4 @@ +alias ba="bundle add" alias be="bundle exec" alias bl="bundle list" alias bp="bundle package" -- cgit v1.2.3-70-g09d2 From 8b51d17c469a7bafa1193d8af2a52e0d4c645eef Mon Sep 17 00:00:00 2001 From: Will Mendes Date: Tue, 19 May 2020 11:33:47 -0300 Subject: frontend-search: add packagephobia (#8908) --- plugins/frontend-search/README.md | 1 + plugins/frontend-search/_frontend-search.sh | 4 ++++ plugins/frontend-search/frontend-search.plugin.zsh | 6 ++++-- 3 files changed, 9 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/frontend-search/README.md b/plugins/frontend-search/README.md index ddcb3d72b..050058931 100644 --- a/plugins/frontend-search/README.md +++ b/plugins/frontend-search/README.md @@ -52,6 +52,7 @@ Available search contexts are: | mdn | `https://developer.mozilla.org/search?q=` | | nodejs | `https://www.google.com/search?as_sitesearch=nodejs.org/en/docs/&as_q=` | | npmjs | `https://www.npmjs.com/search?q=` | +| packagephobia | `https://packagephobia.now.sh/result?p=` | | qunit | `https://api.qunitjs.com/?s=` | | reactjs | `https://google.com/search?as_sitesearch=facebook.github.io/react&as_q=` | | smacss | `https://google.com/search?as_sitesearch=smacss.com&as_q=` | diff --git a/plugins/frontend-search/_frontend-search.sh b/plugins/frontend-search/_frontend-search.sh index c59640e74..15f8d239d 100644 --- a/plugins/frontend-search/_frontend-search.sh +++ b/plugins/frontend-search/_frontend-search.sh @@ -38,6 +38,7 @@ function _frontend() { 'mdn: Search in MDN website' 'nodejs: Search in NodeJS website' 'npmjs: Search in NPMJS website' + 'packagephobia: Search in Packagephobia website' 'qunit: Search in Qunit website' 'reactjs: Search in React website' 'smacss: Search in SMACSS website' @@ -124,6 +125,9 @@ function _frontend() { bundlephobia) _describe -t points "Warp points" frontend_points && ret=0 ;; + packagephobia) + _describe -t points "Warp points" frontend_points && ret=0 + ;; flowtype) _describe -t points "Warp points" frontend_points && ret=0 ;; diff --git a/plugins/frontend-search/frontend-search.plugin.zsh b/plugins/frontend-search/frontend-search.plugin.zsh index ed19280c4..4517e21a8 100644 --- a/plugins/frontend-search/frontend-search.plugin.zsh +++ b/plugins/frontend-search/frontend-search.plugin.zsh @@ -19,6 +19,7 @@ alias lodash='frontend lodash' alias mdn='frontend mdn' alias nodejs='frontend nodejs' alias npmjs='frontend npmjs' +alias packagephobia='frontend packagephobia' alias qunit='frontend qunit' alias reactjs='frontend reactjs' alias smacss='frontend smacss' @@ -65,6 +66,7 @@ function frontend() { mdn 'https://developer.mozilla.org/search?q=' nodejs $(_frontend_fallback 'nodejs.org/en/docs/') npmjs 'https://www.npmjs.com/search?q=' + packagephobia 'https://packagephobia.now.sh/result?p=' qunit 'https://api.qunitjs.com/?s=' reactjs $(_frontend_fallback 'reactjs.org/') smacss $(_frontend_fallback 'smacss.com') @@ -82,7 +84,7 @@ function frontend() { print -P "%Uterm%u and what follows is what will be searched for in the %Ucontext%u website," print -P "and %Ucontext%u is one of the following:" print -P "" - print -P " angular, angularjs, bem, bootsnipp, caniuse, codepen, compassdoc, cssflow," + print -P " angular, angularjs, bem, bootsnipp, caniuse, codepen, compassdoc, cssflow, packagephobia" print -P " dartlang, emberjs, fontello, flowtype, github, html5please, jestjs, jquery, lodash," print -P " mdn, npmjs, nodejs, qunit, reactjs, smacss, stackoverflow, unheap, vuejs, bundlephobia" print -P "" @@ -98,7 +100,7 @@ function frontend() { echo "" echo "Valid contexts are:" echo "" - echo " angular, angularjs, bem, bootsnipp, caniuse, codepen, compassdoc, cssflow," + echo " angular, angularjs, bem, bootsnipp, caniuse, codepen, compassdoc, cssflow, packagephobia" echo " dartlang, emberjs, fontello, github, html5please, jest, jquery, lodash," echo " mdn, npmjs, nodejs, qunit, reactjs, smacss, stackoverflow, unheap, vuejs, bundlephobia" echo "" -- cgit v1.2.3-70-g09d2 From 9050ed34d1f58e09012ed88db8bed1a0d7e74fb1 Mon Sep 17 00:00:00 2001 From: R Max Espinoza Date: Thu, 21 May 2020 17:56:13 +0200 Subject: pipenv: fix error when Pipfile is not a file (#8931) --- plugins/pipenv/pipenv.plugin.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/pipenv/pipenv.plugin.zsh b/plugins/pipenv/pipenv.plugin.zsh index ec41c3e02..e7a9e6b3c 100644 --- a/plugins/pipenv/pipenv.plugin.zsh +++ b/plugins/pipenv/pipenv.plugin.zsh @@ -7,7 +7,7 @@ compdef _pipenv pipenv # Automatic pipenv shell activation/deactivation _togglePipenvShell() { # deactivate shell if Pipfile doesn't exist and not in a subdir - if [[ ! -a "$PWD/Pipfile" ]]; then + if [[ ! -f "$PWD/Pipfile" ]]; then if [[ "$PIPENV_ACTIVE" == 1 ]]; then if [[ "$PWD" != "$pipfile_dir"* ]]; then exit @@ -17,7 +17,7 @@ _togglePipenvShell() { # activate the shell if Pipfile exists if [[ "$PIPENV_ACTIVE" != 1 ]]; then - if [[ -a "$PWD/Pipfile" ]]; then + if [[ -f "$PWD/Pipfile" ]]; then export pipfile_dir="$PWD" pipenv shell fi -- cgit v1.2.3-70-g09d2 From 31c2dc32c2b8e270d0ae10ddc059e192f70f204c Mon Sep 17 00:00:00 2001 From: Dmitry <32256512+shvimas@users.noreply.github.com> Date: Thu, 21 May 2020 19:11:18 +0300 Subject: jira: add tempo command (#8928) --- plugins/jira/README.md | 1 + plugins/jira/_jira | 1 + plugins/jira/jira.plugin.zsh | 3 +++ 3 files changed, 5 insertions(+) (limited to 'plugins') diff --git a/plugins/jira/README.md b/plugins/jira/README.md index a211e34e0..a5633af77 100644 --- a/plugins/jira/README.md +++ b/plugins/jira/README.md @@ -19,6 +19,7 @@ jira # performs the default action jira new # opens a new issue jira dashboard # opens your JIRA dashboard +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 myissues # queries for you own issues diff --git a/plugins/jira/_jira b/plugins/jira/_jira index d64614233..1ac3eeda3 100644 --- a/plugins/jira/_jira +++ b/plugins/jira/_jira @@ -5,6 +5,7 @@ local -a _1st_arguments _1st_arguments=( 'new:create a new issue' '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' diff --git a/plugins/jira/jira.plugin.zsh b/plugins/jira/jira.plugin.zsh index cb46f540b..22807e0ae 100644 --- a/plugins/jira/jira.plugin.zsh +++ b/plugins/jira/jira.plugin.zsh @@ -54,6 +54,9 @@ function jira() { else open_command "${jira_url}/secure/Dashboard.jspa" fi + elif [[ "$action" == "tempo" ]]; then + echo "Opening tempo" + open_command "${jira_url}/secure/Tempo.jspa" elif [[ "$action" == "dumpconfig" ]]; then echo "JIRA_URL=$jira_url" echo "JIRA_PREFIX=$jira_prefix" -- cgit v1.2.3-70-g09d2 From d8f674cc8e4a3139db6bd10ea28a27e36aab0088 Mon Sep 17 00:00:00 2001 From: Mikael Andersson Wigander Date: Thu, 21 May 2020 18:13:14 +0200 Subject: git: exclude 'development' in gdba alias (#8902) --- plugins/git/README.md | 2 +- plugins/git/git.plugin.zsh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/git/README.md b/plugins/git/README.md index dbe565634..b355f72ce 100644 --- a/plugins/git/README.md +++ b/plugins/git/README.md @@ -22,7 +22,7 @@ plugins=(... git) | gb | git branch | | gba | git branch -a | | gbd | git branch -d | -| gbda | git branch --no-color --merged \| command grep -vE "^(\+\|\*\|\s*(master\|develop\|dev)\s*$)" \| command xargs -n 1 git branch -d | +| gbda | git branch --no-color --merged \| command grep -vE "^(\+\|\*\|\s*(master\|development\|develop\|dev)\s*$)" \| command xargs -n 1 git branch -d | | gbD | git branch -D | | gbl | git blame -b -w | | gbnm | git branch --no-merged | diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 3ff5b1f5a..474d7d85d 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -42,7 +42,7 @@ alias gap='git apply' alias gb='git branch' alias gba='git branch -a' alias gbd='git branch -d' -alias gbda='git branch --no-color --merged | command grep -vE "^(\+|\*|\s*(master|develop|dev)\s*$)" | command xargs -n 1 git branch -d' +alias gbda='git branch --no-color --merged | command grep -vE "^(\+|\*|\s*(master|development|develop|dev)\s*$)" | command xargs -n 1 git branch -d' alias gbD='git branch -D' alias gbl='git blame -b -w' alias gbnm='git branch --no-merged' -- cgit v1.2.3-70-g09d2 From 25d0b2dfbd4f4c915a9c04e29a97b82ebd4e612c Mon Sep 17 00:00:00 2001 From: wurza Date: Thu, 21 May 2020 20:24:43 +0200 Subject: man: look for man page for subcommands (#8798) --- plugins/man/man.plugin.zsh | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'plugins') diff --git a/plugins/man/man.plugin.zsh b/plugins/man/man.plugin.zsh index 3ab15d323..dcba613ae 100644 --- a/plugins/man/man.plugin.zsh +++ b/plugins/man/man.plugin.zsh @@ -16,16 +16,22 @@ man-command-line() { # if there is no command typed, use the last command [[ -z "$BUFFER" ]] && zle up-history - # prepend man to only the first part of the typed command + # if typed command begins with man, do nothing + [[ "$BUFFER" = man\ * ]] && return + + # get command and possible subcommand # http://zsh.sourceforge.net/Doc/Release/Expansion.html#Parameter-Expansion-Flags - [[ "$BUFFER" != man\ * ]] && BUFFER="man ${${(Az)BUFFER}[1]}" + local -a args + args=(${${(Az)BUFFER}[1]} ${${(Az)BUFFER}[2]}) + + # check if man page exists for command and first argument + if man "${args[1]}-${args[2]}" >/dev/null 2>&1; then + BUFFER="man $args" + else + BUFFER="man ${args[1]}" + fi } + zle -N man-command-line # Defined shortcut keys: [Esc]man bindkey "\e"man man-command-line - - -# ------------------------------------------------------------------------------ -# Also, you might want to use man-preview included in 'osx' plugin -# just substitute "man" in the function with "man-preview" after you included OS X in -# the .zshrc -- cgit v1.2.3-70-g09d2 From a25efd1e311f19baef083ac885467bce2dd2f555 Mon Sep 17 00:00:00 2001 From: David Date: Fri, 22 May 2020 10:54:10 -0400 Subject: git: exclude devel branch from list in gbda alias (#8957) --- plugins/git/README.md | 2 +- plugins/git/git.plugin.zsh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/git/README.md b/plugins/git/README.md index b355f72ce..7406dde27 100644 --- a/plugins/git/README.md +++ b/plugins/git/README.md @@ -22,7 +22,7 @@ plugins=(... git) | gb | git branch | | gba | git branch -a | | gbd | git branch -d | -| gbda | git branch --no-color --merged \| command grep -vE "^(\+\|\*\|\s*(master\|development\|develop\|dev)\s*$)" \| command xargs -n 1 git branch -d | +| gbda | git branch --no-color --merged \| command grep -vE "^(\+\|\*\|\s*(master\|development\|develop\|devel\|dev)\s*$)" \| command xargs -n 1 git branch -d | | gbD | git branch -D | | gbl | git blame -b -w | | gbnm | git branch --no-merged | diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 474d7d85d..32c720c6f 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -42,7 +42,7 @@ alias gap='git apply' alias gb='git branch' alias gba='git branch -a' alias gbd='git branch -d' -alias gbda='git branch --no-color --merged | command grep -vE "^(\+|\*|\s*(master|development|develop|dev)\s*$)" | command xargs -n 1 git branch -d' +alias gbda='git branch --no-color --merged | command grep -vE "^(\+|\*|\s*(master|development|develop|devel|dev)\s*$)" | command xargs -n 1 git branch -d' alias gbD='git branch -D' alias gbl='git blame -b -w' alias gbnm='git branch --no-merged' -- cgit v1.2.3-70-g09d2 From 77b409d5c200f993256b5ad4679490d9d1db8e24 Mon Sep 17 00:00:00 2001 From: larumbe Date: Fri, 22 May 2020 15:56:03 +0100 Subject: git: add convenience aliases for `git apply` and `git am` (#8563) --- plugins/git/README.md | 6 ++++++ plugins/git/git.plugin.zsh | 7 +++++++ 2 files changed, 13 insertions(+) (limited to 'plugins') diff --git a/plugins/git/README.md b/plugins/git/README.md index 7406dde27..650a4505b 100644 --- a/plugins/git/README.md +++ b/plugins/git/README.md @@ -19,6 +19,7 @@ plugins=(... git) | gau | git add --update | | gav | git add --verbose | | gap | git apply | +| gapt | git apply --3way | | gb | git branch | | gba | git branch -a | | gbd | git branch -d | @@ -171,6 +172,11 @@ plugins=(... git) | glum | git pull upstream master | | gwch | git whatchanged -p --abbrev-commit --pretty=medium | | gwip | git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign -m "--wip-- [skip ci]" | +| gam | git am | +| gamc | git am --continue | +| gams | git am --skip | +| gama | git am --abort | +| gamscp | git am --show-current-patch | ### Deprecated aliases diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 32c720c6f..855a746b4 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -38,6 +38,7 @@ alias gapa='git add --patch' alias gau='git add --update' alias gav='git add --verbose' alias gap='git apply' +alias gapt='git apply --3way' alias gb='git branch' alias gba='git branch -a' @@ -257,6 +258,12 @@ alias glum='git pull upstream master' alias gwch='git whatchanged -p --abbrev-commit --pretty=medium' alias gwip='git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign -m "--wip-- [skip ci]"' +alias gam='git am' +alias gamc='git am --continue' +alias gams='git am --skip' +alias gama='git am --abort' +alias gamscp='git am --show-current-patch' + function grename() { if [[ -z "$1" || -z "$2" ]]; then echo "Usage: $0 old_branch new_branch" -- cgit v1.2.3-70-g09d2 From 570729f22147584016ca02e0b979f7b40f9659c5 Mon Sep 17 00:00:00 2001 From: Paul Rudkin Date: Fri, 22 May 2020 18:20:31 +0200 Subject: forklift: add support for Forklift distributed via the Setapp (#8803) --- plugins/forklift/forklift.plugin.zsh | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/forklift/forklift.plugin.zsh b/plugins/forklift/forklift.plugin.zsh index 274c4a822..85889481b 100644 --- a/plugins/forklift/forklift.plugin.zsh +++ b/plugins/forklift/forklift.plugin.zsh @@ -1,6 +1,7 @@ # Open folder in ForkLift.app or ForkLift2.app from console # 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 # # Usage: # fl [] @@ -24,6 +25,13 @@ function fl { fi osascript 2>&1 1>/dev/null < Date: Fri, 22 May 2020 18:29:52 +0200 Subject: direnv: check if direnv is installed (#8809) --- plugins/direnv/direnv.plugin.zsh | 3 +++ 1 file changed, 3 insertions(+) (limited to 'plugins') diff --git a/plugins/direnv/direnv.plugin.zsh b/plugins/direnv/direnv.plugin.zsh index d36c4ae5e..5e32c4c23 100644 --- a/plugins/direnv/direnv.plugin.zsh +++ b/plugins/direnv/direnv.plugin.zsh @@ -1,3 +1,6 @@ +# Don't continue if direnv is not found +command -v direnv &>/dev/null || return + _direnv_hook() { trap -- '' SIGINT; eval "$(direnv export zsh)"; -- cgit v1.2.3-70-g09d2 From ff0d4909152ad30a07f475d60a59a697e18961dd Mon Sep 17 00:00:00 2001 From: Stanisław Date: Fri, 22 May 2020 20:07:23 +0200 Subject: git: clarify what the glp alias does (#8850) --- plugins/git/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/git/README.md b/plugins/git/README.md index 650a4505b..dde60fe13 100644 --- a/plugins/git/README.md +++ b/plugins/git/README.md @@ -101,7 +101,7 @@ plugins=(... git) | glola | git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --all | | glog | git log --oneline --decorate --graph | | gloga | git log --oneline --decorate --graph --all | -| glp | `_git_log_prettily` | +| glp | git log --pretty=\ | | gm | git merge | | gmom | git merge origin/master | | gmt | git mergetool --no-prompt | -- cgit v1.2.3-70-g09d2 From 24c2b755ca74d43abed345e39b3878cdd4ab92ae Mon Sep 17 00:00:00 2001 From: Mohammad Saboorian <1073738+castedmo@users.noreply.github.com> Date: Sat, 23 May 2020 16:21:50 +0100 Subject: common-aliases: fix hardcoded .zshrc path (#5926) --- plugins/common-aliases/common-aliases.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/common-aliases/common-aliases.plugin.zsh b/plugins/common-aliases/common-aliases.plugin.zsh index ce1995c03..023b1a51e 100644 --- a/plugins/common-aliases/common-aliases.plugin.zsh +++ b/plugins/common-aliases/common-aliases.plugin.zsh @@ -13,7 +13,7 @@ alias lS='ls -1FSsh' alias lart='ls -1Fcart' alias lrt='ls -1Fcrt' -alias zshrc='${=EDITOR} ~/.zshrc' # Quick access to the ~/.zshrc file +alias zshrc='${=EDITOR} ${ZDOTDIR:-$HOME}/.zshrc' # Quick access to the .zshrc file alias grep='grep --color' alias sgrep='grep -R -n -H -C 5 --exclude-dir={.git,.svn,CVS} ' -- cgit v1.2.3-70-g09d2 From 0a456cb3409bea3f2e7980c03f2d9fb05dbd53d0 Mon Sep 17 00:00:00 2001 From: Kennith Leung Date: Sat, 23 May 2020 09:03:55 -0700 Subject: vagrant: fix vagrant box autocomplete (#8929) --- plugins/vagrant/_vagrant | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/vagrant/_vagrant b/plugins/vagrant/_vagrant index 79c4c6fe6..3e16dbebf 100644 --- a/plugins/vagrant/_vagrant +++ b/plugins/vagrant/_vagrant @@ -64,7 +64,7 @@ __task_list () __box_list () { - _wanted application expl 'command' compadd $(command vagrant box list | sed -e 's/ /\\ /g') + _wanted application expl 'command' compadd $(command vagrant box list | sed -e 's/ *(.*)//g;s/ /\\ /g') } __vm_list () -- cgit v1.2.3-70-g09d2 From e675c821f23bf4990c927bbc708401c71b5d8426 Mon Sep 17 00:00:00 2001 From: Zhong Lufan Date: Sun, 24 May 2020 00:15:46 +0800 Subject: archlinux: fix pacweb with non-English locales (#8916) --- plugins/archlinux/archlinux.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/archlinux/archlinux.plugin.zsh b/plugins/archlinux/archlinux.plugin.zsh index 6ccef85c5..2d0c51b3d 100644 --- a/plugins/archlinux/archlinux.plugin.zsh +++ b/plugins/archlinux/archlinux.plugin.zsh @@ -208,7 +208,7 @@ function pacmansignkeys() { if (( $+commands[xdg-open] )); then function pacweb() { pkg="$1" - infos="$(pacman -Si "$pkg")" + infos="$(LANG=C pacman -Si "$pkg")" if [[ -z "$infos" ]]; then return fi -- cgit v1.2.3-70-g09d2 From 10538d11058dfc02c9399062aaa2e1fa584135b2 Mon Sep 17 00:00:00 2001 From: Vinícius Picossi Teruel Date: Sat, 23 May 2020 13:33:50 -0300 Subject: docker: update to latest upstream completion (92dc906) (#8835) --- plugins/docker/_docker | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'plugins') diff --git a/plugins/docker/_docker b/plugins/docker/_docker index 54b5e59c5..10c19e233 100644 --- a/plugins/docker/_docker +++ b/plugins/docker/_docker @@ -9,6 +9,7 @@ # - Felix Riedel # - Steve Durrheimer # - Vincent Bernat +# - Rohan Verma # # license: # @@ -604,6 +605,7 @@ __docker_container_subcommand() { "($help)*--blkio-weight-device=[Block IO (relative device weight)]:device:Block IO weight: " "($help)*--cap-add=[Add Linux capabilities]:capability: " "($help)*--cap-drop=[Drop Linux capabilities]:capability: " + "($help)--cgroupns=[Cgroup namespace mode to use]:cgroup namespace mode: " "($help)--cgroup-parent=[Parent cgroup for the container]:cgroup: " "($help)--cidfile=[Write the container ID to the file]:CID file:_files" "($help)--cpus=[Number of CPUs (default 0.000)]:cpus: " @@ -676,6 +678,7 @@ __docker_container_subcommand() { "($help -m --memory)"{-m=,--memory=}"[Memory limit]:Memory limit: " "($help)--memory-reservation=[Memory soft limit]:Memory limit: " "($help)--memory-swap=[Total memory limit with swap]:Memory limit: " + "($help)--pids-limit[Tune container pids limit (set -1 for unlimited)]" "($help)--restart=[Restart policy]:restart policy:(no on-failure always unless-stopped)" ) opts_help=("(: -)--help[Print usage]") @@ -801,7 +804,7 @@ __docker_container_subcommand() { "($help -l --latest)"{-l,--latest}"[Show only the latest created container]" \ "($help -n --last)"{-n=,--last=}"[Show n last created containers (includes all states)]:n:(1 5 10 25 50)" \ "($help)--no-trunc[Do not truncate output]" \ - "($help -q --quiet)"{-q,--quiet}"[Only show numeric IDs]" \ + "($help -q --quiet)"{-q,--quiet}"[Only show container IDs]" \ "($help -s --size)"{-s,--size}"[Display total file sizes]" \ "($help)--since=[Show only containers created since...]:containers:__docker_complete_containers" && ret=0 ;; @@ -832,7 +835,7 @@ __docker_container_subcommand() { _arguments $(__docker_arguments) \ $opts_help \ "($help -t --time)"{-t=,--time=}"[Number of seconds to try to stop for before killing the container]:seconds to before killing:(1 5 10 30 60)" \ - "($help -)*:containers:__docker_complete_containers_ids" && ret=0 + "($help -)*:containers:__docker_complete_containers" && ret=0 ;; (rm) local state @@ -1024,7 +1027,7 @@ __docker_image_subcommand() { $opts_help \ "($help -H --human)"{-H,--human}"[Print sizes and dates in human readable format]" \ "($help)--no-trunc[Do not truncate output]" \ - "($help -q --quiet)"{-q,--quiet}"[Only show numeric IDs]" \ + "($help -q --quiet)"{-q,--quiet}"[Only show image IDs]" \ "($help -)*: :__docker_complete_images" && ret=0 ;; (import) @@ -1056,7 +1059,7 @@ __docker_image_subcommand() { "($help)*"{-f=,--filter=}"[Filter values]:filter:__docker_complete_images_filters" \ "($help)--format=[Pretty-print images using a Go template]:template: " \ "($help)--no-trunc[Do not truncate output]" \ - "($help -q --quiet)"{-q,--quiet}"[Only show numeric IDs]" \ + "($help -q --quiet)"{-q,--quiet}"[Only show image IDs]" \ "($help -): :__docker_complete_repositories" && ret=0 ;; (prune) @@ -1076,6 +1079,7 @@ __docker_image_subcommand() { (push) _arguments $(__docker_arguments) \ $opts_help \ + "($help -a --all-tags)"{-a,--all-tags}"[Push all tagged images in the repository]" \ "($help)--disable-content-trust[Skip image signing]" \ "($help -): :__docker_complete_images" && ret=0 ;; @@ -1286,7 +1290,7 @@ __docker_network_subcommand() { "($help)--no-trunc[Do not truncate the output]" \ "($help)*"{-f=,--filter=}"[Provide filter values]:filter:__docker_network_complete_ls_filters" \ "($help)--format=[Pretty-print networks using a Go template]:template: " \ - "($help -q --quiet)"{-q,--quiet}"[Only display numeric IDs]" && ret=0 + "($help -q --quiet)"{-q,--quiet}"[Only display network IDs]" && ret=0 ;; (prune) _arguments $(__docker_arguments) \ @@ -2214,7 +2218,6 @@ __docker_stack_subcommand() { (deploy|up) _arguments $(__docker_arguments) \ $opts_help \ - "($help)--bundle-file=[Path to a Distributed Application Bundle file]:dab:_files -g \"*.dab\"" \ "($help -c --compose-file)"{-c=,--compose-file=}"[Path to a Compose file, or '-' to read from stdin]:compose file:_files -g \"*.(yml|yaml)\"" \ "($help)--with-registry-auth[Send registry authentication details to Swarm agents]" \ "($help -):stack:__docker_complete_stacks" && ret=0 @@ -2668,6 +2671,7 @@ __docker_subcommand() { "($help)*--log-opt=[Default log driver options for containers]:log driver options:__docker_complete_log_options" \ "($help)--max-concurrent-downloads[Set the max concurrent downloads for each pull]" \ "($help)--max-concurrent-uploads[Set the max concurrent uploads for each push]" \ + "($help)--max-download-attempts[Set the max download attempts for each pull]" \ "($help)--mtu=[Network MTU]:mtu:(0 576 1420 1500 9000)" \ "($help)--oom-score-adjust=[Set the oom_score_adj for the daemon]:oom-score:(-500)" \ "($help -p --pidfile)"{-p=,--pidfile=}"[Path to use for daemon PID file]:PID file:_files" \ @@ -2783,7 +2787,7 @@ __docker_subcommand() { $opts_help \ "($help -p --password)"{-p=,--password=}"[Password]:password: " \ "($help)--password-stdin[Read password from stdin]" \ - "($help -u --user)"{-u=,--user=}"[Username]:username: " \ + "($help -u --username)"{-u=,--username=}"[Username]:username: " \ "($help -)1:server: " && ret=0 ;; (logout) -- cgit v1.2.3-70-g09d2 From 255ef8d5877f056e80751f45d264326de1688e95 Mon Sep 17 00:00:00 2001 From: Tvrtko Majstorović Date: Sat, 23 May 2020 18:57:13 +0200 Subject: git: add alias for git diff excluding lock files (#8935) --- plugins/git/README.md | 1 + plugins/git/git.plugin.zsh | 5 +++++ 2 files changed, 6 insertions(+) (limited to 'plugins') diff --git a/plugins/git/README.md b/plugins/git/README.md index dde60fe13..8642dd055 100644 --- a/plugins/git/README.md +++ b/plugins/git/README.md @@ -62,6 +62,7 @@ plugins=(... git) | gdct | git describe --tags $(git rev-list --tags --max-count=1) | | gds | git diff --staged | | gdt | git diff-tree --no-commit-id --name-only -r | +| gdnolock | git diff $@ ":(exclude)package-lock.json" ":(exclude)*.lock" | | gdv | git diff -w $@ \| view - | | gdw | git diff --word-diff | | gf | git fetch | diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 855a746b4..1112421bf 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -86,6 +86,11 @@ alias gds='git diff --staged' alias gdt='git diff-tree --no-commit-id --name-only -r' alias gdw='git diff --word-diff' +function gdnolock() { + git diff "$@" ":(exclude)package-lock.json" ":(exclude)*.lock" +} +compdef _git gdnolock=git-diff + function gdv() { git diff -w "$@" | view - } compdef _git gdv=git-diff -- cgit v1.2.3-70-g09d2 From 7c9c148ec245e1e6d54a77963bc4d808508368cf Mon Sep 17 00:00:00 2001 From: Albert Serrallé Ríos Date: Sat, 23 May 2020 19:02:56 +0200 Subject: asdf: fix completions if ASDF_DIR is already exported (#8538) --- plugins/asdf/asdf.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/asdf/asdf.plugin.zsh b/plugins/asdf/asdf.plugin.zsh index 38b225538..c386d57ed 100644 --- a/plugins/asdf/asdf.plugin.zsh +++ b/plugins/asdf/asdf.plugin.zsh @@ -3,7 +3,7 @@ ASDF_DIR="${ASDF_DIR:-$HOME/.asdf}" ASDF_COMPLETIONS="$ASDF_DIR/completions" # If not found, check for Homebrew package -if [[ ! -f "$ASDF_DIR/asdf.sh" ]] && (( $+commands[brew] )); then +if [[ ! -f "$ASDF_DIR/asdf.sh" || ! -f "$ASDF_COMPLETIONS/asdf.bash" ]] && (( $+commands[brew] )); then ASDF_DIR="$(brew --prefix asdf)" ASDF_COMPLETIONS="$ASDF_DIR/etc/bash_completion.d" fi -- cgit v1.2.3-70-g09d2 From 3f245edf1be1592e70d6deca6b3ecb8abf8e1356 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Sat, 23 May 2020 19:03:49 +0200 Subject: rbenv: fix redirect in current_gemset Fixes #8925 Related #4688 --- plugins/rbenv/rbenv.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/rbenv/rbenv.plugin.zsh b/plugins/rbenv/rbenv.plugin.zsh index b446b6363..3c964320a 100644 --- a/plugins/rbenv/rbenv.plugin.zsh +++ b/plugins/rbenv/rbenv.plugin.zsh @@ -34,7 +34,7 @@ if [[ $FOUND_RBENV -eq 1 ]]; then } function current_gemset() { - echo "$(rbenv gemset active 2&>/dev/null | sed -e ":a" -e '$ s/\n/+/gp;N;b a' | head -n1)" + echo "$(rbenv gemset active 2>/dev/null | sed -e ":a" -e '$ s/\n/+/gp;N;b a' | head -n1)" } function gems() { -- cgit v1.2.3-70-g09d2 From dd1df902525c485e575719ef9971f97f3e64a02b Mon Sep 17 00:00:00 2001 From: Mohammad Date: Sat, 23 May 2020 16:33:09 -0400 Subject: python: add line-number to pygrep (#8867) --- plugins/python/python.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/python/python.plugin.zsh b/plugins/python/python.plugin.zsh index 3e4db1e7d..c3c1474c1 100644 --- a/plugins/python/python.plugin.zsh +++ b/plugins/python/python.plugin.zsh @@ -41,7 +41,7 @@ function pyuserpaths() { } # Grep among .py files -alias pygrep='grep -r --include="*.py"' +alias pygrep='grep -nr --include="*.py"' # Run proper IPython regarding current virtualenv (if any) alias ipython="python -c 'import IPython; IPython.terminal.ipapp.launch_new_instance()'" -- cgit v1.2.3-70-g09d2 From 6b5c8728360b1592e4321b8a4b00d8c8b49e64fe Mon Sep 17 00:00:00 2001 From: Fotos Georgiadis Date: Sat, 23 May 2020 22:35:15 +0200 Subject: terraform: add fmt -recursive flag autocompletion (#8880) --- plugins/terraform/_terraform | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/terraform/_terraform b/plugins/terraform/_terraform index 5b3655801..e4298f2ab 100644 --- a/plugins/terraform/_terraform +++ b/plugins/terraform/_terraform @@ -77,7 +77,8 @@ __fmt() { '-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.]' + '-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.]' } __get() { -- cgit v1.2.3-70-g09d2 From f742baf73ccb70c94952717b5152f97a176eef3a Mon Sep 17 00:00:00 2001 From: Renato dos Santos Date: Sat, 23 May 2020 17:35:48 -0300 Subject: Add plugin for LXD autocomplete (#7457) --- plugins/lxd/README.md | 9 +++++++++ plugins/lxd/lxd.plugin.zsh | 26 ++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 plugins/lxd/README.md create mode 100644 plugins/lxd/lxd.plugin.zsh (limited to 'plugins') diff --git a/plugins/lxd/README.md b/plugins/lxd/README.md new file mode 100644 index 000000000..cea45e31c --- /dev/null +++ b/plugins/lxd/README.md @@ -0,0 +1,9 @@ +# lxd + +This plugin provides completion for [lxd](https://linuxcontainers.org/lxd/), as well as aliases +for frequent lxc commands. + +To use it add `lxd` to the plugins array in your zshrc file. + +```zsh +plugins=(... lxd) diff --git a/plugins/lxd/lxd.plugin.zsh b/plugins/lxd/lxd.plugin.zsh new file mode 100644 index 000000000..a6a074252 --- /dev/null +++ b/plugins/lxd/lxd.plugin.zsh @@ -0,0 +1,26 @@ +_lxc_get_command_list () { + $_comp_command1 | sed "1,/Available Commands/d" | awk '/^[ \t]*[a-z]+/ { print $1 }' +} + +_lxc_get_subcommand_list () { + $_comp_command1 ${words[2]} | sed "1,/Available Commands/d" | awk '/^[ \t]*[a-z]+/ { print $1 }' +} + +_lxc () { + local curcontext="$curcontext" state line + typeset -A opt_args + _arguments \ + '1: :->command'\ + '*: :->args' + + case $state in + command) + compadd $(_lxc_get_command_list) + ;; + *) + compadd $(_lxc_get_subcommand_list) + ;; + esac +} + +compdef _lxc lxc -- cgit v1.2.3-70-g09d2 From aada4d62bff3fc2e1720da1da4c54d47b5f86fa3 Mon Sep 17 00:00:00 2001 From: Israel Rodrigo Faria Date: Sat, 23 May 2020 17:41:42 -0300 Subject: Add plugin for bazel completion (#6434) --- plugins/bazel/README.md | 5 + plugins/bazel/_bazel | 341 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 346 insertions(+) create mode 100644 plugins/bazel/README.md create mode 100644 plugins/bazel/_bazel (limited to 'plugins') diff --git a/plugins/bazel/README.md b/plugins/bazel/README.md new file mode 100644 index 000000000..e5ffe6ea1 --- /dev/null +++ b/plugins/bazel/README.md @@ -0,0 +1,5 @@ +## Bazel autocomplete plugin + +A copy of the completion script from the +[bazelbuild/bazel](https://github.com/bazelbuild/bazel/master/scripts/zsh_completion/_bazel) +git repo. diff --git a/plugins/bazel/_bazel b/plugins/bazel/_bazel new file mode 100644 index 000000000..827ce545c --- /dev/null +++ b/plugins/bazel/_bazel @@ -0,0 +1,341 @@ +#compdef bazel + +# Copyright 2015 The Bazel Authors. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Installation +# ------------ +# +# 1. Add this script to a directory on your $fpath: +# fpath[1,0]=~/.zsh/completion/ +# mkdir -p ~/.zsh/completion/ +# cp scripts/zsh_completion/_bazel ~/.zsh/completion +# +# 2. Optionally, add the following to your .zshrc. +# zstyle ':completion:*' use-cache on +# zstyle ':completion:*' cache-path ~/.zsh/cache +# +# This way, the completion script does not have to parse Bazel's options +# repeatedly. The directory in cache-path must be created manually. +# +# 3. Restart the shell +# +# Options +# ------- +# completion:init:bazel:* cache-lifetime +# Lifetime for the completion cache (if turned on, default: 1 week) + +local curcontext="$curcontext" state line + +: ${BAZEL_COMPLETION_PACKAGE_PATH:=%workspace%} +: ${BAZEL:=bazel} +_bazel_b() { ${BAZEL} --noblock_for_lock "$@" 2>/dev/null; } + +# Default cache lifetime is 1 week +zstyle -s ":completion:${curcontext}:" cache-lifetime lifetime +if [[ -z "${lifetime}" ]]; then + lifetime=$((60*60*24*7)) +fi + +_bazel_cache_policy() { + local -a oldp + oldp=( "$1"(Nms+${lifetime}) ) + (( $#oldp )) +} + +_set_cache_policy() { + zstyle -s ":completion:*:$curcontext*" cache-policy update_policy + + if [[ -z "$update_policy" ]]; then + zstyle ":completion:$curcontext*" cache-policy _bazel_cache_policy + fi +} + +# Skips over all global arguments. After invocation, OFFSET contains the +# position of the bazel command in $words. +_adapt_subcommand_offset() { + OFFSET=2 + for w in ${words[2,-1]}; do + if [[ $w == (#b)-* ]]; then + (( OFFSET++ )) + else + return + fi + done +} + +# Retrieve the cache but also check that the value is not empty. +_bazel_safe_retrieve_cache() { + _retrieve_cache $1 && [[ ${(P)#2} -gt 0 ]] +} + +# Puts the name of the variable that contains the options for the bazel +# subcommand handed in as the first argument into the global variable +# _bazel_cmd_options. +_bazel_get_options() { + local lcmd=$1 + _bazel_cmd_options=_bazel_${lcmd}_options + _bazel_cmd_args=_bazel_${lcmd}_args + if [[ ${(P)#_bazel_cmd_options} != 0 ]]; then + return + fi + if _cache_invalid BAZEL_${lcmd}_options || _cache_invalid BAZEL_${lcmd}_args \ + || ! _bazel_safe_retrieve_cache BAZEL_${lcmd}_options ${_bazel_cmd_options} \ + || ! _retrieve_cache BAZEL_${lcmd}_args ${_bazel_cmd_args}; then + if ! eval "$(_bazel_b help completion)"; then + return + fi + local opts_var + if [[ $lcmd == "startup_options" ]]; then + opts_var="BAZEL_STARTUP_OPTIONS" + else + opts_var="BAZEL_COMMAND_${lcmd:u}_FLAGS" + fi + local -a raw_options + if ! eval "raw_options=(\${(@f)$opts_var})"; then + return + fi + + local -a option_list + for opt in $raw_options; do + case $opt in + --*"={"*) + local lst="${${opt##*"={"}%"}"}" + local opt="${opt%%=*}=" + option_list+=("${opt}:string:_values '' ${lst//,/ }") ;; + --*=path) + option_list+=("${opt%path}:path:_files") ;; + --*=label) + option_list+=("${opt%label}:target:_bazel_complete_target") ;; + --*=*) + option_list+=("${opt}:string:") ;; + *) + option_list+=("$opt") ;; + esac + done + + local -a cmd_args + local cmd_type + if eval "cmd_type=\${BAZEL_COMMAND_${lcmd:u}_ARGUMENT}" && [[ -n $cmd_type ]]; then + case $cmd_type in + label|label-*) + cmd_args+=("*::${cmd_type}:_bazel_complete_target_${cmd_type//-/_}") ;; + info-key) + cmd_args+=('1::key:_bazel_info_key') ;; + path) + cmd_args+=('1::profile:_path_files') ;; + "command|{"*"}") + local lst=${${cmd_type#"command|{"}%"}"} + cmd_args+=("1::topic:_bazel_help_topic -- ${lst//,/ }") ;; + esac + fi + + typeset -g "${_bazel_cmd_options}"="${(pj:|:)option_list[*]}" + _store_cache BAZEL_${lcmd}_options ${_bazel_cmd_options} + typeset -g "${_bazel_cmd_args}"="${(pj:|:)cmd_args[*]}" + _store_cache BAZEL_${lcmd}_args ${_bazel_cmd_args} + fi +} + +_get_build_targets() { + local pkg=$1 + local rule_re + typeset -a completions + case $target_type in + test) + rule_re=".*_test" + ;; + build) + rule_re=".*" + ;; + bin) + rule_re=".*_test|.*_binary" + ;; + esac + completions=(${$(_bazel_b query "kind(\"${rule_re}\", ${pkg}:all)" 2>/dev/null)##*:}) + if ( (( ${#completions} > 0 )) && [[ $target_type != run ]] ); then + completions+=(all) + fi + echo ${completions[*]} +} + +# Returns all packages that match $PREFIX. PREFIX may start with //, in which +# case the workspace roots are searched. Otherwise, they are completed based on +# PWD. +_get_build_packages() { + local workspace pfx + typeset -a package_roots paths final_paths + workspace=$PWD + package_roots=(${(ps.:.)BAZEL_COMPLETION_PACKAGE_PATH}) + package_roots=(${^package_roots//\%workspace\%/$workspace}) + if [[ "${(e)PREFIX}" == //* ]]; then + pfx=${(e)PREFIX[2,-1]} + else + pfx=${(e)PREFIX} + fi + paths=(${^package_roots}/${pfx}*(/)) + for p in ${paths[*]}; do + if [[ -f ${p}/BUILD || -f ${p}/BUILD.bazel ]]; then + final_paths+=(${p##*/}:) + fi + final_paths+=(${p##*/}/) + done + echo ${final_paths[*]} +} + +_package_remove_slash() { + if [[ $KEYS == ':' && $LBUFFER == */ ]]; then + LBUFFER=${LBUFFER[1,-2]} + fi +} + +# Completion function for BUILD targets, called by the completion system. +_bazel_complete_target() { + local expl + typeset -a packages targets + if [[ "${(e)PREFIX}" != *:* ]]; then + # There is no : in the prefix, completion can be either + # a package or a target, if the cwd is a package itself. + if [[ -f $PWD/BUILD || -f $PWD/BUILD.bazel ]]; then + targets=($(_get_build_targets "")) + _description build_target expl "BUILD target" + compadd "${expl[@]}" -a targets + fi + packages=($(_get_build_packages)) + _description build_package expl "BUILD package" + # Chop of the leading path segments from the prefix for display. + compset -P '*/' + compadd -R _package_remove_slash -S '' "${expl[@]}" -a packages + else + targets=($(_get_build_targets "${${(e)PREFIX}%:*}")) + _description build_target expl "BUILD target" + # Ignore the current prefix for the upcoming completion, since we only list + # the names of the targets, not the full path. + compset -P '*:' + compadd "${expl[@]}" -a targets + fi +} + +_bazel_complete_target_label() { + typeset -g target_type=build + _bazel_complete_target +} + +_bazel_complete_target_label_test() { + typeset -g target_type=test + _bazel_complete_target +} + +_bazel_complete_target_label_bin() { + typeset -g target_type=bin + _bazel_complete_target +} + +### Actual completion commands + +_bazel() { + _adapt_subcommand_offset + if (( CURRENT - OFFSET > 0 )); then + # Remember the subcommand name, stored globally so we can access it + # from any subsequent function + cmd=${words[OFFSET]//-/_} + + # Set the context for the subcommand. + curcontext="${curcontext%:*:*}:bazel-$cmd:" + _set_cache_policy + + # Narrow the range of words we are looking at to exclude cmd + # name and any leading options + (( CURRENT = CURRENT - OFFSET + 1 )) + shift $((OFFSET - 1)) words + # Run the completion for the subcommand + _bazel_get_options $cmd + _arguments : \ + ${(Pps:|:)_bazel_cmd_options} \ + ${(Pps:|:)_bazel_cmd_args} + else + _set_cache_policy + # Start special handling for global options, + # which can be retrieved by calling + # $ bazel help startup_options + _bazel_get_options startup_options + _arguments : \ + ${(Pps:|:)_bazel_cmd_options} \ + "*:commands:_bazel_commands" + fi + return +} + +_get_commands() { + # bazel_cmd_list is a global (g) array (a) + typeset -ga _bazel_cmd_list + # Use `bazel help` instead of `bazel help completion` to get command + # descriptions. + if _bazel_cmd_list=("${(@f)$(_bazel_b help | awk ' +/Available commands/ { command=1; } +/ [-a-z]+[ \t]+.+/ { if (command) { printf "%s:", $1; for (i=2; i<=NF; i++) printf "%s ", $i; print "" } } +/^$/ { command=0; }')}"); then + _store_cache BAZEL_commands _bazel_cmd_list + fi +} + +# Completion function for bazel subcommands, called by the completion system. +_bazel_commands() { + if [[ ${#_bazel_cmd_list} == 0 ]]; then + if _cache_invalid BAZEL_commands \ + || ! _bazel_safe_retrieve_cache BAZEL_commands _bazel_cmd_list; then + _get_commands + fi + fi + + _describe -t bazel-commands 'Bazel command' _bazel_cmd_list +} + +# Completion function for bazel help options, called by the completion system. +_bazel_help_topic() { + if [[ ${#_bazel_cmd_list} == 0 ]]; then + if _cache_invalid BAZEL_commands \ + || ! _bazel_safe_retrieve_cache BAZEL_commands _bazel_cmd_list; then + _get_commands + fi + fi + + while [[ $# -gt 0 ]]; do + if [[ $1 == -- ]]; then + shift + break + fi + shift + done + _bazel_help_list=($@) + _bazel_help_list+=($_bazel_cmd_list) + _describe -t bazel-help 'Help topic' _bazel_help_list +} + +# Completion function for bazel info keys, called by the completion system. +_bazel_info_key() { + if [[ ${#_bazel_info_keys_list} == 0 ]]; then + if _cache_invalid BAZEL_info_keys \ + || ! _bazel_safe_retrieve_cache BAZEL_info_keys _bazel_info_keys_list; then + typeset -ga _bazel_info_keys_list + # Use `bazel help` instead of `bazel help completion` to get info-key + # descriptions. + if _bazel_info_keys_list=("${(@f)$(_bazel_b help info-keys | awk ' + { printf "%s:", $1; for (i=2; i<=NF; i++) printf "%s ", $i; print "" }')}"); then + _store_cache BAZEL_info_keys _bazel_info_keys_list + fi + fi + fi + _describe -t bazel-info 'Key' _bazel_info_keys_list +} -- cgit v1.2.3-70-g09d2 From 5ea25e6736430ab5b8439d11b2e9a837a803771b Mon Sep 17 00:00:00 2001 From: Septs Date: Mon, 25 May 2020 00:48:43 +0800 Subject: Add `shell-proxy` plugin (#8692) --- plugins/shell-proxy/README.md | 52 +++++++++++++++++++++ plugins/shell-proxy/proxy.py | 72 ++++++++++++++++++++++++++++++ plugins/shell-proxy/shell-proxy.plugin.zsh | 16 +++++++ plugins/shell-proxy/ssh-agent.py | 16 +++++++ plugins/shell-proxy/ssh-proxy.py | 18 ++++++++ 5 files changed, 174 insertions(+) create mode 100644 plugins/shell-proxy/README.md create mode 100755 plugins/shell-proxy/proxy.py create mode 100644 plugins/shell-proxy/shell-proxy.plugin.zsh create mode 100755 plugins/shell-proxy/ssh-agent.py create mode 100755 plugins/shell-proxy/ssh-proxy.py (limited to 'plugins') diff --git a/plugins/shell-proxy/README.md b/plugins/shell-proxy/README.md new file mode 100644 index 000000000..6f2cd13e0 --- /dev/null +++ b/plugins/shell-proxy/README.md @@ -0,0 +1,52 @@ +# Shell Proxy oh-my-zsh plugin + +This a pure user-space program, shell-proxy setter, written Python3 and Bash. + +100% only no side-effects, only effect **environment variables** and **aliases** + +## Key feature + +- Support Ubuntu, Archlinux, etc (Linux) +- Support macOS +- Support git via based-`$GIT_SSH` +- Support ssh, sftp, scp, slogin and ssh-copy-id via based-`alias` +- Built-in Auto-complete + +## Usage + +Method 1: + +`$DEFAULT_PROXY` is the proxy URL you will set + +Method 2: + +Write a program to `$HOME/.config/proxy` in the file. + +Example program: + +```bash +#!/bin/bash +# The file path: $HOME/.config/proxy +if [[ "$OSTYPE" == "darwin"* ]]; then + echo "http://127.0.0.1:6152" # Surge Mac +else + echo "http://127.0.0.1:8123" # polipo +fi +``` + +Method 3: + +The working path of **Method 2** can be changed via `$CONFIG_PROXY` + +## Reference + +- `$GIT_SSH`: +- OpenSSH manual: + +## Maintainer + +- + +## The oh-my-zsh plugin (shell-proxy) + +Public Domain diff --git a/plugins/shell-proxy/proxy.py b/plugins/shell-proxy/proxy.py new file mode 100755 index 000000000..2b62f6cb5 --- /dev/null +++ b/plugins/shell-proxy/proxy.py @@ -0,0 +1,72 @@ +#!/usr/bin/env python3 +import os +import sys +from subprocess import check_output, list2cmdline + +cwd = os.path.dirname(__file__) +ssh_agent = os.path.join(cwd, "ssh-agent.py") +user_proxy = os.environ.get("CONFIG_PROXY", os.path.expandvars("$HOME/.config/proxy")) + + +def get_http_proxy(): + if "DEFAULT_PROXY" in os.environ: + return os.environ["DEFAULT_PROXY"] + if os.path.isfile(user_proxy): + return check_output(user_proxy).decode("utf-8").strip() + raise Exception("Not found, Proxy configuration") + + +def make_proxies(url: str): + proxies = {"%s_PROXY" % _: url for _ in ("HTTP", "HTTPS", "FTP", "RSYNC", "ALL")} + proxies.update({name.lower(): value for (name, value) in proxies.items()}) + proxies["GIT_SSH"] = ssh_agent + return proxies + + +def merge(mapping: dict): + return ("%s=%s" % _ for _ in mapping.items()) + + +class CommandSet: + proxies = make_proxies(get_http_proxy()) + aliases = { + _: "env NAME=%s %s" % (_, ssh_agent) + for _ in ("ssh", "sftp", "scp", "slogin", "ssh-copy-id") + } + + def enable(self): + cmdline("export", *merge(self.proxies)) + cmdline("alias", *merge(self.aliases)) + + def disable(self): + cmdline("unset", *self.proxies.keys()) + cmdline("unalias", *self.aliases.keys()) + + def status(self): + proxies = ( + "%11s = %s" % (name, os.environ[name]) + for name in self.proxies.keys() + if name in os.environ + ) + for _ in proxies: + cmdline("echo", _) + + def usage(self): + cmdline("echo", "usage: proxy {enable,disable,status}") + self.status() + + +def cmdline(*items): + print(list2cmdline(items)) + + +def main(): + command = CommandSet() + if len(sys.argv) == 1: + command.usage() + sys.exit(-1) + getattr(command, sys.argv[1], command.usage)() + + +if __name__ == "__main__": + main() diff --git a/plugins/shell-proxy/shell-proxy.plugin.zsh b/plugins/shell-proxy/shell-proxy.plugin.zsh new file mode 100644 index 000000000..fd0e2fe79 --- /dev/null +++ b/plugins/shell-proxy/shell-proxy.plugin.zsh @@ -0,0 +1,16 @@ +#!/usr/bin/bash +# shellcheck disable=SC1090 + +__PROXY__="${0:A:h}/proxy.py" + +proxy() { + source <("$__PROXY__" "$1") +} + +_proxy() { + local -r commands=('enable' 'disable' 'status') + compset -P '*,' + compadd -S '' "${commands[@]}" +} + +compdef '_proxy' 'proxy' diff --git a/plugins/shell-proxy/ssh-agent.py b/plugins/shell-proxy/ssh-agent.py new file mode 100755 index 000000000..61cf84c0b --- /dev/null +++ b/plugins/shell-proxy/ssh-agent.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python3 +import os +import subprocess +import sys + +ssh_proxy = os.path.join(os.path.dirname(__file__), "ssh-proxy.py") + +argv = [ + os.environ.get("NAME", "ssh"), + "-o", + "ProxyCommand={} %h %p".format(ssh_proxy), + "-o", + "Compression=yes", +] + +subprocess.call(argv + sys.argv[1:], env=os.environ) diff --git a/plugins/shell-proxy/ssh-proxy.py b/plugins/shell-proxy/ssh-proxy.py new file mode 100755 index 000000000..5efd5fd21 --- /dev/null +++ b/plugins/shell-proxy/ssh-proxy.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import os +import subprocess +import sys +import urllib.parse + +proxy = next(os.environ[_] for _ in ("HTTP_PROXY", "HTTPS_PROXY") if _ in os.environ) +argv = [ + "nc", + "-X", + "connect", + "-x", + urllib.parse.urlparse(proxy).netloc, # proxy-host:proxy-port + sys.argv[1], # host + sys.argv[2], # port +] + +subprocess.call(argv) -- cgit v1.2.3-70-g09d2 From 604f1ef9cd8c1e3b1b53c394e28d21f39609a317 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Mon, 25 May 2020 11:57:01 +0200 Subject: kube-ps1: update to latest version (ede8098) Fixes #8786 --- plugins/kube-ps1/kube-ps1.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/kube-ps1/kube-ps1.plugin.zsh b/plugins/kube-ps1/kube-ps1.plugin.zsh index 0f68ca938..9e77cbc19 100644 --- a/plugins/kube-ps1/kube-ps1.plugin.zsh +++ b/plugins/kube-ps1/kube-ps1.plugin.zsh @@ -184,7 +184,7 @@ _kube_ps1_file_newer_than() { local check_time=$2 if [[ "${KUBE_PS1_SHELL}" == "zsh" ]]; then - mtime=$(zstat -L +mtime "${file}") + mtime=$(zstat +mtime "${file}") elif stat -c "%s" /dev/null &> /dev/null; then # GNU stat mtime=$(stat -L -c %Y "${file}") -- cgit v1.2.3-70-g09d2 From f7dd3d1f0778e92c9221aa33d90cc01bb4657a70 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Tue, 26 May 2020 17:36:55 +0200 Subject: brew: remove completion deprecation notice and fix README --- plugins/brew/README.md | 30 +++++++++++++++++++----------- plugins/brew/brew.plugin.zsh | 16 ---------------- 2 files changed, 19 insertions(+), 27 deletions(-) (limited to 'plugins') diff --git a/plugins/brew/README.md b/plugins/brew/README.md index c129a7652..44af05225 100644 --- a/plugins/brew/README.md +++ b/plugins/brew/README.md @@ -3,19 +3,27 @@ The plugin adds several aliases for common [brew](https://brew.sh) commands. To use it, add `brew` to the plugins array of your zshrc file: -``` + +```zsh plugins=(... brew) ``` ## Aliases -| Alias | Command | Description | -|--------|----------------------|---------------| -| brewp | `brew pin` | Pin a specified formulae, preventing them from being upgraded when issuing the brew upgrade command. | -| brews | `brew list -1` | List installed formulae, one entry per line, or the installed files for a given formulae. | -| brewsp | `brew list --pinned` | Show the versions of pinned formulae, or only the specified (pinned) formulae if formulae are given. | -| bubo | `brew update && brew outdated` | Fetch the newest version of Homebrew and all formulae, then list outdated formulae. | -| bubc | `brew upgrade && brew cleanup` | Upgrade outdated, unpinned brews (with existing install options), then removes stale lock files and outdated downloads for formulae and casks, and removes old versions of installed formulae. | -| bubu | `bubo && bubc` | Updates Homebrew, lists outdated formulae, upgrades oudated and unpinned formulae, and removes stale and outdated downloads and versions. | -| bcubo | `brew update && brew cask outdated` | Fetch the newest version of Homebrew and all formulae, then list outdated casks. | -| bcubc | `brew cask reinstall $(brew cask outdated) && brew cleanup` | Updates outdated casks, then runs cleanup. | \ No newline at end of file +| Alias | Command | Description | +|----------|-------------------------------------------------------------|---------------------------------------------------------------------| +| `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. | +| `bubo` | `brew update && brew outdated` | Update Homebrew and all formulae, then list outdated formulae. | +| `bubc` | `brew upgrade && brew cleanup` | Upgrade outdated formulae, then run cleanup. | +| `bubu` | `bubo && bubc` | Do the last two operations above. | +| `bcubo` | `brew update && brew cask outdated` | Update Homebrew and alll formulae, then list outdated casks. | +| `bcubc` | `brew cask reinstall $(brew cask outdated) && brew cleanup` | Update outdated casks, then run cleanup. | + +## Completion + +With the release of Homebrew 1.0, they decided to bundle the zsh completion as part of the +brew installation, so we no longer ship it with the brew plugin; now it only has brew +aliases. If you find that brew completion no longer works, make sure you have your Homebrew +installation fully up to date. diff --git a/plugins/brew/brew.plugin.zsh b/plugins/brew/brew.plugin.zsh index cfbaa3480..fdea76c74 100644 --- a/plugins/brew/brew.plugin.zsh +++ b/plugins/brew/brew.plugin.zsh @@ -6,19 +6,3 @@ alias bubc='brew upgrade && brew cleanup' alias bubu='bubo && bubc' alias bcubo='brew update && brew cask outdated' alias bcubc='brew cask reinstall $(brew cask outdated) && brew cleanup' - -if command mkdir "$ZSH_CACHE_DIR/.brew-completion-message" 2>/dev/null; then - print -P '%F{yellow}'Oh My Zsh brew plugin: - cat <<-'EOF' - - With the advent of their 1.0 release, Homebrew has decided to bundle - the zsh completion as part of the brew installation, so we no longer - ship it with the brew plugin; now it only has brew aliases. - - If you find that brew completion no longer works, make sure you have - your Homebrew installation fully up to date. - - You will only see this message once. - EOF - print -P '%f' -fi -- cgit v1.2.3-70-g09d2 From 375978fb5bca134009790db7913bdf6bc8e795fa Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Tue, 26 May 2020 18:02:14 +0200 Subject: jenv: fix Homebrew install path bug introduced in #7541 --- plugins/jenv/jenv.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/jenv/jenv.plugin.zsh b/plugins/jenv/jenv.plugin.zsh index b85906a0b..946ce18a5 100644 --- a/plugins/jenv/jenv.plugin.zsh +++ b/plugins/jenv/jenv.plugin.zsh @@ -1,4 +1,4 @@ -jenvdirs=("$HOME/.jenv" "/usr/local" "/usr/local/jenv" "/opt/jenv") +jenvdirs=("$HOME/.jenv" "/usr/local/bin/jenv" "/usr/local/jenv" "/opt/jenv") FOUND_JENV=0 for jenvdir in $jenvdirs; do -- cgit v1.2.3-70-g09d2 From 68d51bd7d83050589ca602059a6e2fb26c2cec39 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Tue, 26 May 2020 18:02:46 +0200 Subject: virtualenvwrapper: fix load and detection logic --- .../virtualenvwrapper/virtualenvwrapper.plugin.zsh | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'plugins') diff --git a/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh b/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh index 2cbfc47d5..88217a7f5 100644 --- a/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh +++ b/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh @@ -1,23 +1,24 @@ function { # search in these locations for the init script: - for f in $commands[virtualenvwrapper_lazy.sh] \ - $commands[virtualenvwrapper.sh] \ - /usr/share/virtualenvwrapper/virtualenvwrapper{_lazy,}.sh \ - /usr/local/bin/virtualenvwrapper{_lazy,}.sh \ - /etc/bash_completion.d/virtualenvwrapper \ - /usr/share/bash-completion/completions/virtualenvwrapper \ - $HOME/.local/bin/virtualenvwrapper.sh + for virtualenvwrapper in $commands[virtualenvwrapper_lazy.sh] \ + $commands[virtualenvwrapper.sh] \ + /usr/share/virtualenvwrapper/virtualenvwrapper{_lazy,}.sh \ + /usr/local/bin/virtualenvwrapper{_lazy,}.sh \ + /etc/bash_completion.d/virtualenvwrapper \ + /usr/share/bash-completion/completions/virtualenvwrapper \ + $HOME/.local/bin/virtualenvwrapper.sh do - if [[ -f $f ]]; then - source $f + if [[ -f "$virtualenvwrapper" ]]; then + source "$virtualenvwrapper" return fi done print "[oh-my-zsh] virtualenvwrapper plugin: Cannot find virtualenvwrapper.sh.\n"\ "Please install with \`pip install virtualenvwrapper\`" >&2 + return 1 } -if ! type workon &>/dev/null; then +if [[ $? -eq 0 ]] && ! type workon &>/dev/null; then print "[oh-my-zsh] virtualenvwrapper plugin: shell function 'workon' not defined.\n"\ "Please check ${virtualenvwrapper}" >&2 return -- cgit v1.2.3-70-g09d2 From 2d6965f85645ea489b0adf8ce6a79dd55036d883 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Tue, 26 May 2020 17:59:45 +0200 Subject: Fix load of various plugins: fastfile, keychain, sfffe, stack --- plugins/fastfile/fastfile.plugin.zsh | 4 ++-- plugins/keychain/keychain.plugin.zsh | 9 +++------ plugins/sfffe/sfffe.plugin.zsh | 6 +++--- plugins/stack/stack.plugin.zsh | 2 ++ 4 files changed, 10 insertions(+), 11 deletions(-) (limited to 'plugins') diff --git a/plugins/fastfile/fastfile.plugin.zsh b/plugins/fastfile/fastfile.plugin.zsh index a4229e4c2..0d71246fc 100644 --- a/plugins/fastfile/fastfile.plugin.zsh +++ b/plugins/fastfile/fastfile.plugin.zsh @@ -5,7 +5,7 @@ # If they are not set yet, they will be # overwritten with their default values -default fastfile_dir "${HOME}/.fastfile/" +default fastfile_dir "${HOME}/.fastfile" default fastfile_var_prefix "§" ########################### @@ -104,7 +104,7 @@ function fastfile_rm() { # Generate the aliases for the shortcuts # function fastfile_sync() { - for f in "${fastfile_dir}"/*; do + for f in "${fastfile_dir}"/*(N); do file=`basename "$f"` # To enable simpler handeling of spaces in file names varkey=`echo "$file" | tr " " "_"` diff --git a/plugins/keychain/keychain.plugin.zsh b/plugins/keychain/keychain.plugin.zsh index 1babf5a30..f122f7982 100644 --- a/plugins/keychain/keychain.plugin.zsh +++ b/plugins/keychain/keychain.plugin.zsh @@ -1,7 +1,9 @@ +(( $+commands[keychain] )) || return + # Define SHORT_HOST if not defined (%m = host name up to first .) SHORT_HOST=${SHORT_HOST:-${(%):-%m}} -function _start_agent() { +function { local agents local -a identities local -a options @@ -28,8 +30,3 @@ function _start_agent() { [ -f "$_keychain_env_sh" ] && . "$_keychain_env_sh" [ -f "$_keychain_env_sh_gpg" ] && . "$_keychain_env_sh_gpg" } - -_start_agent - -# tidy up after ourselves -unfunction _start_agent diff --git a/plugins/sfffe/sfffe.plugin.zsh b/plugins/sfffe/sfffe.plugin.zsh index a0f034908..177e5fa2f 100644 --- a/plugins/sfffe/sfffe.plugin.zsh +++ b/plugins/sfffe/sfffe.plugin.zsh @@ -6,9 +6,9 @@ # REQUIRE: ack # ------------------------------------------------------------------------------ -if [ ! -x $(which ack) ]; then - echo \'ack\' is not installed! - exit -1 +if (( ! $+commands[ack] )); then + echo "'ack' is not installed!" + return fi ajs() { diff --git a/plugins/stack/stack.plugin.zsh b/plugins/stack/stack.plugin.zsh index 4e812880e..45ef38761 100644 --- a/plugins/stack/stack.plugin.zsh +++ b/plugins/stack/stack.plugin.zsh @@ -1,2 +1,4 @@ +(( $+commands[stack] )) || return + autoload -U +X bashcompinit && bashcompinit source <(stack --bash-completion-script stack) -- cgit v1.2.3-70-g09d2 From cc065c7bfa03ccf2accc8a09674de4a9b9a95adc Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Tue, 26 May 2020 18:01:42 +0200 Subject: Remove git-remote-branch and nyan plugins (deprecated) --- plugins/git-remote-branch/README.md | 15 --------------- .../git-remote-branch/git-remote-branch.plugin.zsh | 19 ------------------- plugins/nyan/README.md | 5 ----- plugins/nyan/nyan.plugin.zsh | 10 ---------- 4 files changed, 49 deletions(-) delete mode 100644 plugins/git-remote-branch/README.md delete mode 100644 plugins/git-remote-branch/git-remote-branch.plugin.zsh delete mode 100644 plugins/nyan/README.md delete mode 100644 plugins/nyan/nyan.plugin.zsh (limited to 'plugins') diff --git a/plugins/git-remote-branch/README.md b/plugins/git-remote-branch/README.md deleted file mode 100644 index d4eb75954..000000000 --- a/plugins/git-remote-branch/README.md +++ /dev/null @@ -1,15 +0,0 @@ -# git-remote-branch plugin - -This plugin adds completion for [`grb`](https://github.com/webmat/git_remote_branch), -or `git_remote_branch`. - -To use it, add `git-remote-branch` to the plugins array of your zshrc file: - -```zsh -plugins=(... git-remote-branch) -``` - -## Deprecation - -[git_remote_branch was archived in 2018](https://github.com/webmat/git_remote_branch#archived), -meaning it's not actively maintained anymore. Use at your own risk. diff --git a/plugins/git-remote-branch/git-remote-branch.plugin.zsh b/plugins/git-remote-branch/git-remote-branch.plugin.zsh deleted file mode 100644 index 6c5ab8f70..000000000 --- a/plugins/git-remote-branch/git-remote-branch.plugin.zsh +++ /dev/null @@ -1,19 +0,0 @@ -_git_remote_branch() { - ref=$(git symbolic-ref HEAD 2> /dev/null) - if [[ -n $ref ]]; then - if (( CURRENT == 2 )); then - # first arg: operation - compadd create publish rename delete track - elif (( CURRENT == 3 )); then - # second arg: remote branch name - remotes=`git remote | tr '\n' '|' | sed "s/\|$//g"` - compadd `git branch -r | grep -v HEAD | sed "s/$remotes\///" | sed "s/ //g"` - elif (( CURRENT == 4 )); then - # third arg: remote name - compadd `git remote` - fi - else; - _files - fi -} -compdef _git_remote_branch grb diff --git a/plugins/nyan/README.md b/plugins/nyan/README.md deleted file mode 100644 index 592941824..000000000 --- a/plugins/nyan/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# Nyan plugin - -This plugin adds a command to display [Nyan Cat](https://en.wikipedia.org/wiki/Nyan_Cat) right inside your terminal. - -**Plugin is deprecated**. Check [official repo](https://github.com/klange/nyancat) for more information. \ No newline at end of file diff --git a/plugins/nyan/nyan.plugin.zsh b/plugins/nyan/nyan.plugin.zsh deleted file mode 100644 index c21c784d9..000000000 --- a/plugins/nyan/nyan.plugin.zsh +++ /dev/null @@ -1,10 +0,0 @@ -print -Pn '%F{yellow}' -cat >&2 <<-EOD - nyan plugin: - The nyancat server used by this plugin was shut down due to increased - bandwidth costs, so the nyan plugin no longer works. You can get the - same functionality in some distributions by installing the nyancat package, - or you can compile it yourself. - See https://github.com/klange/nyancat for more information. -EOD -print -Pn '%f' -- cgit v1.2.3-70-g09d2 From 93cc3964e2d265ab0571298d69d2eed0a65d13f2 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Tue, 26 May 2020 18:14:58 +0200 Subject: Add deprecation notice for fedora and go plugins. --- plugins/fedora/fedora.plugin.zsh | 4 +++- plugins/go/go.plugin.zsh | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) mode change 120000 => 100644 plugins/fedora/fedora.plugin.zsh mode change 120000 => 100644 plugins/go/go.plugin.zsh (limited to 'plugins') diff --git a/plugins/fedora/fedora.plugin.zsh b/plugins/fedora/fedora.plugin.zsh deleted file mode 120000 index 16a214313..000000000 --- a/plugins/fedora/fedora.plugin.zsh +++ /dev/null @@ -1 +0,0 @@ -../dnf/dnf.plugin.zsh \ No newline at end of file diff --git a/plugins/fedora/fedora.plugin.zsh b/plugins/fedora/fedora.plugin.zsh new file mode 100644 index 000000000..226506c05 --- /dev/null +++ b/plugins/fedora/fedora.plugin.zsh @@ -0,0 +1,3 @@ +print -P "%F{yellow}The 'fedora' plugin is deprecated. Use the '%Udnf%u' plugin instead.%f" + +source "$ZSH/plugins/dnf/dnf.plugin.zsh" diff --git a/plugins/go/go.plugin.zsh b/plugins/go/go.plugin.zsh deleted file mode 120000 index cf943e2e1..000000000 --- a/plugins/go/go.plugin.zsh +++ /dev/null @@ -1 +0,0 @@ -../golang/golang.plugin.zsh \ No newline at end of file diff --git a/plugins/go/go.plugin.zsh b/plugins/go/go.plugin.zsh new file mode 100644 index 000000000..da7c87cfd --- /dev/null +++ b/plugins/go/go.plugin.zsh @@ -0,0 +1,3 @@ +print -P "%F{yellow}The 'go' plugin is deprecated. Use the '%Ugolang%u' plugin instead.%f" + +source "$ZSH/plugins/golang/golang.plugin.zsh" -- cgit v1.2.3-70-g09d2