From dd30cf104c9ca42d89d26a134382ca421869ce7e Mon Sep 17 00:00:00 2001 From: Aleksandr Kozlov Date: Mon, 22 Jan 2018 12:54:02 +0300 Subject: [PATCH 001/896] Added kgpall alias --- plugins/kubectl/kubectl.plugin.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/kubectl/kubectl.plugin.zsh b/plugins/kubectl/kubectl.plugin.zsh index 88177b5a0..3c6e8045c 100644 --- a/plugins/kubectl/kubectl.plugin.zsh +++ b/plugins/kubectl/kubectl.plugin.zsh @@ -24,6 +24,7 @@ alias klp='k logs pods' alias kep='k edit pods' alias kdp='k describe pods' alias kdelp='k delete pods' +alias kgpall='k get pods --all-namespaces -o wide' # Service management. alias kgs='k get svc' From edbd86cd956266ee80f6b128588f5673f0cdb3c7 Mon Sep 17 00:00:00 2001 From: Sayan Roy Date: Sun, 7 Jun 2020 12:14:55 +0530 Subject: [PATCH 002/896] Updating some gem command reference # Updating some gem command reference gem_info,gem help , etc. --- plugins/ruby/ruby.plugin.zsh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/plugins/ruby/ruby.plugin.zsh b/plugins/ruby/ruby.plugin.zsh index 177b35b31..88e769d39 100644 --- a/plugins/ruby/ruby.plugin.zsh +++ b/plugins/ruby/ruby.plugin.zsh @@ -12,3 +12,14 @@ alias rb="ruby" alias gin="gem install" alias gun="gem uninstall" alias gli="gem list" +alias gi="gem info" +alias giall="gem info --all" +alias gca="gem cert --add" +alias gcr="gem cert --remove" +alias gcb="gem cert --build" +alias gclup="gem cleanup -n" +alias ggi="gem generate_index" +alias gh="gem help" +alias gl="gem lock" +alias go="gem open" +alias goe="gem open -e" From c268d176bf5e1efbf31bb1f3c00c182c1b369e9b Mon Sep 17 00:00:00 2001 From: Sayan Roy Date: Tue, 9 Jun 2020 00:48:50 +0530 Subject: [PATCH 003/896] Updating the README.md --- plugins/ruby/README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/plugins/ruby/README.md b/plugins/ruby/README.md index ad2755bbf..a4a9c5036 100644 --- a/plugins/ruby/README.md +++ b/plugins/ruby/README.md @@ -18,3 +18,14 @@ plugins=(... ruby) | gin | `gem install` | Install a gem into the local repository | | gun | `gem uninstall` | Uninstall gems from the local repository | | gli | `gem list` | Display gems installed locally | +| gi | `gem info` | Show information for the given gem | +| giall | `gem info --all` | Display all gem versions | +| gca | `gem cert --add` | Add a trusted certificate | +| gcr | `gem cert --remove` | Remove a trusted certificate | +| gcb | `gem cert --build` | Build private key and self-signed certificate | +| gclup | `gem cleanup -n` | Do not uninstall gem | +| ggi | `gem generate_index` | Generate index file for gem server | +| gh | `gem help` | Provide additional help | +| gl | `gem lock` | Generate a lockdown list of gems | +| go | `gem open` | Open gem source in default editor | +| goe | `gem open -e` | Open gem sources in preferred editor | From e751d2519d586a2c022beeb0b40dfe9b7a1ed6eb Mon Sep 17 00:00:00 2001 From: Sayan Roy Date: Wed, 1 Jul 2020 08:58:27 +0530 Subject: [PATCH 004/896] spacing changed --- plugins/ruby/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/ruby/README.md b/plugins/ruby/README.md index a4a9c5036..a2de11991 100644 --- a/plugins/ruby/README.md +++ b/plugins/ruby/README.md @@ -19,7 +19,7 @@ plugins=(... ruby) | gun | `gem uninstall` | Uninstall gems from the local repository | | gli | `gem list` | Display gems installed locally | | gi | `gem info` | Show information for the given gem | -| giall | `gem info --all` | Display all gem versions | +| giall | `gem info --all` | Display all gem versions | | gca | `gem cert --add` | Add a trusted certificate | | gcr | `gem cert --remove` | Remove a trusted certificate | | gcb | `gem cert --build` | Build private key and self-signed certificate | From 02ce2c4a2f563c4e092410fe3ddc8b29b6de7fdc Mon Sep 17 00:00:00 2001 From: Roc Date: Sat, 12 Jun 2021 09:50:29 +0800 Subject: [PATCH 005/896] add python alias (#7736) --- plugins/python/python.plugin.zsh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/python/python.plugin.zsh b/plugins/python/python.plugin.zsh index c3c1474c1..276eb6f91 100644 --- a/plugins/python/python.plugin.zsh +++ b/plugins/python/python.plugin.zsh @@ -1,3 +1,6 @@ +# python command +alias py='python' + # Find python file alias pyfind='find . -name "*.py"' From a206271460ce49e842b1b410c0424b8c9a0a3d14 Mon Sep 17 00:00:00 2001 From: Nuno Goncalves Date: Sat, 12 Jun 2021 04:03:25 +0200 Subject: [PATCH 006/896] ssh-agent: improvements (#6309) * ssh-agent: lock this script with a mkdir style mutex This script is a kind of singleton pattern and is not reentrant. If several shells are oppened in a fast sequence, then several independent ssh-agents would be created, which is not acceptable. A mutex is required. Signed-off-by: Nuno Goncalves * ssh-agent: only start agent if .ssh dir exists To use the same profile system-wide, it might happen that the .ssh directory does not exist (typically $HOME/.ssh/). This would trigger a error. Creating the directory would be a option, but it usually will not make sense to do so because it means the user doesn't have ssh keys or config. Signed-off-by: Nuno Goncalves * ssh-agent: adds lazy option to disable key loading on start Option is documented on updated README.md Signed-off-by: Nuno Goncalves * ssh-agent: simplify agent-forwarding checking Signed-off-by: Nuno Goncalves Co-authored-by: Robby Russell --- plugins/ssh-agent/README.md | 12 +++++++++-- plugins/ssh-agent/ssh-agent.plugin.zsh | 29 +++++++++++++++++++------- 2 files changed, 31 insertions(+), 10 deletions(-) diff --git a/plugins/ssh-agent/README.md b/plugins/ssh-agent/README.md index 8765a9c7e..aa96f9cc9 100644 --- a/plugins/ssh-agent/README.md +++ b/plugins/ssh-agent/README.md @@ -19,9 +19,17 @@ To enable **agent forwarding support** add the following to your zshrc file: zstyle :omz:plugins:ssh-agent agent-forwarding on ``` ----- +To **NOT load any identities on start** use the `lazy` style. +This is particularly usefull when combined with the AddKeysToAgent +(available from OpenSSH 7.2), since it allows to enter the password only +on first use. -To **load multiple identities** use the `identities` style, For example: +```zsh +zstyle :omz:plugins:ssh-agent lazy yes +``` + +To **load multiple identities** use the `identities` style. This have no +effect if `lazy` is enabled. ```zsh zstyle :omz:plugins:ssh-agent identities id_rsa id_rsa2 id_github diff --git a/plugins/ssh-agent/ssh-agent.plugin.zsh b/plugins/ssh-agent/ssh-agent.plugin.zsh index d45406f63..494cf1393 100644 --- a/plugins/ssh-agent/ssh-agent.plugin.zsh +++ b/plugins/ssh-agent/ssh-agent.plugin.zsh @@ -1,4 +1,16 @@ -typeset _agent_forwarding _ssh_env_cache +lockdir=/tmp/oh-my-zsh-ssh-agent.lock + +while true; do + if mkdir "$lockdir" 2>/dev/null + then # directory did not exist, but was created successfully + trap 'rm -rf "$lockdir"' 0 # remove directory when script finishes + break # continue with script + else + sleep 0.1 # sleep for 0.2 and try again + fi +done + +typeset _ssh_env_cache function _start_agent() { local lifetime @@ -56,10 +68,7 @@ function _add_identities() { # Get the filename to store/lookup the environment from _ssh_env_cache="$HOME/.ssh/environment-$SHORT_HOST" -# test if agent-forwarding is enabled -zstyle -b :omz:plugins:ssh-agent agent-forwarding _agent_forwarding - -if [[ $_agent_forwarding == "yes" && -n "$SSH_AUTH_SOCK" ]]; then +if zstyle -t :omz:plugins:ssh-agent agent-forwarding && [[ -n "$SSH_AUTH_SOCK" ]]; then # Add a nifty symlink for screen/tmux if agent forwarding [[ -L $SSH_AUTH_SOCK ]] || ln -sf "$SSH_AUTH_SOCK" /tmp/ssh-agent-$USERNAME-screen elif [[ -f "$_ssh_env_cache" ]]; then @@ -73,12 +82,16 @@ elif [[ -f "$_ssh_env_cache" ]]; then ps $FILTER | grep ssh-agent | grep -q $SSH_AGENT_PID || { _start_agent } -else +elif [[ -d $HOME/.ssh ]]; then _start_agent fi -_add_identities +if ! zstyle -t :omz:plugins:ssh-agent lazy; then + _add_identities +fi # tidy up after ourselves -unset _agent_forwarding _ssh_env_cache +unset _ssh_env_cache unfunction _start_agent _add_identities + +rm -rf "$lockdir" From e47a8e2321be9e7af49872588619c031a757d6ea Mon Sep 17 00:00:00 2001 From: hqingyi Date: Sat, 12 Jun 2021 10:45:05 +0800 Subject: [PATCH 007/896] feat(plugins): add aliases cheatsheet plugin (#4662) * add: explore alias quickly with aliases plugin. * change: add compatibility with python2 & python3. - add compatibility. - add termcolor.py. - remove aliass(search), just use acs. - detect python. --- plugins/aliases/aliases.plugin.zsh | 10 ++ plugins/aliases/cheatsheet.py | 55 ++++++++++ plugins/aliases/termcolor.py | 168 +++++++++++++++++++++++++++++ 3 files changed, 233 insertions(+) create mode 100644 plugins/aliases/aliases.plugin.zsh create mode 100644 plugins/aliases/cheatsheet.py create mode 100644 plugins/aliases/termcolor.py diff --git a/plugins/aliases/aliases.plugin.zsh b/plugins/aliases/aliases.plugin.zsh new file mode 100644 index 000000000..28d8fba24 --- /dev/null +++ b/plugins/aliases/aliases.plugin.zsh @@ -0,0 +1,10 @@ +# with lots of 3rd-party amazing aliases installed, just need something to explore it quickly. +# +# - acs: alias cheatsheet +# group alias by command, pass addition argv to grep. +ALIASES_PLUGIN_ROOT=$(cd `dirname $0` && pwd) +function acs(){ + which python >>/dev/null + [[ $? -eq 1 ]] && echo "[error]no python executable detected!" && return + alias | python $ALIASES_PLUGIN_ROOT/cheatsheet.py $@ +} diff --git a/plugins/aliases/cheatsheet.py b/plugins/aliases/cheatsheet.py new file mode 100644 index 000000000..d6d507b92 --- /dev/null +++ b/plugins/aliases/cheatsheet.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python +import sys +import itertools +import termcolor + +def parse(line): + left = line[0:line.find('=')].strip() + right = line[line.find('=')+1:].strip('\'"\n ') + try: + cmd = next(part for part in right.split() if len([char for char in '=<>' if char in part])==0) + except StopIteration: + cmd = right + return (left, right, cmd) + +def cheatsheet(lines): + exps = [ parse(line) for line in lines ] + cheatsheet = {'_default': []} + for key, group in itertools.groupby(exps, lambda exp:exp[2]): + group_list = [ item for item in group ] + if len(group_list)==1: + target_aliases = cheatsheet['_default'] + else: + if key not in cheatsheet: + cheatsheet[key] = [] + target_aliases = cheatsheet[key] + target_aliases.extend(group_list) + return cheatsheet + +def pretty_print_group(key, aliases, hightlight=None): + if len(aliases) == 0: + return + group_hl_formatter = lambda g, hl: termcolor.colored(hl, 'yellow').join([termcolor.colored(part, 'red') for part in ('[%s]' % g).split(hl)]) + alias_hl_formatter = lambda alias, hl: termcolor.colored(hl, 'yellow').join([termcolor.colored(part, 'green') for part in ('\t%s = %s' % alias[0:2]).split(hl)]) + group_formatter = lambda g: termcolor.colored('[%s]' % g, 'red') + alias_formatter = lambda alias: termcolor.colored('\t%s = %s' % alias[0:2], 'green') + if hightlight and len(hightlight)>0: + print (group_hl_formatter(key, hightlight)) + print ('\n'.join([alias_hl_formatter(alias, hightlight) for alias in aliases])) + else: + print (group_formatter(key)) + print ('\n'.join([alias_formatter(alias) for alias in aliases])) + print ('') + +def pretty_print(cheatsheet, wfilter): + sorted_key = sorted(cheatsheet.keys()) + for key in sorted_key: + aliases = cheatsheet.get(key) + if not wfilter: + pretty_print_group(key, aliases, wfilter) + else: + pretty_print_group(key, [ alias for alias in aliases if alias[0].find(wfilter)>-1 or alias[1].find(wfilter)>-1], wfilter) + +if __name__ == '__main__': + lines = sys.stdin.readlines() + pretty_print(cheatsheet(lines), sys.argv[1] if len(sys.argv)>1 else None) diff --git a/plugins/aliases/termcolor.py b/plugins/aliases/termcolor.py new file mode 100644 index 000000000..f11b824b2 --- /dev/null +++ b/plugins/aliases/termcolor.py @@ -0,0 +1,168 @@ +# coding: utf-8 +# Copyright (c) 2008-2011 Volvox Development Team +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# +# Author: Konstantin Lepa + +"""ANSII Color formatting for output in terminal.""" + +from __future__ import print_function +import os + + +__ALL__ = [ 'colored', 'cprint' ] + +VERSION = (1, 1, 0) + +ATTRIBUTES = dict( + list(zip([ + 'bold', + 'dark', + '', + 'underline', + 'blink', + '', + 'reverse', + 'concealed' + ], + list(range(1, 9)) + )) + ) +del ATTRIBUTES[''] + + +HIGHLIGHTS = dict( + list(zip([ + 'on_grey', + 'on_red', + 'on_green', + 'on_yellow', + 'on_blue', + 'on_magenta', + 'on_cyan', + 'on_white' + ], + list(range(40, 48)) + )) + ) + + +COLORS = dict( + list(zip([ + 'grey', + 'red', + 'green', + 'yellow', + 'blue', + 'magenta', + 'cyan', + 'white', + ], + list(range(30, 38)) + )) + ) + + +RESET = '\033[0m' + + +def colored(text, color=None, on_color=None, attrs=None): + """Colorize text. + + Available text colors: + red, green, yellow, blue, magenta, cyan, white. + + Available text highlights: + on_red, on_green, on_yellow, on_blue, on_magenta, on_cyan, on_white. + + Available attributes: + bold, dark, underline, blink, reverse, concealed. + + Example: + colored('Hello, World!', 'red', 'on_grey', ['blue', 'blink']) + colored('Hello, World!', 'green') + """ + if os.getenv('ANSI_COLORS_DISABLED') is None: + fmt_str = '\033[%dm%s' + if color is not None: + text = fmt_str % (COLORS[color], text) + + if on_color is not None: + text = fmt_str % (HIGHLIGHTS[on_color], text) + + if attrs is not None: + for attr in attrs: + text = fmt_str % (ATTRIBUTES[attr], text) + + text += RESET + return text + + +def cprint(text, color=None, on_color=None, attrs=None, **kwargs): + """Print colorize text. + + It accepts arguments of print function. + """ + + print((colored(text, color, on_color, attrs)), **kwargs) + + +if __name__ == '__main__': + print('Current terminal type: %s' % os.getenv('TERM')) + print('Test basic colors:') + cprint('Grey color', 'grey') + cprint('Red color', 'red') + cprint('Green color', 'green') + cprint('Yellow color', 'yellow') + cprint('Blue color', 'blue') + cprint('Magenta color', 'magenta') + cprint('Cyan color', 'cyan') + cprint('White color', 'white') + print(('-' * 78)) + + print('Test highlights:') + cprint('On grey color', on_color='on_grey') + cprint('On red color', on_color='on_red') + cprint('On green color', on_color='on_green') + cprint('On yellow color', on_color='on_yellow') + cprint('On blue color', on_color='on_blue') + cprint('On magenta color', on_color='on_magenta') + cprint('On cyan color', on_color='on_cyan') + cprint('On white color', color='grey', on_color='on_white') + print('-' * 78) + + print('Test attributes:') + cprint('Bold grey color', 'grey', attrs=['bold']) + cprint('Dark red color', 'red', attrs=['dark']) + cprint('Underline green color', 'green', attrs=['underline']) + cprint('Blink yellow color', 'yellow', attrs=['blink']) + cprint('Reversed blue color', 'blue', attrs=['reverse']) + cprint('Concealed Magenta color', 'magenta', attrs=['concealed']) + cprint('Bold underline reverse cyan color', 'cyan', + attrs=['bold', 'underline', 'reverse']) + cprint('Dark blink concealed white color', 'white', + attrs=['dark', 'blink', 'concealed']) + print(('-' * 78)) + + print('Test mixing:') + cprint('Underline red on grey color', 'red', 'on_grey', + ['underline']) + cprint('Reversed green on red color', 'green', 'on_red', ['reverse']) + From 5cdba87025b9dca3c6f2378a58595c613464fc63 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Fri, 11 Jun 2021 19:43:24 -0700 Subject: [PATCH 008/896] Aliases: Adding a README file for the plugin. #4662 --- plugins/aliases/README.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 plugins/aliases/README.md diff --git a/plugins/aliases/README.md b/plugins/aliases/README.md new file mode 100644 index 000000000..481c1bd4e --- /dev/null +++ b/plugins/aliases/README.md @@ -0,0 +1,21 @@ +## Aliases Cheatsheet + +**Maintainer:** [@hqingyi](https://github.com/hqingyi) + +With lots of 3rd-party amazing aliases installed, this plugin helps list the shortcuts +that are currently available based on the plugins you have enabled. + +Enable this plugin by adding it to your `plugins` definition in `~/.zshrc`. + + ``` + plugins=(aliases) + ``` + +Requirements: Python needs to be installed. + +### Usage + +``` + acs: group all alias + acs $keywordquickly filter alias & highlight +``` From 270db708059909b575cd747789580f8a3dbf7baa Mon Sep 17 00:00:00 2001 From: Logicer <81077770+Logicer16@users.noreply.github.com> Date: Sat, 12 Jun 2021 13:03:21 +1000 Subject: [PATCH 009/896] fix(update): correct description of how changelog is displayed (#9943) --- tools/upgrade.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/upgrade.sh b/tools/upgrade.sh index 417e06fe8..38fac3ce0 100755 --- a/tools/upgrade.sh +++ b/tools/upgrade.sh @@ -72,7 +72,7 @@ if git pull --rebase --stat origin master; then # Save the commit prior to updating git config oh-my-zsh.lastVersion "$last_commit" - # Display changelog with less if available, otherwise just print it to the terminal + # Print changelog to the terminal if [[ "$1" = --interactive ]]; then "$ZSH/tools/changelog.sh" HEAD "$last_commit" fi From 00ccb449907d322c6bfa53f17e96cbf48651fee3 Mon Sep 17 00:00:00 2001 From: Hugo Stijns Date: Sat, 12 Jun 2021 05:04:58 +0200 Subject: [PATCH 010/896] fix(vagrant): Allow dot in Vagrant box name (#4803) --- plugins/vagrant/_vagrant | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/vagrant/_vagrant b/plugins/vagrant/_vagrant index 3e16dbebf..e88835506 100644 --- a/plugins/vagrant/_vagrant +++ b/plugins/vagrant/_vagrant @@ -69,7 +69,7 @@ __box_list () __vm_list () { - _wanted application expl 'command' compadd $(command grep "${VAGRANT_CWD:-.}/Vagrantfile" -oe '^[^#]*\.vm\.define *[:"]\([a-zA-Z0-9_-]\+\)' 2>/dev/null | awk '{print substr($2, 2)}') + _wanted application expl 'command' compadd $(command grep "${VAGRANT_CWD:-.}/Vagrantfile" -oe '^[^#]*\.vm\.define *[:"]\([a-zA-Z0-9\._-]\+\)' 2>/dev/null | awk '{print substr($2, 2)}') _wanted application expl 'command' compadd $(command ls "${VAGRANT_CWD:-.}/.vagrant/machines/" 2>/dev/null) } From 580c28dedd60e9262cd7240a9417e0302a6476da Mon Sep 17 00:00:00 2001 From: Eric Liu Date: Sat, 12 Jun 2021 11:07:21 +0800 Subject: [PATCH 011/896] feat(rails): add 'rails server --bind' alias (#4977) --- plugins/rails/rails.plugin.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/rails/rails.plugin.zsh b/plugins/rails/rails.plugin.zsh index 5b0be4f85..aa7576916 100644 --- a/plugins/rails/rails.plugin.zsh +++ b/plugins/rails/rails.plugin.zsh @@ -52,6 +52,7 @@ alias ru='rails runner' alias rs='rails server' alias rsd='rails server --debugger' alias rsp='rails server --port' +alias rsb='rails server --bind' # Rake aliases alias rdm='rake db:migrate' From 42f56c5601f814ca34239324eefc9cb96cb4cdbc Mon Sep 17 00:00:00 2001 From: Dzianis Dashkevich Date: Sat, 12 Jun 2021 06:10:00 +0300 Subject: [PATCH 012/896] feat(rails): Add `rdmd` and `rdmu` aliases to Rails plugin (#6126) * `rdmd` is aliased to `rake db:migrate:down` * `rdmu` is aliased to `rake db:migrate:up` * These tasks allow you to run a specific migration up or down by specifying the appropriate `VERSION` env variable, which contains the numerical prefix of the migration's filename --- plugins/rails/rails.plugin.zsh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/rails/rails.plugin.zsh b/plugins/rails/rails.plugin.zsh index aa7576916..34aebbc2c 100644 --- a/plugins/rails/rails.plugin.zsh +++ b/plugins/rails/rails.plugin.zsh @@ -56,7 +56,9 @@ alias rsb='rails server --bind' # Rake aliases alias rdm='rake db:migrate' +alias rdmd='rake db:migrate:down' alias rdms='rake db:migrate:status' +alias rdmu='rake db:migrate:up' alias rdr='rake db:rollback' alias rdc='rake db:create' alias rds='rake db:seed' From 81db2af60131025f1bb1e25b27fc530066cdba3a Mon Sep 17 00:00:00 2001 From: Dzianis Dashkevich Date: Sat, 12 Jun 2021 06:12:13 +0300 Subject: [PATCH 013/896] feat(rails): Add `rdmr` (`rake db:migrate:redo`) alias to Rails plugin (#6124) Co-authored-by: Robby Russell --- plugins/rails/rails.plugin.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/rails/rails.plugin.zsh b/plugins/rails/rails.plugin.zsh index 34aebbc2c..29b413434 100644 --- a/plugins/rails/rails.plugin.zsh +++ b/plugins/rails/rails.plugin.zsh @@ -56,6 +56,7 @@ alias rsb='rails server --bind' # Rake aliases alias rdm='rake db:migrate' +alias rdmr='rake db:migrate:redo' alias rdmd='rake db:migrate:down' alias rdms='rake db:migrate:status' alias rdmu='rake db:migrate:up' From 0869a57cb585ad6279abf108c742e3c6650ed9d5 Mon Sep 17 00:00:00 2001 From: Wenli Wan Date: Sat, 12 Jun 2021 11:49:04 +0800 Subject: [PATCH 014/896] fix(kubectl): remove duplicated alias for kubectl plugin `kgsa` (#9927) --- plugins/kubectl/README.md | 1 - plugins/kubectl/kubectl.plugin.zsh | 1 - 2 files changed, 2 deletions(-) diff --git a/plugins/kubectl/README.md b/plugins/kubectl/README.md index 8937b2b80..f6651c8cd 100644 --- a/plugins/kubectl/README.md +++ b/plugins/kubectl/README.md @@ -107,7 +107,6 @@ plugins=(... kubectl) | ksss | `kubectl scale statefulset` | Scale a statefulset | | krsss | `kubectl rollout status statefulset`| Check the rollout status of a deployment | | | | **Service Accounts management** | -| kgsa | `kubectl get sa` | List all service accounts | | kdsa | `kubectl describe sa` | Describe a service account in details | | kdelsa | `kubectl delete sa` | Delete the service account | | | | **DaemonSet management** | diff --git a/plugins/kubectl/kubectl.plugin.zsh b/plugins/kubectl/kubectl.plugin.zsh index 56135274f..58a401120 100644 --- a/plugins/kubectl/kubectl.plugin.zsh +++ b/plugins/kubectl/kubectl.plugin.zsh @@ -151,7 +151,6 @@ alias kdpvc='kubectl describe pvc' alias kdelpvc='kubectl delete pvc' # Service account management. -alias kgsa="kubectl get sa" alias kdsa="kubectl describe sa" alias kdelsa="kubectl delete sa" From 94ea7b4516561c8a7587c7b74351bd6dd4f74583 Mon Sep 17 00:00:00 2001 From: Dom Sekotill Date: Sat, 12 Jun 2021 04:52:22 +0100 Subject: [PATCH 015/896] fix(virtualenvwrapper): several changes for checking git directory, including fixes (#5663) * Test only for the presence of a .git directory in virtualenvwrapper Instead of using both $(git rev-parse --show-toplevel) and a check for a .git directory, use just the latter. As well as being redundant the former does not work quite so well when using multiple worktrees; each worktree will be treated as a separate project. * Unset ENV_NAME & deactivate if no virtualenv found This addresses #4603 without breaking current behaviour (where current behaviour is correct). When changing directories, if there is no environment matching ENV_NAME, ENV_NAME is emptied and deactivate called if there is a current environment active (based on CD_VIRTUAL_ENV). * Use path comparison not string comparison for paths This will solve part of issue #4255 where WORKON_HOME is defined with a trailing slash or not normalised in some way, as well as instances where symlinks are used, and any other instances where constructed paths don't exactly match even though they go to the same file. Co-authored-by: Robby Russell --- .../virtualenvwrapper.plugin.zsh | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh b/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh index 88217a7f5..c30216f51 100644 --- a/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh +++ b/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh @@ -35,27 +35,19 @@ if [[ ! $DISABLE_VENV_CD -eq 1 ]]; then function workon_cwd { if [[ -z "$WORKON_CWD" ]]; then local WORKON_CWD=1 - # Check if this is a Git repo - local GIT_REPO_ROOT="" - local GIT_TOPLEVEL="$(git rev-parse --show-toplevel 2> /dev/null)" - if [[ $? == 0 ]]; then - GIT_REPO_ROOT="$GIT_TOPLEVEL" - fi # Get absolute path, resolving symlinks local PROJECT_ROOT="${PWD:A}" while [[ "$PROJECT_ROOT" != "/" && ! -e "$PROJECT_ROOT/.venv" \ - && ! -d "$PROJECT_ROOT/.git" && "$PROJECT_ROOT" != "$GIT_REPO_ROOT" ]]; do + && ! -d "$PROJECT_ROOT/.git" ]]; do PROJECT_ROOT="${PROJECT_ROOT:h}" done - if [[ "$PROJECT_ROOT" == "/" ]]; then - PROJECT_ROOT="." - fi + # Check for virtualenv name override if [[ -f "$PROJECT_ROOT/.venv" ]]; then ENV_NAME="$(cat "$PROJECT_ROOT/.venv")" elif [[ -f "$PROJECT_ROOT/.venv/bin/activate" ]];then ENV_NAME="$PROJECT_ROOT/.venv" - elif [[ "$PROJECT_ROOT" != "." ]]; then + elif [[ "$PROJECT_ROOT" != "/" ]]; then ENV_NAME="${PROJECT_ROOT:t}" else ENV_NAME="" @@ -68,14 +60,21 @@ if [[ ! $DISABLE_VENV_CD -eq 1 ]]; then fi if [[ "$ENV_NAME" != "" ]]; then # Activate the environment only if it is not already active - if [[ "$VIRTUAL_ENV" != "$WORKON_HOME/$ENV_NAME" ]]; then + if [[ ! "$VIRTUAL_ENV" -ef "$WORKON_HOME/$ENV_NAME" ]]; then if [[ -e "$WORKON_HOME/$ENV_NAME/bin/activate" ]]; then workon "$ENV_NAME" && export CD_VIRTUAL_ENV="$ENV_NAME" elif [[ -e "$ENV_NAME/bin/activate" ]]; then source $ENV_NAME/bin/activate && export CD_VIRTUAL_ENV="$ENV_NAME" + else + ENV_NAME="" fi fi fi + if [[ "$ENV_NAME" == "" && -n $CD_VIRTUAL_ENV && -n $VIRTUAL_ENV ]]; then + # We've just left the repo, deactivate the environment + # Note: this only happens if the virtualenv was activated automatically + deactivate && unset CD_VIRTUAL_ENV + fi fi } From a2e6a85bf30332005262c312bdd110ae9548a259 Mon Sep 17 00:00:00 2001 From: Francesco Giannelli Date: Sat, 12 Jun 2021 05:57:04 +0200 Subject: [PATCH 016/896] fix(plugins): cache thefuck aliases (#5522) --- plugins/thefuck/thefuck.plugin.zsh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/thefuck/thefuck.plugin.zsh b/plugins/thefuck/thefuck.plugin.zsh index b8586c70d..2ab4eb6e2 100644 --- a/plugins/thefuck/thefuck.plugin.zsh +++ b/plugins/thefuck/thefuck.plugin.zsh @@ -5,7 +5,8 @@ if [[ -z $commands[thefuck] ]]; then fi # Register alias -eval "$(thefuck --alias)" +[[ ! -a $ZSH_CACHE_DIR/thefuck ]] && thefuck --alias > $ZSH_CACHE_DIR/thefuck +source $ZSH_CACHE_DIR/thefuck fuck-command-line() { local FUCK="$(THEFUCK_REQUIRE_CONFIRMATION=0 thefuck $(fc -ln -1 | tail -n 1) 2> /dev/null)" From a3d90624df4ca9c4f438e8905f5c56399747db73 Mon Sep 17 00:00:00 2001 From: Gabo Esquivel Date: Fri, 11 Jun 2021 22:06:06 -0600 Subject: [PATCH 017/896] feature(plugins): add bower commands aliases (#3387) --- plugins/bower/bower.plugin.zsh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/bower/bower.plugin.zsh b/plugins/bower/bower.plugin.zsh index 6019b9d37..3a40b3af0 100644 --- a/plugins/bower/bower.plugin.zsh +++ b/plugins/bower/bower.plugin.zsh @@ -1,4 +1,6 @@ alias bi="bower install" +alias bisd="bower install --save-dev" +alias bis="bower install --save" alias bl="bower list" alias bs="bower search" From f68d65d32a4fce41f08ac229614b7e46baf5e916 Mon Sep 17 00:00:00 2001 From: Mitchel Humpherys Date: Fri, 11 Jun 2021 21:09:08 -0700 Subject: [PATCH 018/896] feat(take): add support to `take' for taking remote urls (#2029) Download, extract, and cd into the resulting directory. Co-authored-by: Mitchel Humpherys --- lib/functions.zsh | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/lib/functions.zsh b/lib/functions.zsh index c4340f16c..9cc735196 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -13,7 +13,7 @@ function upgrade_oh_my_zsh() { omz update } -function take() { +function takedir() { mkdir -p $@ && cd ${@:$#} } @@ -37,6 +37,30 @@ function open_command() { ${=open_cmd} "$@" &>/dev/null } +function takeurl() { + data=$(mktemp) + curl -L $1 > $data + tar xf $data + thedir=$(tar tf $data | head -1) + rm $data + cd $thedir +} + +function takegit() { + git clone $1 + cd $(basename ${1%%.git}) +} + +function take() { + if [[ $1 =~ ^(https?|ftp).*\.tar\.(gz|bz2|xz)$ ]]; then + takeurl $1 + elif [[ $1 =~ ^([A-Za-z0-9]\+@|https?|git|ssh|ftps?|rsync).*\.git/?$ ]]; then + takegit $1 + else + takedir $1 + fi +} + # # Get the value of an alias. # From 9bdbe08aa2c2ba4106f17082a9ee303b51167ba1 Mon Sep 17 00:00:00 2001 From: Daniel Wu Date: Sat, 12 Jun 2021 21:06:09 +0800 Subject: [PATCH 019/896] feat(plugins): add gpr alias for /git pull -rebase/ which is easier to remember (#9964) --- plugins/git/README.md | 1 + plugins/git/git.plugin.zsh | 1 + 2 files changed, 2 insertions(+) diff --git a/plugins/git/README.md b/plugins/git/README.md index 4f051db8d..93c9cc915 100644 --- a/plugins/git/README.md +++ b/plugins/git/README.md @@ -116,6 +116,7 @@ plugins=(... git) | gpf | git push --force-with-lease | | gpf! | git push --force | | gpoat | git push origin --all && git push origin --tags | +| gpr | git pull --rebase | | gpu | git push upstream | | gpv | git push -v | | gr | git remote | diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 35ebfbfa3..a364b6162 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -215,6 +215,7 @@ alias gpd='git push --dry-run' alias gpf='git push --force-with-lease' alias gpf!='git push --force' alias gpoat='git push origin --all && git push origin --tags' +alias gpr='git pull --rebase' alias gpu='git push upstream' alias gpv='git push -v' From 6779e10759c7c45f18a3ade1efac4d87b5ded7f1 Mon Sep 17 00:00:00 2001 From: Frani Date: Sat, 12 Jun 2021 10:08:27 -0300 Subject: [PATCH 020/896] feat(plugins): Add new isodate plugin for friendly date formatting commands (#9963) * add isodate plugin --- plugins/isodate/README.md | 22 ++++++++++++++++++++++ plugins/isodate/isodate.plugin.zsh | 7 +++++++ 2 files changed, 29 insertions(+) create mode 100644 plugins/isodate/README.md create mode 100644 plugins/isodate/isodate.plugin.zsh diff --git a/plugins/isodate/README.md b/plugins/isodate/README.md new file mode 100644 index 000000000..1ec75b2d4 --- /dev/null +++ b/plugins/isodate/README.md @@ -0,0 +1,22 @@ +# Isodate plugin + +**Maintainer:** [@Frani](https://github.com/frani) + +This plugin adds completion for the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601), +as well as some aliases for common Date commands. + +To use it, add `isodate` to the plugins array in your zshrc file: + +```zsh +plugins=(... isodate) +``` + +## Aliases + +| Alias | Command | Description | +|---------------|--------------------------------------|----------------------------------------------------------------------------| +| isodate | `date +%Y-%m-%dT%H:%M:%S%z` | Display the current date with UTC offset and ISO 8601-2 extended format | +| isodate_utc | `date -u +%Y-%m-%dT%H:%M:%SZ` | Display the current date in UTC and ISO 8601-2 extended format | +| isodate_basic | `date -u +%Y%m%dT%H%M%SZ` | Display the current date in UTC and ISO 8601 basic format | +| unixstamp | `date +%s` | Display the current date as a Unix timestamp (seconds since the Unix epoch)| +| date_locale | `date +"%c"` | Display the current date using the default locale's format | diff --git a/plugins/isodate/isodate.plugin.zsh b/plugins/isodate/isodate.plugin.zsh new file mode 100644 index 000000000..1a827e785 --- /dev/null +++ b/plugins/isodate/isodate.plugin.zsh @@ -0,0 +1,7 @@ +# work with date ISO 8601 easy + +alias isodate="date +%Y-%m-%dT%H:%M:%S%z" +alias isodate_utc="date -u +%Y-%m-%dT%H:%M:%SZ" +alias isodate_basic="date -u +%Y%m%dT%H%M%SZ" +alias unixstamp="date +%s" +alias date_locale="date +"%c"" From 3cdc36fc1eb096804a448ded93da1667e1b3f230 Mon Sep 17 00:00:00 2001 From: Oshadha Gunawardena Date: Sat, 12 Jun 2021 18:53:29 +0530 Subject: [PATCH 021/896] feat(plugins): Add a new showpkg alias to ubuntu plugin (#4653) Add an alias for ```showpkg``` to get the reverse and recursive dependencies on a package --- plugins/ubuntu/ubuntu.plugin.zsh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/ubuntu/ubuntu.plugin.zsh b/plugins/ubuntu/ubuntu.plugin.zsh index a53752fb2..989ffd1ff 100644 --- a/plugins/ubuntu/ubuntu.plugin.zsh +++ b/plugins/ubuntu/ubuntu.plugin.zsh @@ -15,6 +15,9 @@ alias agli='apt list --installed' # List available updates only alias aglu='apt list --upgradable' +alias acsp='apt-cache showpkg' +compdef _acsp acsp='apt-cache showpkg' + # superuser operations ###################################################### alias afu='sudo apt-file update' From 81a6cc5050136399ea0c664bacb8f83a999fe866 Mon Sep 17 00:00:00 2001 From: Mirko Lelansky Date: Sat, 12 Jun 2021 16:01:26 +0200 Subject: [PATCH 022/896] feat(plugins): Add helper function to get current mercurial bookmark (#4970) Add a new function to get the current mercurial bookmark which can be used in the theme prompts for example. --- plugins/mercurial/mercurial.plugin.zsh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plugins/mercurial/mercurial.plugin.zsh b/plugins/mercurial/mercurial.plugin.zsh index f13430476..a50dcb523 100644 --- a/plugins/mercurial/mercurial.plugin.zsh +++ b/plugins/mercurial/mercurial.plugin.zsh @@ -63,3 +63,9 @@ function hgic() { function hgoc() { hg outgoing "$@" | grep "changeset" | wc -l } + +function hg_get_bookmark_name() { + if [ $(in_hg) ]; then + echo $(hg id -B) + fi +} From 8aca13ff78e61e83e0e4aa0acb62f42c75e26eb9 Mon Sep 17 00:00:00 2001 From: javier wilson Date: Sat, 12 Jun 2021 08:02:10 -0600 Subject: [PATCH 023/896] feat(supervisord): autocomplete for restart command (#5144) From 26e9cead1a7c9264962986fdc3038ad7266c92bd Mon Sep 17 00:00:00 2001 From: Felix Stupp Date: Sat, 12 Jun 2021 14:10:06 +0000 Subject: [PATCH 024/896] feat(plugins): Plugin "debian": Switch order of "apt" and "aptitude" for detection (#7533) * Switch order of "apt" and "aptitude" for detection "apt" is installed by default at Debian (maybe Ubuntu too), while "aptitude" does not seem to be installed by default. For that, it may be better for most of the users to prefer "aptitude" if installed. * plugins/debian/README: Change of order mirroded into documentation --- plugins/debian/README.md | 2 +- plugins/debian/debian.plugin.zsh | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/plugins/debian/README.md b/plugins/debian/README.md index da5675c66..922d68cb3 100644 --- a/plugins/debian/README.md +++ b/plugins/debian/README.md @@ -10,7 +10,7 @@ plugins=(... debian) ## Settings -- `$apt_pref`: use apt or aptitude if installed, fallback is apt-get. +- `$apt_pref`: use aptitude or apt if installed, fallback is apt-get. - `$apt_upgr`: use upgrade or safe-upgrade (for aptitude). Set `$apt_pref` and `$apt_upgr` to whatever command you want (before sourcing Oh My Zsh) to override this behavior. diff --git a/plugins/debian/debian.plugin.zsh b/plugins/debian/debian.plugin.zsh index 108396784..bde97cd30 100644 --- a/plugins/debian/debian.plugin.zsh +++ b/plugins/debian/debian.plugin.zsh @@ -1,13 +1,13 @@ -# Use apt or aptitude if installed, fallback is apt-get +# Use aptitude or apt if installed, fallback is apt-get # You can just set apt_pref='apt-get' to override it. if [[ -z $apt_pref || -z $apt_upgr ]]; then - if [[ -e $commands[apt] ]]; then - apt_pref='apt' - apt_upgr='upgrade' - elif [[ -e $commands[aptitude] ]]; then + if [[ -e $commands[aptitude] ]]; then apt_pref='aptitude' apt_upgr='safe-upgrade' + elif [[ -e $commands[apt] ]]; then + apt_pref='apt' + apt_upgr='upgrade' else apt_pref='apt-get' apt_upgr='upgrade' From e701fa49e7fc5f8aaef4ba680e012a14bce00c4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rolf=20Schr=C3=B6der?= Date: Sat, 12 Jun 2021 16:12:07 +0200 Subject: [PATCH 025/896] feat(plugins): New plugins for samtools and bedtools (#3574) * Add first impl of samtools autocompletion * Just autocomplete with files all the time * Add init impl of bedtools completion * Add readme.md for bedtools plugin * Add readme for samtools Co-authored-by: Rolf Schroeder --- plugins/bedtools/README.md | 5 +++ plugins/bedtools/_bedtools | 64 ++++++++++++++++++++++++++++++++++++++ plugins/samtools/README.md | 5 +++ plugins/samtools/_samtools | 40 ++++++++++++++++++++++++ 4 files changed, 114 insertions(+) create mode 100644 plugins/bedtools/README.md create mode 100644 plugins/bedtools/_bedtools create mode 100644 plugins/samtools/README.md create mode 100644 plugins/samtools/_samtools diff --git a/plugins/bedtools/README.md b/plugins/bedtools/README.md new file mode 100644 index 000000000..c4de4e3a9 --- /dev/null +++ b/plugins/bedtools/README.md @@ -0,0 +1,5 @@ +# Bedtools plugin + +This plugin adds support for the [bedtools suite](http://bedtools.readthedocs.org/en/latest/): + +* Adds autocomplete options for all bedtools sub commands. diff --git a/plugins/bedtools/_bedtools b/plugins/bedtools/_bedtools new file mode 100644 index 000000000..ef6c4179a --- /dev/null +++ b/plugins/bedtools/_bedtools @@ -0,0 +1,64 @@ +#compdef bedtools +#autoload + +local curcontext="$curcontext" state line ret=1 +local -a _files + +_arguments -C \ + '1: :->cmds' \ + '2:: :->args' && ret=0 + +case $state in + cmds) + _values "bedtools command" \ + "--contact[Feature requests, bugs, mailing lists, etc.]" \ + "--help[Print this help menu.]" \ + "--version[What version of bedtools are you using?.]" \ + "annotate[Annotate coverage of features from multiple files.]" \ + "bamtobed[Convert BAM alignments to BED (& other) formats.]" \ + "bamtofastq[Convert BAM records to FASTQ records.]" \ + "bed12tobed6[Breaks BED12 intervals into discrete BED6 intervals.]" \ + "bedpetobam[Convert BEDPE intervals to BAM records.]" \ + "bedtobam[Convert intervals to BAM records.]" \ + "closest[Find the closest, potentially non-overlapping interval.]" \ + "cluster[Cluster (but don't merge) overlapping/nearby intervals.]" \ + "complement[Extract intervals _not_ represented by an interval file.]" \ + "coverage[Compute the coverage over defined intervals.]" \ + "expand[Replicate lines based on lists of values in columns.]" \ + "fisher[Calculate Fisher statistic b/w two feature files.]" \ + "flank[Create new intervals from the flanks of existing intervals.]" \ + "genomecov[Compute the coverage over an entire genome.]" \ + "getfasta[Use intervals to extract sequences from a FASTA file.]" \ + "groupby[Group by common cols. & summarize oth. cols. (~ SQL "groupBy")]" \ + "igv[Create an IGV snapshot batch script.]" \ + "intersect[Find overlapping intervals in various ways.]" \ + "jaccard[Calculate the Jaccard statistic b/w two sets of intervals.]" \ + "links[Create a HTML page of links to UCSC locations.]" \ + "makewindows[Make interval "windows" across a genome.]" \ + "map[Apply a function to a column for each overlapping interval.]" \ + "maskfasta[Use intervals to mask sequences from a FASTA file.]" \ + "merge[Combine overlapping/nearby intervals into a single interval.]" \ + "multicov[Counts coverage from multiple BAMs at specific intervals.]" \ + "multiinter[Identifies common intervals among multiple interval files.]" \ + "nuc[Profile the nucleotide content of intervals in a FASTA file.]" \ + "overlap[Computes the amount of overlap from two intervals.]" \ + "pairtobed[Find pairs that overlap intervals in various ways.]" \ + "pairtopair[Find pairs that overlap other pairs in various ways.]" \ + "random[Generate random intervals in a genome.]" \ + "reldist[Calculate the distribution of relative distances b/w two files.]" \ + "sample[Sample random records from file using reservoir sampling.]" \ + "shuffle[Randomly redistrubute intervals in a genome.]" \ + "slop[Adjust the size of intervals.]" \ + "sort[Order the intervals in a file.]" \ + "subtract[Remove intervals based on overlaps b/w two files.]" \ + "tag[Tag BAM alignments based on overlaps with interval files.]" \ + "unionbedg[Combines coverage intervals from multiple BEDGRAPH files.]" \ + "window[Find overlapping intervals within a window around an interval.]" \ + ret=0 + ;; + *) + _files + ;; +esac + +return ret diff --git a/plugins/samtools/README.md b/plugins/samtools/README.md new file mode 100644 index 000000000..f4baf41f7 --- /dev/null +++ b/plugins/samtools/README.md @@ -0,0 +1,5 @@ +# Samtools plugin + +This plugin adds support for [samtools](http://www.htslib.org/): + +* Adds autocomplete options for all samtools sub commands. diff --git a/plugins/samtools/_samtools b/plugins/samtools/_samtools new file mode 100644 index 000000000..ddb002ae2 --- /dev/null +++ b/plugins/samtools/_samtools @@ -0,0 +1,40 @@ +#compdef samtools +#autoload + +local curcontext="$curcontext" state line ret=1 +local -a _files + +_arguments -C \ + '1: :->cmds' \ + '2:: :->args' && ret=0 + +case $state in + cmds) + _values "samtools command" \ + "view[SAM<->BAM conversion]" \ + "sort[sort alignment file]" \ + "mpileup[multi-way pileup]" \ + "depth[compute the depth]" \ + "faidx[index/extract FASTA]" \ + "tview[text alignment viewer]" \ + "index[index alignment]" \ + "idxstats[BAM index stats (r595 or later)]" \ + "fixmate[fix mate information]" \ + "flagstat[simple stats]" \ + "calmd[recalculate MD/NM tags and '=' bases]" \ + "merge[merge sorted alignments]" \ + "rmdup[remove PCR duplicates]" \ + "reheader[replace BAM header]" \ + "cat[concatenate BAMs]" \ + "bedcov[read depth per BED region]" \ + "targetcut[cut fosmid regions (for fosmid pool only)]" \ + "phase[phase heterozygotes]" \ + "bamshuf[shuffle and group alignments by name]" + ret=0 + ;; + *) + _files + ;; +esac + +return ret From 5b3657a454efdd5d27753c049cc2e2f1c4d82bc7 Mon Sep 17 00:00:00 2001 From: Guillermo Alcantara Date: Sat, 12 Jun 2021 10:49:08 -0500 Subject: [PATCH 026/896] feat(plugins): Add Ag completion (#3534) * Add Ag completion A replacement for ack/grep https://github.com/ggreer/the_silver_searcher * Create README.md As requested in the PR: https://github.com/ohmyzsh/ohmyzsh/pull/3534 --- plugins/ag/README.md | 13 +++++++++ plugins/ag/_ag | 66 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+) create mode 100644 plugins/ag/README.md create mode 100644 plugins/ag/_ag diff --git a/plugins/ag/README.md b/plugins/ag/README.md new file mode 100644 index 000000000..6acc54067 --- /dev/null +++ b/plugins/ag/README.md @@ -0,0 +1,13 @@ +# The Silver Searcher + +This plugin provides completion support for [`ag`](https://github.com/ggreer/the_silver_searcher). + +To use it, add ag to the plugins array in your zshrc file. + +```zsh +plugins=(... aws) +``` + +## INSTALLATION NOTES + +Besides oh-my-zsh, `ag` needs to be installed by following these steps: https://github.com/ggreer/the_silver_searcher#installing. diff --git a/plugins/ag/_ag b/plugins/ag/_ag new file mode 100644 index 000000000..25b0c27a7 --- /dev/null +++ b/plugins/ag/_ag @@ -0,0 +1,66 @@ +#compdef ag +#autoload + +typeset -A opt_args + +# Took the liberty of not listing every option… specially aliases and -D +_ag () { + local -a _1st_arguments + _1st_arguments=( + '--ackmate:Print results in AckMate-parseable format' + {'-A','--after'}':[LINES] Print lines after match (Default: 2)' + {'-B','--before'}':[LINES] Print lines before match (Default: 2)' + '--break:Print newlines between matches in different files' + '--nobreak:Do not print newlines between matches in different files' + {'-c','--count'}':Only print the number of matches in each file' + '--color:Print color codes in results (Default: On)' + '--nocolor:Do not print color codes in results' + '--color-line-number:Color codes for line numbers (Default: 1;33)' + '--color-match:Color codes for result match numbers (Default: 30;43)' + '--color-path:Color codes for path names (Default: 1;32)' + '--column:Print column numbers in results' + {'-H','--heading'}':Print file names (On unless searching a single file)' + '--noheading:Do not print file names (On unless searching a single file)' + '--line-numbers:Print line numbers even for streams' + {'-C','--context'}':[LINES] Print lines before and after matches (Default: 2)' + '-g:[PATTERN] Print filenames matching PATTERN' + {'-l','--files-with-matches'}':Only print filenames that contain matches' + {'-L','--files-without-matches'}':Only print filenames that do not contain matches' + '--no-numbers:Do not print line numbers' + {'-o','--only-matching'}':Prints only the matching part of the lines' + '--print-long-lines:Print matches on very long lines (Default: 2k characters)' + '--passthrough:When searching a stream, print all lines even if they do not match' + '--silent:Suppress all log messages, including errors' + '--stats:Print stats (files scanned, time taken, etc.)' + '--vimgrep:Print results like vim :vimgrep /pattern/g would' + {'-0','--null'}':Separate filenames with null (for "xargs -0")' + + {'-a','--all-types'}':Search all files (does not include hidden files / .gitignore)' + '--depth:[NUM] Search up to NUM directories deep (Default: 25)' + {'-f','--follow'}':Follow symlinks' + {'-G','--file-search-regex'}':[PATTERN] Limit search to filenames matching PATTERN' + '--hidden:Search hidden files (obeys .*ignore files)' + {'-i','--ignore-case'}':Match case insensitively' + '--ignore:[PATTERN] Ignore files/directories matching PATTERN' + {'-m','--max-count'}':[NUM] Skip the rest of a file after NUM matches (Default: 10k)' + {'-p','--path-to-agignore'}':[PATH] Use .agignore file at PATH' + {'-Q','--literal'}':Do not parse PATTERN as a regular expression' + {'-s','--case-sensitive'}':Match case' + {'-S','--smart-case'}':Insensitive match unless PATTERN has uppercase (Default: On)' + '--search-binary:Search binary files for matches' + {'-t','--all-text'}':Search all text files (Hidden files not included)' + {'-u','--unrestricted'}':Search all files (ignore .agignore and _all_)' + {'-U','--skip-vcs-ignores'}':Ignore VCS files (stil obey .agignore)' + {'-v','--invert-match'}':Invert match' + {'-w','--word-regexp'}':Only match whole words' + {'-z','--search-zip'}':Search contents of compressed (e.g., gzip) files' + + '--list-file-types:list of supported file types' + ) + + if [[ $words[-1] =~ "^-" ]]; then + _describe -t commands "ag options" _1st_arguments && ret=0 + else + _files && ret=0 + fi +} From baced0cdcf491b1ecf7176f5bba16a3a95dd0460 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Sun, 13 Jun 2021 08:10:29 -0700 Subject: [PATCH 027/896] style(kubectl): Being more explicit alias to the main CLI tool instead of to another alias (#6567) --- plugins/kubectl/kubectl.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/kubectl/kubectl.plugin.zsh b/plugins/kubectl/kubectl.plugin.zsh index b79b7c941..3630facaa 100644 --- a/plugins/kubectl/kubectl.plugin.zsh +++ b/plugins/kubectl/kubectl.plugin.zsh @@ -43,7 +43,7 @@ alias kgpwide='kgp -o wide' alias kep='kubectl edit pods' alias kdp='kubectl describe pods' alias kdelp='kubectl delete pods' -alias kgpall='k get pods --all-namespaces -o wide' +alias kgpall='kubectl get pods --all-namespaces -o wide' # get pod by label: kgpl "app=myapp" -n myns alias kgpl='kgp -l' From 5152d381bb828a4ed41fdbb430eb05970a8bb25c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stanis=C5=82aw=20Szyd=C5=82o?= Date: Sun, 13 Jun 2021 17:23:13 +0200 Subject: [PATCH 028/896] feat(kubectx): adding a new plugin for 'kubectx' (#6114) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Marc CornellĂ  Co-authored-by: Robby Russell --- lib/prompt_info_functions.zsh | 1 + plugins/kubectx/README.md | 26 ++++++++++++++++++++++++++ plugins/kubectx/kubectx.plugin.zsh | 14 ++++++++++++++ plugins/kubectx/prod.png | Bin 0 -> 3834 bytes plugins/kubectx/stage.png | Bin 0 -> 3829 bytes 5 files changed, 41 insertions(+) create mode 100644 plugins/kubectx/README.md create mode 100644 plugins/kubectx/kubectx.plugin.zsh create mode 100644 plugins/kubectx/prod.png create mode 100644 plugins/kubectx/stage.png diff --git a/lib/prompt_info_functions.zsh b/lib/prompt_info_functions.zsh index 48f033da6..e29fb27a5 100644 --- a/lib/prompt_info_functions.zsh +++ b/lib/prompt_info_functions.zsh @@ -19,6 +19,7 @@ function chruby_prompt_info \ virtualenv_prompt_info \ jenv_prompt_info \ tf_prompt_info \ + kubectx_prompt_info \ { return 1 } diff --git a/plugins/kubectx/README.md b/plugins/kubectx/README.md new file mode 100644 index 000000000..9a1df2617 --- /dev/null +++ b/plugins/kubectx/README.md @@ -0,0 +1,26 @@ +# kubectx - show active kubectl context + +This plugins adds ```kubectx_prompt_info()``` function. It shows name of the +active kubectl context (```kubectl config current-context```). + +You can use it to customize prompt and know if You are on prod cluster ;) + +_Example_. Add to **.zshrc**: + +``` +RPS1='$(kubectx_prompt_info)' +``` + +### custom ctx names + +One can rename default context name for better readability. + +_Example_. Add to **.zshrc**: +``` +kubectx_mapping[minikube] = "mini" +kubectx_mapping[context_name_from_kubeconfig]="$emoji[wolf_face]" +kubectx_mapping[production_cluster]="%{$fg[yellow]%}prod!%{$reset_color%}" +``` + +![staging](stage.png) +![production](prod.png) diff --git a/plugins/kubectx/kubectx.plugin.zsh b/plugins/kubectx/kubectx.plugin.zsh new file mode 100644 index 000000000..56b7217f1 --- /dev/null +++ b/plugins/kubectx/kubectx.plugin.zsh @@ -0,0 +1,14 @@ +typeset -A kubectx_mapping + +function kubectx_prompt_info() { + if [ $commands[kubectl] ]; then + local current_ctx=`kubectl config current-context` + + #if associative array declared + if [[ -n $kubectx_mapping ]]; then + echo "${kubectx_mapping[$current_ctx]}" + else + echo $current_ctx + fi + fi +} diff --git a/plugins/kubectx/prod.png b/plugins/kubectx/prod.png new file mode 100644 index 0000000000000000000000000000000000000000..0c194a66d357e3089e26470e54bcd9cd1614aca0 GIT binary patch literal 3834 zcmd6qXH-*Zx5uNRqLdd9DN2#z7)FpL5Rf7SVGTINGD(2YA%Fs5z<`D3Xrx9F z5fCXE3Pj{{R;hg6@d!6$bm_e##iL@`y|PVyUQ3e*~ZF^(6O=U8SO{S{AE96DKJTv?2GjAx;JasBpNafB^n9 z=ykw;71=%0i!O-lwMyV}(Tf3wsjebB!%wnAWPjSO1U)J;q#6DnERgW_L~G1d?EDWK zmyzs+HN|bOgw?sM50rv-j0cBTt@XPJONDelHZyc(C|w)EQgr}NZ?;|!#%_!{vAH+O z)O;ScEPbQoH>$=?ZSZPrwvB^n#D>)cUN>L8N^RrqsQ|&1#ol&BcQb2&X7C8)n40B_ z^>-sKrNMbO^&hbw>JH89v0;{_eoo(B`MpvzOo2Af@I?TDLZR zDiFtB!-Rm-3qg@759KwCF*F%psgisr8sFM(2nIarFFRhn zIo)!i&GoG*Q>s)9lsW00SM0PB^>ur`)nFNxBD5|@QL1ic6@yUe`;$m zh4wG3?f%{nIUp_HpC)sG<{9S9`Ud)oB!KU&H5zr`ED5F-e}tBUX{#?@`n1kZ@w&>v zUV)`cBX_K)(jr@;X6Hk08)uPWJq?JJT-FDdhocPoR*-HPU6s$`@dIRE?@icIEE$KF zSL>AYzTEUQ8+ItwE}*bz5{R-RA8o7&%IR!I7rSKI!X@aoR^&Wzg5NWaHDXc{fvv40 zItu@lvxlJj3K1{3sl+&b=w$<~zvlDK<6e*|HAa&Re!H6%EMrOYl(EwSxpEYt`!dDs z)-&#QabHl7@sIa7Ca!JpzBv|7(^U}}`8u1F@jVuH0J6F+iHo{h;K1s!Xge1cgkU3Y z;go}0RK0X7|?v;HrWoDnrvCYw^B#tH4+(xk^nUGf@f7 za86~2-)gSsQ9vG?wb(1ywij|&VjpqMbuqSaOW-)p9I}$r+m98ya$r8RtA8#hd^zKs z@DT2tBp4mukAke-(^6Z!=9)d{;1%tyzVmQWx=c>pkmdj~I4M$A8d0!Lh4u7B*a&*y z{mgk;`|{(vfJ%Fdj456Mw!CrK@WM+Svq`XckeJrai_9x&u$;Qx^fRk>W_2I8Ut5KL zL;ILZuq>>TRk29GZtju(_GnCNmFA`F*Tk9^q~?jKoZ-=rdo%S5D?pU$V$}U%Z^_;1 zu~vhx(YmAYA4;3Qm8CL3W}V1c%NVh~nJgRRc$S44n)@}&`MoqtfYVpvnHfi^64Ok> z=ruMVn9WI3Ve4~mp~bAJ=omkVuO`ecc*U08`C5kzJIs)S=C$jB)t3{BYNh`icu-fx z<>m&hoJ83on(8>`mf7;ojppidGz@LrRQt_Erb6!f<6s}vewoQ~ur?MM%wGkShNjl2 zgbE{=GCoyJMWG;M3)I`}uvP2elzDM%POCP=HP{QNXJf`f^A^~za>Qgm z`l0>=eM^;Q=E8_FS17+##fpBof0?Mp{ z^n;WJ2fcCc)s+K~eLZhB%PrUR67C*+hAzF^8BS-0DRp!V#duqd>1=kaVvw!GS-3@GLFnJX7*EKdq#RAHUBn80g!p4DBnl{(r=UU$b8MZjYDdD-=Ow#4ECxbzBUDSM`hNTQ8=}H7nqFX=+qhUfl}^y0 z!fyFqs!#gMqZs!gkKt)WE%%A44QZ`gm@sKO7ZmN*RlmqEUH+x^BL2zs#P}ju@8?0k z36lM0sc}i&^?0||DStK&Q&ZbOw0gL3#u1n$m7X`5z8EQm6R^K5%06UCD zsz=^rGz@2cZ5r*0cq_g#v^@Gp$2(mg&wK2C$`PXBNasDTH}an{4KD1hlKIaX*wbJP zh-hT}=J2y3Q(lktgmg)Ik~MejaVUkXd?C=E>zTXuyYBMYka6#sGF)a!)2(s)TenZk z2hXn`|8ccG<(?9nsSs-eQzYl47Y5r)&FQmNxz3h~Mf#%|?;IRXZHA4-Zlmf-ln~6+ zBAgdV3zwCiF|@;myT}j9nbd6$hZhJ5O+EmKbSDg-S0j7pz_jkQ zSBYPoKVyMEB2&uich@v{u#B&$Jke%OOQ`x3*0Ut2T(ohYz3$v5$@&N9G*~@oqw*{EIEu=rvED2beg}H4)U}spZE!=kwV&hdDI>#1bl*yR#a@zuWqaK#XS5J)hcZyTc9(Fuzva~j%b+f56 zEtTQMX+-7Ou*0bB=@YHVZ%@wRkZTmH)U07lFMvzxD?xUdk>}&qZ9k10(f)ic<^1Cxd zjQ_Odxn%xV+)h8MU5D!M%!tI>VUTlH1rUH=MT`MR@@?X@A}? z#x*5kepSD>yZ>x-rAQ6TUX(q_mr)jw6TmdIkYHHX6MLy0rY7*!rzjvnE`&@m9I?}( zMF|YtEU^1R6;2xu*N9X@t;d=E%A7XTj*}A4O_C7`zw!}+H)swnER#wx#FhS39MKx! zfH$F>pPq&~C|J`r5rRN`$3stQ(``smlqwwX?(Zxzt{k*A7Cb4o@TTAy4>z7@QDbi# z&aT$aRcrnC(_8V}cFK+LNd?>~-##iil3@Hyg=YQ=#9R4C)38!B{U4b(wo2Tv{6$Gl zUJ%ING@&1StsvHCG460#%zgc7s-fgNf}Hn5ou6KL*<<>fhn0Wop8!Q80$uyR>?c`b z+`ZHPms9SdcvpV?TRlNe_5Od5Rib+OUxi)DC}rKI%Oq)?J5ZZ1)T;o<8E5-yJKyAg E10~p6Gynhq literal 0 HcmV?d00001 diff --git a/plugins/kubectx/stage.png b/plugins/kubectx/stage.png new file mode 100644 index 0000000000000000000000000000000000000000..ac15b392997ee141c324548c6924fe92a82f72f9 GIT binary patch literal 3829 zcmb`KdpOhm`@p5?aV~no_^El2(&MSwgoO+x|$u~-E7-LG> z9LjucD7KX?hpeSAOy)G>JN108>-Wd+zu)hV&--)V*L7d->%Q;z`+ncA`;PksM>%O# zX)!S|Ij3`Wm&C+&Vnp&;$z7s#rbse z^7puCK6BXE#{};Um;383P4k}fIZUDM-P_HeuylsaEl`4%&+U_wx0ar4br!C4c?~{H z3R=G;-vRzA@c@mG^CkhGnhhPgpX)d=YebIDa(1`b9v;MMj3;g`>b5gXqO%stS^^~r8Fb_u z`$Pu8MZpqJknLpPp1*8vpFfx_ck86M$__r)>NQC^k+z`bVSBJMS7^>C^77eQkBd=H zHqsYAR8<7kSdk#RLI+C1(>>8q#3i7A*;GvOM2r#EIltOlRTk5#Vc8;$`AuHK+v3K; z%hon_o@K1-=%=1^dL?mVUAI~lMC!CZtXvLZ>E}pc+`*%3c@n7bl)j{;IqEC4m`WuP)L~g^u2)n{&2FfX|7kLu?Z*s zO(AOHi*#rIkt4Q;UhNMVYTwF}?=IQHT#Y84U@1Tzn1p0X6zj0rq0!9MWq?GFYT zWt7+l->+JaPJUI+1Y?;E0 z=SmijXx{3x0@$hN&F~!dOJbMyr4W$83+|+v;vXC^?It{8-4?*_Wr|+CukT*TmI^MH zS#yY<4@<_S&w!2%>+Kx9SB&e!1_5_Ho0q}Fyr{0nhO27|0`PT)p{j#0!6<0_?PO`z zvR32yR@rN|+SdZZQ-B>tvW!kSRK=+)m%JFFBqXmRbSON+GV87-UN{|%0GVLm8AVK^ zip6%>Cy@T%Z95+u)XH&^)l;#i`p#vuoBi~7Z@jTi%Nyq6DW(-$8+Mp_m!~PgI zP$|E|;Sr^H`KkxF=5>Xq1V3hv+Fn&yPYE|Op&h;+{?;B5KN!-huSCAmj8w#@QO6W& zC9jPP`GiShnoEptJtE47z-{1^)h3~PUTcdl^BE;FyOtf#K)!zc$;u=5sm~&1&COf< zit6@Rlpn>S(fm7}=Y;&hyn35Z;Dz8s{^a`Ww(S^T-Maoc?;PSNOjw~YhBGvt(9T=S zol2?sP&Y+?%1?614*Iron!jS;luw&3$3e$Rm_f5f6CEXc6~0_Ol??O)7fT?zhviJ^Y zCP|Usc%^7zUu_WLZ!(I?c&B2T(|{yxXCa68p$}~i62B3b4B>TpnP9fe}a>oG9(P3LrdX2u&sa(WL`WCU3^@+&m4o!q!8wNPkqzy5YZ?yCtnUoc!o-XM6{Ej*; zDuN^aE%L)HM@TnB1#UPL*bzO}aH?89O^eujy93;svIqPa%_^fqEr^Z2xDzeo(Bz9* zFIK7gN^3?+OsIa-)7!Yq$UFn1yATqT`g?Kh_;o}JC=WTSe9V>Gs^n5g8DSXu;?kqW zJ4)mG%`B(fTivYP?~ag|75@7GjD-F8XC6V9yDR*Q9x+rev%$$^xQX4UlE5xfV&!gA z9seQSRal%c&}#54Y7;{0#OXTaU)PhvI4%$LCy;cja)3_7bBj5z(uu1EzDA#F$UzBmR=hf%iDp?lhq}c#n`j`4<_!3u@O`>i-ee zQ>4l?Q${!gT`Yd=H&bFgtAtA(*LGJJiX$ChP71vux`(=)vyDS#k~C_wAm@7qqwQR& z0gH~6ae6ksaU8tq?-7q5pv@wZ(1K}|o$$bkA9@{&2U0tgNCSDTO-FO!u$1+jDG&0vtH6hX2G+RV8QV z9Z;vBt-*C$^R$=Uy4sJTcHDVU%0VgF1!u`zC{%u0Ckf+8Sf(G`(=>hDOZ!|AKfNBS z|HhCKURQ;pu1XFmY@Rj4mJAN4gRDsk*}%ie%jyQFmBk~xGi%G>QjrrDmx$y(?imtL z)NXTrU|MKl(L@CmwpsEHJoaF=yhM)(Tu$1c)?VdVK?}*x8wX7rGDS`FP%yZtdcUg+ zn4Tny5ry?Zv_?oPfNVjJxeD%V6Vsn;BO;u(BRDl;JLv@G{W6%S)_@wngxGFC|AkTf z58V3qDPNO+FaM-guG{}ktJU{AstSVIj7!E`SP^!=Y}%yMZY;f=6H(g`VgKL1Xg5M! za0)xNCe(bw$_(f{QNTUA&Ax(>x=gp2L^o2Cbd_J({Oc)$2Kp~Dd1xlMw9+dxpESBT z5sj=X-d$p%wO-?vJFJ`m+-=f~ntl9qYRzi?e)sg4UTf_9Sn|J4Z>F(^mMtO2`vU~d z+u)6MSk1zntNkJ(i1IYD23YHaq6*twUhPa9h}@1?U0!b+6RiQqk3t$zFFPLcxrC3 z$!*BTxB+a)OJBbX6PZT1_g)ZWj+H4w8J85iU-_>Cs1_beJ!o76uoVw}+1yG~1U9^jno;>Yoo=}t7`YIv8f zpa&JgA$nxD1<{c^i$yKDdM0zi`J7H1Bm91su75!!1liC%T^iUi!ux8Zi@or-#PE4S z!}jD7?ClHY?2ikcdF6FNri6O4$qfi<6{h~Nr01#8z5Qy8 zk`3_+sSVm{s`uGNML{lQ8>OehaTe>jQ?@ZY-ORG;FkG2p=NAYqx Date: Sun, 13 Jun 2021 19:16:34 +0200 Subject: [PATCH 029/896] style(mlh): update the official theme of Major League Hacking (#9971) * allow for customization of RPROMPT (exit code and timestamp) * improve code and comments --- themes/mlh.zsh-theme | 55 ++++++++++++++++++++++++++------------------ 1 file changed, 33 insertions(+), 22 deletions(-) diff --git a/themes/mlh.zsh-theme b/themes/mlh.zsh-theme index a21a546bc..33f238ed9 100644 --- a/themes/mlh.zsh-theme +++ b/themes/mlh.zsh-theme @@ -1,11 +1,12 @@ -# The Official Theme of -## ## ## ## ## -### ### ## ## ## -#### #### ## ## ## -## ### ## ## ######### -## ## ## ## ## -## ## ## ## ## -## ## ######## ## ## +# The Official Theme of Major League Hacking + +## ## ## ## ## +### ### ## ## ## +#### #### ## ## ## +## ### ## ## ######### +## ## ## ## ## +## ## ## ## ## +## ## ######## ## ## # # # # # # # # # # # # # # # # # # # # # Feel free to customize! # # # @@ -13,11 +14,17 @@ # To easily discover colors and their codes, type `spectrum_ls` in the terminal +# enable or disable particular elements +PRINT_EXIT_CODE=true +PRINT_TIME=true + +# symbols AT_SYMBOL=" @ " IN_SYMBOL=" in " ON_SYMBOL=" on " -SYMBOL="$" +SHELL_SYMBOL="$" +# colors USER_COLOR="%F{001}" DEVICE_COLOR="%F{033}" DIR_COLOR="%F{220}" @@ -25,35 +32,39 @@ BRANCH_COLOR="%F{001}" TIME_COLOR="%F{033}" username() { - echo "$USER_COLOR%n%f" + echo "$USER_COLOR%n%f" } -# Returns device name +# Prints device name device() { - echo "$DEVICE_COLOR%m%f" + echo "$DEVICE_COLOR%m%f" } -# The current directory +# Prints the current directory directory() { - echo "$DIR_COLOR%1~%f" + echo "$DIR_COLOR%1~%f" } -# Current time with milliseconds +# Prints current time current_time() { - echo "$TIME_COLOR%*%f" + if [ "$PRINT_TIME" = true ]; then + echo " $TIME_COLOR%*%f" + fi } -# Return status of the last command -return_status() { - echo "%(?..%F{001}out %?)%f" +# Prints exit code of the last executed command +exit_code() { + if [ "$PRINT_EXIT_CODE" = true ]; then + echo "%(?..%F{001}exit %?)%f" + fi } -# Set the git_prompt_info text +# Set git_prompt_info text ZSH_THEME_GIT_PROMPT_PREFIX="${ON_SYMBOL}${BRANCH_COLOR}" ZSH_THEME_GIT_PROMPT_SUFFIX="%f" ZSH_THEME_GIT_PROMPT_DIRTY="" ZSH_THEME_GIT_PROMPT_CLEAN="" # %B and %b make the text bold -PROMPT='%b$(username)$AT_SYMBOL$(device)$IN_SYMBOL$(directory)$(git_prompt_info)%b $SYMBOL ' -RPROMPT="$(return_status) $(current_time)" +PROMPT='%b$(username)$AT_SYMBOL$(device)$IN_SYMBOL$(directory)$(git_prompt_info)%b $SHELL_SYMBOL ' +RPROMPT="$(exit_code)$(current_time)" From 960483b76b536a525bb6b458f5705b2653064e46 Mon Sep 17 00:00:00 2001 From: Sagar Yadav <47110215+SagarYadav17@users.noreply.github.com> Date: Sun, 13 Jun 2021 22:53:58 +0530 Subject: [PATCH 030/896] feat(pip): add alias for updating all requirements via pip (#9965) * feat(plugins): add alias for pip commands * feat(plugins): updated README.md and add alias --- plugins/pip/README.md | 9 +++++++++ plugins/pip/pip.plugin.zsh | 11 +++++++++++ 2 files changed, 20 insertions(+) diff --git a/plugins/pip/README.md b/plugins/pip/README.md index f07b5c058..88d88227e 100644 --- a/plugins/pip/README.md +++ b/plugins/pip/README.md @@ -17,3 +17,12 @@ or you can run `zsh-pip-cache-packages` directly. To reset the cache, run `zsh-pip-clear-cache` and it will be rebuilt next the next time you autocomplete `pip install`. + +## Aliases + +| Alias | Description | +| :------- | :-------------------------------------------- | +| pipreq | Create requirements file | +| pipir | Install packages from `requirements.txt` file | +| pipupall | Update all installed packages | +| pipunall | Uninstall all installed packages | diff --git a/plugins/pip/pip.plugin.zsh b/plugins/pip/pip.plugin.zsh index a46e7658c..629147bae 100644 --- a/plugins/pip/pip.plugin.zsh +++ b/plugins/pip/pip.plugin.zsh @@ -84,3 +84,14 @@ zsh-pip-test-clean-packages() { alias pip="noglob pip" # allows square brackets for pip command invocation +# Create requirements file +alias pipreq="pip freeze > requirements.txt" + +# Update all installed packages +alias pipupall="pipreq && sed -i 's/==/>=/g' requirements.txt && pip install -r requirements.txt --upgrade && rm -rf requirements.txt" + +# Install packages from requirements file +alias pipir="pip install -r requirements.txt" + +# Uninstalled all installed packages +alias pipunall="pipreq && pip uninstall -r requirements.txt -y && rm -rf requirements.txt" From 3ea66642e8d86b597e6c789358b82540859b178a Mon Sep 17 00:00:00 2001 From: Lasse Peters Date: Sun, 13 Jun 2021 19:25:27 +0200 Subject: [PATCH 031/896] feat(git): Add alias for 'git checkout --recurse-submodules' (#9958) --- plugins/git/README.md | 1 + plugins/git/git.plugin.zsh | 1 + 2 files changed, 2 insertions(+) diff --git a/plugins/git/README.md b/plugins/git/README.md index 93c9cc915..e00f4cf92 100644 --- a/plugins/git/README.md +++ b/plugins/git/README.md @@ -53,6 +53,7 @@ plugins=(... git) | gcd | git checkout develop | | gcmsg | git commit -m | | gco | git checkout | +| gcor | git checkout --recurse-submodules | | gcount | git shortlog -sn | | gcp | git cherry-pick | | gcpa | git cherry-pick --abort | diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index a364b6162..6664551eb 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -91,6 +91,7 @@ alias gcm='git checkout $(git_main_branch)' alias gcd='git checkout develop' alias gcmsg='git commit -m' alias gco='git checkout' +alias gcor='git checkout --recurse-submodules' alias gcount='git shortlog -sn' alias gcp='git cherry-pick' alias gcpa='git cherry-pick --abort' From 36cc94f3dcd8d6214b5a4bedf180bc723eb49a3f Mon Sep 17 00:00:00 2001 From: Ajeet D'Souza <98ajeet@gmail.com> Date: Sun, 13 Jun 2021 23:00:58 +0530 Subject: [PATCH 032/896] feat(zoxide): add new plugin for zoxide (a smarter cd CLI tool) (#9950) --- .github/CODEOWNERS | 1 + plugins/zoxide/README.md | 14 ++++++++++++++ plugins/zoxide/zoxide.plugin.zsh | 5 +++++ 3 files changed, 20 insertions(+) create mode 100644 plugins/zoxide/README.md create mode 100644 plugins/zoxide/zoxide.plugin.zsh diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 1b1340554..6c3eac6e7 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -7,3 +7,4 @@ plugins/gitfast/ @felipec plugins/sdk/ @rgoldberg plugins/universalarchive/ @Konfekt plugins/wp-cli/ @joshmedeski +plugins/zoxide/ @ajeetdsouza diff --git a/plugins/zoxide/README.md b/plugins/zoxide/README.md new file mode 100644 index 000000000..f326effe6 --- /dev/null +++ b/plugins/zoxide/README.md @@ -0,0 +1,14 @@ +# zoxide plugin + +Initializes [zoxide](https://github.com/ajeetdsouza/zoxide), a smarter cd +command for your terminal. + +![Tutorial](https://raw.githubusercontent.com/ajeetdsouza/zoxide/97dc08347d9dbf5b5a4516b79e0ac27366b962ce/contrib/tutorial.webp) + +To use it, add `zoxide` to the plugins array in your `.zshrc` file: + +```zsh +plugins=(... zoxide) +``` + +**Note:** you have to [install zoxide](https://github.com/ajeetdsouza/zoxide#step-1-install-zoxide) first. diff --git a/plugins/zoxide/zoxide.plugin.zsh b/plugins/zoxide/zoxide.plugin.zsh new file mode 100644 index 000000000..e5658b8f0 --- /dev/null +++ b/plugins/zoxide/zoxide.plugin.zsh @@ -0,0 +1,5 @@ +if (( $+commands[zoxide] )); then + eval "$(zoxide init zsh)" +else + echo '[oh-my-zsh] zoxide not found, please install it from https://github.com/ajeetdsouza/zoxide' +fi From 70a0577712bc8f78e14173c8032df3701ea2887f Mon Sep 17 00:00:00 2001 From: "Guo, Quan" <1118270+guoquan@users.noreply.github.com> Date: Mon, 14 Jun 2021 01:32:47 +0800 Subject: [PATCH 033/896] feat(nvm): introduce customizable list of command that triggers lazy loading (#9946) * Add customizable list of command that triggers lazy loading * Add $NVM_LAZY_CMD * Add instruction to `NVM_LAZY_CMD` in README.md --- plugins/nvm/README.md | 6 +++++- plugins/nvm/nvm.plugin.zsh | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/plugins/nvm/README.md b/plugins/nvm/README.md index 700613085..0c2bbf9f0 100644 --- a/plugins/nvm/README.md +++ b/plugins/nvm/README.md @@ -21,7 +21,11 @@ These settings should go in your zshrc file, before Oh My Zsh is sourced: - **`NVM_LAZY`**: if you want the plugin to defer the load of nvm to speed-up the start of your zsh session, set `NVM_LAZY` to `1`. This will use the `--no-use` parameter when loading nvm, and will create a function - for `node`, `npm` and `yarn`, so when you call either of these three, nvm will load with `nvm use default`. + for `node`, `npm`, `yarn`, and the command(s) specified by `NVM_LAZY_CMD`, so when you call either of them, + nvm will load with `nvm use default`. + +- **`NVM_LAZY_CMD`**: if you want additional command(s) to trigger lazy loading of nvm, set `NVM_LAZY_CMD` to + the command or an array of the commands. - **`NVM_AUTOLOAD`**: if `NVM_AUTOLOAD` is set to `1`, the plugin will automatically load a node version when if finds a [`.nvmrc` file](https://github.com/nvm-sh/nvm#nvmrc) in the current working directory indicating diff --git a/plugins/nvm/nvm.plugin.zsh b/plugins/nvm/nvm.plugin.zsh index 1e9b26e7a..3ef8cc1d8 100644 --- a/plugins/nvm/nvm.plugin.zsh +++ b/plugins/nvm/nvm.plugin.zsh @@ -28,8 +28,8 @@ fi # Call nvm when first using node, npm or yarn if (( $+NVM_LAZY )); then - function node npm yarn { - unfunction node npm yarn + function node npm yarn $NVM_LAZY_CMD { + unfunction node npm yarn $NVM_LAZY_CMD nvm use default command "$0" "$@" } From 027189b294d14a7d313cdbf611982843f921555d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Duszyk?= Date: Sun, 13 Jun 2021 19:40:07 +0200 Subject: [PATCH 034/896] perf(mercurial): speed up mercurial plugin (#4591) * speed up mercurial plugin * removed unnecesay limit to current dir from hg status --- plugins/mercurial/mercurial.plugin.zsh | 27 +++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/plugins/mercurial/mercurial.plugin.zsh b/plugins/mercurial/mercurial.plugin.zsh index a50dcb523..f4efc2b4a 100644 --- a/plugins/mercurial/mercurial.plugin.zsh +++ b/plugins/mercurial/mercurial.plugin.zsh @@ -19,37 +19,38 @@ alias hglr='hg pull --rebase' alias hgo='hg outgoing' function in_hg() { - if [[ -d .hg ]] || $(hg summary > /dev/null 2>&1); then + if $(hg branch > /dev/null 2>&1); then echo 1 fi } function hg_get_branch_name() { - if [ $(in_hg) ]; then - echo $(hg branch) + branch=`hg branch 2>/dev/null` + if [ $? -eq 0 ]; then + echo $branch fi + unset branch } function hg_prompt_info { - if [ $(in_hg) ]; then - _DISPLAY=$(hg_get_branch_name) + _DISPLAY=`hg branch 2>/dev/null` + if [ $? -eq 0 ]; then echo "$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_HG_PROMPT_PREFIX\ $ZSH_THEME_REPO_NAME_COLOR$_DISPLAY$ZSH_PROMPT_BASE_COLOR$ZSH_PROMPT_BASE_COLOR$(hg_dirty)$ZSH_THEME_HG_PROMPT_SUFFIX$ZSH_PROMPT_BASE_COLOR" - unset _DISPLAY fi + unset _DISPLAY } function hg_dirty_choose { - if [ $(in_hg) ]; then - hg status 2> /dev/null | command grep -Eq '^\s*[ACDIM!?L]' + hg status -mar 2> /dev/null | command grep -Eq '^\s*[ACDIM!?L]' + if [ $? -eq 0 ]; then if [ $pipestatus[-1] -eq 0 ]; then # Grep exits with 0 when "One or more lines were selected", return "dirty". echo $1 - else - # Otherwise, no lines were found, or an error occurred. Return clean. - echo $2 + return fi fi + echo $2 } function hg_dirty { @@ -57,11 +58,11 @@ function hg_dirty { } function hgic() { - hg incoming "$@" | grep "changeset" | wc -l + hg incoming "$@" | grep "changeset" | wc -l } function hgoc() { - hg outgoing "$@" | grep "changeset" | wc -l + hg outgoing "$@" | grep "changeset" | wc -l } function hg_get_bookmark_name() { From 241c7dde2b6afc4025fc74774f51a71fb3b128d3 Mon Sep 17 00:00:00 2001 From: Shubham Chaudhary Date: Sun, 13 Jun 2021 13:50:36 -0400 Subject: [PATCH 035/896] feat(supervisor): Add aliases for supervisor (#5819) --- plugins/supervisor/supervisor.plugin.zsh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/plugins/supervisor/supervisor.plugin.zsh b/plugins/supervisor/supervisor.plugin.zsh index cf1997c5b..f11f0ed3f 100644 --- a/plugins/supervisor/supervisor.plugin.zsh +++ b/plugins/supervisor/supervisor.plugin.zsh @@ -1 +1,14 @@ # DECLARION: This plugin was created by hhatto. What I did is just making a portal from https://bitbucket.org/hhatto/zshcompfunc4supervisor. + +alias sup='sudo supervisorctl' +alias supad='sudo supervisorctl add' +alias supa='sudo supervisorctl avail' +alias suprl='sudo supervisorctl reload' +alias suprm='sudo supervisorctl remove' +alias suprr='sudo supervisorctl reread' +alias suprs='sudo supervisorctl restart' +alias sups='sudo supervisorctl status' +alias supsr='sudo supervisorctl start' +alias supso='sudo supervisorctl stop' +alias supt='sudo supervisorctl tail' +alias supu='sudo supervisorctl update' From bd5d0066b908af0db1c4e8b1fb18888d8965d3a0 Mon Sep 17 00:00:00 2001 From: Myoungdo Park Date: Mon, 14 Jun 2021 02:58:44 +0900 Subject: [PATCH 036/896] feat(pm2): Adding a pm2 plugin (#7684) * Add pm2 plugin * Add description of pm2 plugin --- plugins/pm2/README.md | 19 +++++ plugins/pm2/_pm2 | 168 +++++++++++++++++++++++++++++++++++++ plugins/pm2/pm2.plugin.zsh | 6 ++ 3 files changed, 193 insertions(+) create mode 100644 plugins/pm2/README.md create mode 100644 plugins/pm2/_pm2 create mode 100644 plugins/pm2/pm2.plugin.zsh diff --git a/plugins/pm2/README.md b/plugins/pm2/README.md new file mode 100644 index 000000000..5dfd540b6 --- /dev/null +++ b/plugins/pm2/README.md @@ -0,0 +1,19 @@ +# pm2 plugin + +The plugin adds several aliases and completions for common [pm2](http://pm2.keymetrics.io/) commands. + +To use it, add `pm2` to the plugins array of your zshrc file: +``` +plugins=(... pm2) +``` + +## Aliases + +| Alias | Command | +|--------|----------------------| +| p2s | `pm2 start` | +| p2o | `pm2 stop` | +| p2d | `pm2 delete` | +| p2r | `pm2 restart` | +| p2i | `pm2 list` | +| p2l | `pm2 logs` | diff --git a/plugins/pm2/_pm2 b/plugins/pm2/_pm2 new file mode 100644 index 000000000..6f1e89df5 --- /dev/null +++ b/plugins/pm2/_pm2 @@ -0,0 +1,168 @@ +#!/bin/zsh -f +#compdef pm2 +#autoload + +local -a _1st_arguments + +_1st_arguments=( + "start:start and daemonize an app" + "trigger:trigger process action" + "deploy:deploy your json" + "startOrRestart:start or restart JSON file" + "startOrReload:start or gracefully reload JSON file" + "pid:return pid of [app_name] or all" + "stop:stop a process" + "restart:restart a process" + "scale:scale up/down a process in cluster mode depending on total_number param" + "profile\:mem:Sample PM2 heap memory" + "profile\:cpu:Profile PM2 cpu" + "reload:reload processes (note that its for app using HTTP/HTTPS)" + "id:get process id by name" + "inspect:inspect a process" + "delete:stop and delete a process from pm2 process list" + "sendSignal:send a system signal to the target process" + "ping:ping pm2 daemon - if not up it will launch it" + "updatePM2:update in-memory PM2 with local PM2" + "install:install or update a module and run it forever" + "module\:update:update a module and run it forever" + "module\:generate:Generate a sample module in current folder" + "uninstall:stop and uninstall a module" + "package:Check & Package TAR type module" + "publish:Publish the module you are currently on" + "set:sets the specified config " + "multiset:multiset eg \"key1 val1 key2 val2\"" + "get:get value for " + "config:get / set module config values" + "unset:clears the specified config " + "report:give a full pm2 report for https\://github.com/Unitech/pm2/issues" + "link:link with the pm2 monitoring dashboard" + "unlink:unlink with the pm2 monitoring dashboard" + "monitor:monitor target process" + "unmonitor:unmonitor target process" + "open:open the pm2 monitoring dashboard" + "plus:enable pm2 plus" + "login:Login to pm2 plus" + "logout:Logout from pm2 plus" + "web:launch a health API on 0.0.0.0\:9615" + "dump:dump all processes for resurrecting them later" + "cleardump:Create empty dump file" + "send:send stdin to " + "attach:attach stdin/stdout to application identified by " + "resurrect:resurrect previously dumped processes" + "unstartup:disable the pm2 startup hook" + "startup:enable the pm2 startup hook" + "logrotate:copy default logrotate configuration" + "ecosystem:generate a process conf file. (mode = null or simple)" + "reset:reset counters for process" + "describe:describe all parameters of a process id" + "list:list all processes" + "jlist:list all processes in JSON format" + "prettylist:print json in a prettified JSON" + "monit:launch termcaps monitoring" + "imonit:launch legacy termcaps monitoring" + "dashboard:launch dashboard with monitoring and logs" + "flush:flush logs" + "reloadLogs:reload all logs" + "logs:stream logs file. Default stream all logs" + "kill:kill daemon" + "pull:updates repository for a given app" + "forward:updates repository to the next commit for a given app" + "backward:downgrades repository to the previous commit for a given app" + "deepUpdate:performs a deep update of PM2" + "serve:serve a directory over http via port" + "examples:display pm2 usage examples" +) + +local -a id_names + +_id_names() { + local app_list + app_list=`pm2 list -m` + + local -a names ids + names=(`echo $app_list | grep '+---' | awk '{print $2}'`) + ids=(`echo $app_list | grep 'pm2 id' | awk '{print $4}'`) + + if (( ${#ids} > 0 )); then + for i in {1..${#ids}}; do + id_names+=( "${ids[i]}:${names[i]}" ) + done + fi +} + +_arguments \ + '(-v --version)'{-v,--version}'[output version]' \ + '(-h --help)'{-h,--help}'[output usage information]' \ + '*:: :->subcmds' && return 0 + +if (( CURRENT == 1 )); then + _describe "command" _1st_arguments + return +fi + +local -a id_comp id_all_comp id_all_files_comp start_options logs_options +id_comp=('1: :->id_comp') +id_all_comp=('1: :->id_all_comp') +id_all_files_comp=('1: :->id_all_files_comp') +start_options=( + '--watch[Watch folder for changes]' + '--fresh[Rebuild Dockerfile]' + '--daemon[Run container in Daemon mode (debug purposes)]' + '--container[Start application in container mode]' + '--dist[with --container; change local Dockerfile to containerize all files in current directory]' + '--image-name[with --dist; set the exported image name]' + '--node-version[with --container, set a specific major Node.js version]' + '--dockerdaemon[for debugging purpose]' + '(-h --help)'{-h,--help}'[output usage information]' + $id_all_files_comp +) +logs_options=( + '--json[json log output]' + '--format[formated log output]' + '--raw[raw output]' + '--err[only shows error output]' + '--out[only shows standard output]' + '--lines[output the last N lines, instead of the last 15 by default]' + '--timestamp[add timestamps (default format YYYY-MM-DD-HH:mm:ss)]' + '--nostream[print logs without lauching the log stream]' + '(-h --help)'{-h,--help}'[output usage information]' + $id_all_comp +) + +case "$words[1]" in + start) + _arguments $start_options && return 0 + ;; + logs) + _arguments $logs_options && return 0 + ;; + stop|restart|delete|reload|reset) + _arguments $id_all_comp && return 0 + ;; + env|inspect|monitor|unmonitor|discribe) + _arguments $id_comp && return 0 + ;; + deploy|startOrRestart|startOrReload) + _files ;; +esac + +case "$state" in + id_comp) + _id_names + _alternative \ + 'args:app args:(($id_names))' + ;; + id_all_comp) + _id_names + id_names+=(all) + _alternative \ + 'args:app args:(($id_names))' + ;; + id_all_files_comp) + _id_names + id_names+=(all) + _alternative \ + 'args:app args:(($id_names))' \ + 'files:filename:_files' + ;; +esac diff --git a/plugins/pm2/pm2.plugin.zsh b/plugins/pm2/pm2.plugin.zsh new file mode 100644 index 000000000..f05d8db8b --- /dev/null +++ b/plugins/pm2/pm2.plugin.zsh @@ -0,0 +1,6 @@ +alias p2s='pm2 start' +alias p2o='pm2 stop' +alias p2d='pm2 delete' +alias p2r='pm2 restart' +alias p2i='pm2 list' +alias p2l='pm2 logs' From 08751210e3204c4ba330bce1ff52b1906b92f850 Mon Sep 17 00:00:00 2001 From: Nick Revin Date: Sun, 13 Jun 2021 21:59:31 +0400 Subject: [PATCH 037/896] feat(git): Add aliases for 'git commit -S -s [-m]' (#7616) I thought it would be useful to add these aliases. There are already aliases for `git commit -S` and `git commit -s` but there is none for both simultaneously =) --- plugins/git/git.plugin.zsh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 6664551eb..2a7c7290d 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -97,6 +97,8 @@ alias gcp='git cherry-pick' alias gcpa='git cherry-pick --abort' alias gcpc='git cherry-pick --continue' alias gcs='git commit -S' +alias gcss='git commit -S -s' +alias gcssm='git commit -S -s -m' alias gd='git diff' alias gdca='git diff --cached' From 77087aaa8d9ff92ef84ae727411f0eca100ed5de Mon Sep 17 00:00:00 2001 From: Fabio Vitale Date: Sun, 13 Jun 2021 20:05:09 +0200 Subject: [PATCH 038/896] refactor(git-glow): Add config interpolation for git-flow messages (#7481) Changed commands: gcd: uses gitflow.branch.develop to get user-set development branch gch: uses gitflow.prefix.hotfix to get user-set hotfix prefix gcr: uses gitflow.prefix.release to get user-set release prefix Co-authored-by: Fabio 'c0m3tx' Vitale --- plugins/git-flow/git-flow.plugin.zsh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/git-flow/git-flow.plugin.zsh b/plugins/git-flow/git-flow.plugin.zsh index 916cd5693..8f0714b16 100644 --- a/plugins/git-flow/git-flow.plugin.zsh +++ b/plugins/git-flow/git-flow.plugin.zsh @@ -23,9 +23,9 @@ #Alias alias gfl='git flow' alias gfli='git flow init' -alias gcd='git checkout develop' -alias gch='git checkout hotfix' -alias gcr='git checkout release' +alias gcd='git checkout $(git config gitflow.branch.develop)' +alias gch='git checkout $(git config gitflow.prefix.hotfix)' +alias gcr='git checkout $(git config gitflow.prefix.release)' alias gflf='git flow feature' alias gflh='git flow hotfix' alias gflr='git flow release' From 3e7998aec33ff7551d06d4510f9e8769aab5db93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Mon, 14 Jun 2021 10:57:50 +0200 Subject: [PATCH 039/896] Revert "ssh-agent: improvements (#6309)" This reverts commit a206271460ce49e842b1b410c0424b8c9a0a3d14. --- plugins/ssh-agent/README.md | 12 ++--------- plugins/ssh-agent/ssh-agent.plugin.zsh | 29 +++++++------------------- 2 files changed, 10 insertions(+), 31 deletions(-) diff --git a/plugins/ssh-agent/README.md b/plugins/ssh-agent/README.md index aa96f9cc9..8765a9c7e 100644 --- a/plugins/ssh-agent/README.md +++ b/plugins/ssh-agent/README.md @@ -19,17 +19,9 @@ To enable **agent forwarding support** add the following to your zshrc file: zstyle :omz:plugins:ssh-agent agent-forwarding on ``` -To **NOT load any identities on start** use the `lazy` style. -This is particularly usefull when combined with the AddKeysToAgent -(available from OpenSSH 7.2), since it allows to enter the password only -on first use. +---- -```zsh -zstyle :omz:plugins:ssh-agent lazy yes -``` - -To **load multiple identities** use the `identities` style. This have no -effect if `lazy` is enabled. +To **load multiple identities** use the `identities` style, For example: ```zsh zstyle :omz:plugins:ssh-agent identities id_rsa id_rsa2 id_github diff --git a/plugins/ssh-agent/ssh-agent.plugin.zsh b/plugins/ssh-agent/ssh-agent.plugin.zsh index 494cf1393..d45406f63 100644 --- a/plugins/ssh-agent/ssh-agent.plugin.zsh +++ b/plugins/ssh-agent/ssh-agent.plugin.zsh @@ -1,16 +1,4 @@ -lockdir=/tmp/oh-my-zsh-ssh-agent.lock - -while true; do - if mkdir "$lockdir" 2>/dev/null - then # directory did not exist, but was created successfully - trap 'rm -rf "$lockdir"' 0 # remove directory when script finishes - break # continue with script - else - sleep 0.1 # sleep for 0.2 and try again - fi -done - -typeset _ssh_env_cache +typeset _agent_forwarding _ssh_env_cache function _start_agent() { local lifetime @@ -68,7 +56,10 @@ function _add_identities() { # Get the filename to store/lookup the environment from _ssh_env_cache="$HOME/.ssh/environment-$SHORT_HOST" -if zstyle -t :omz:plugins:ssh-agent agent-forwarding && [[ -n "$SSH_AUTH_SOCK" ]]; then +# test if agent-forwarding is enabled +zstyle -b :omz:plugins:ssh-agent agent-forwarding _agent_forwarding + +if [[ $_agent_forwarding == "yes" && -n "$SSH_AUTH_SOCK" ]]; then # Add a nifty symlink for screen/tmux if agent forwarding [[ -L $SSH_AUTH_SOCK ]] || ln -sf "$SSH_AUTH_SOCK" /tmp/ssh-agent-$USERNAME-screen elif [[ -f "$_ssh_env_cache" ]]; then @@ -82,16 +73,12 @@ elif [[ -f "$_ssh_env_cache" ]]; then ps $FILTER | grep ssh-agent | grep -q $SSH_AGENT_PID || { _start_agent } -elif [[ -d $HOME/.ssh ]]; then +else _start_agent fi -if ! zstyle -t :omz:plugins:ssh-agent lazy; then - _add_identities -fi +_add_identities # tidy up after ourselves -unset _ssh_env_cache +unset _agent_forwarding _ssh_env_cache unfunction _start_agent _add_identities - -rm -rf "$lockdir" From e32d4b1e195f4c7777844beea97af42bd93434eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Thu, 17 Jun 2021 18:54:52 +0200 Subject: [PATCH 040/896] fix(lib): remove `kubectx` stub prompt function from lib Fixes #9974 --- lib/prompt_info_functions.zsh | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/prompt_info_functions.zsh b/lib/prompt_info_functions.zsh index e29fb27a5..48f033da6 100644 --- a/lib/prompt_info_functions.zsh +++ b/lib/prompt_info_functions.zsh @@ -19,7 +19,6 @@ function chruby_prompt_info \ virtualenv_prompt_info \ jenv_prompt_info \ tf_prompt_info \ - kubectx_prompt_info \ { return 1 } From 0e7d7b87f33b5ec8c75a3a0a9b16fae082d06348 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 7 Jul 2021 10:40:05 +0200 Subject: [PATCH 041/896] feat(changelog): ignore merge commits --- tools/changelog.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/changelog.sh b/tools/changelog.sh index 836afef14..56ea42cb1 100755 --- a/tools/changelog.sh +++ b/tools/changelog.sh @@ -114,6 +114,11 @@ function parse-commit { fi } + # Ignore commit if it is a merge commit + if [[ $(command git show -s --format=%p $1 | wc -w) -gt 1 ]]; then + return + fi + # Parse commit with hash $1 local hash="$1" subject body warning rhash subject="$(command git show -s --format=%s $hash)" From c44b99e901d7ef58f60247995152de1b937e2e9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Mon, 28 Jun 2021 15:54:24 +0200 Subject: [PATCH 042/896] fix(dotenv): draw confirmation prompt in next empty line Without this fix the confirmation prompt appears wherever the cursor is, which means that it might appear in the command line when using a widget that changes the directory without redrawing the prompt (an example of this are the dircycle and dirhistory plugins). --- plugins/dotenv/dotenv.plugin.zsh | 66 ++++++++++++++++++-------------- 1 file changed, 38 insertions(+), 28 deletions(-) diff --git a/plugins/dotenv/dotenv.plugin.zsh b/plugins/dotenv/dotenv.plugin.zsh index 24f285df5..40ec5c46f 100644 --- a/plugins/dotenv/dotenv.plugin.zsh +++ b/plugins/dotenv/dotenv.plugin.zsh @@ -11,41 +11,51 @@ ## Functions source_env() { - if [[ -f $ZSH_DOTENV_FILE ]]; then - if [[ "$ZSH_DOTENV_PROMPT" != false ]]; then - local confirmation dirpath="${PWD:A}" + if [[ ! -f "$ZSH_DOTENV_FILE" ]]; then + return + fi - # make sure there is an (dis-)allowed file - touch "$ZSH_DOTENV_ALLOWED_LIST" - touch "$ZSH_DOTENV_DISALLOWED_LIST" + if [[ "$ZSH_DOTENV_PROMPT" != false ]]; then + local confirmation dirpath="${PWD:A}" - # early return if disallowed - if grep -q "$dirpath" "$ZSH_DOTENV_DISALLOWED_LIST" &>/dev/null; then - return; - fi + # make sure there is an (dis-)allowed file + touch "$ZSH_DOTENV_ALLOWED_LIST" + touch "$ZSH_DOTENV_DISALLOWED_LIST" - # check if current directory's .env file is allowed or ask for confirmation - if ! grep -q "$dirpath" "$ZSH_DOTENV_ALLOWED_LIST" &>/dev/null; then - # print same-line prompt and output newline character if necessary - echo -n "dotenv: found '$ZSH_DOTENV_FILE' file. Source it? ([Y]es/[n]o/[a]lways/n[e]ver) " - read -k 1 confirmation; [[ "$confirmation" != $'\n' ]] && echo - - # check input - case "$confirmation" in - [nN]) return ;; - [aA]) echo "$dirpath" >> "$ZSH_DOTENV_ALLOWED_LIST" ;; - [eE]) echo "$dirpath" >> "$ZSH_DOTENV_DISALLOWED_LIST"; return ;; - *) ;; # interpret anything else as a yes - esac - fi + # early return if disallowed + if command grep -q "$dirpath" "$ZSH_DOTENV_DISALLOWED_LIST" &>/dev/null; then + return fi - # test .env syntax - zsh -fn $ZSH_DOTENV_FILE || echo "dotenv: error when sourcing '$ZSH_DOTENV_FILE' file" >&2 + # check if current directory's .env file is allowed or ask for confirmation + if ! command grep -q "$dirpath" "$ZSH_DOTENV_ALLOWED_LIST" &>/dev/null; then + # get cursor column and print new line before prompt if not at line beginning + local column + echo -ne "\e[6n" > /dev/tty + read -t 1 -s -d R column < /dev/tty + column="${column##*\[*;}" + [[ $column -eq 1 ]] || echo - setopt localoptions allexport - source $ZSH_DOTENV_FILE + # print same-line prompt and output newline character if necessary + echo -n "dotenv: found '$ZSH_DOTENV_FILE' file. Source it? ([Y]es/[n]o/[a]lways/n[e]ver) " + read -k 1 confirmation + [[ "$confirmation" = $'\n' ]] || echo + + # check input + case "$confirmation" in + [nN]) return ;; + [aA]) echo "$dirpath" >> "$ZSH_DOTENV_ALLOWED_LIST" ;; + [eE]) echo "$dirpath" >> "$ZSH_DOTENV_DISALLOWED_LIST"; return ;; + *) ;; # interpret anything else as a yes + esac + fi fi + + # test .env syntax + zsh -fn $ZSH_DOTENV_FILE || echo "dotenv: error when sourcing '$ZSH_DOTENV_FILE' file" >&2 + + setopt localoptions allexport + source $ZSH_DOTENV_FILE } autoload -U add-zsh-hook From 36f444ed7325720ec05f182781ec7d6c9a4d675c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Thu, 8 Jul 2021 16:11:16 +0200 Subject: [PATCH 043/896] fix(update): fix error exit code on update check (#10033) This patch removes the 'exit 1' status code when the update check finishes or is ended with CTRL+C. Fixes #10033 --- tools/check_for_upgrade.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh index 29a48b880..e87da3487 100644 --- a/tools/check_for_upgrade.sh +++ b/tools/check_for_upgrade.sh @@ -48,14 +48,17 @@ function update_ohmyzsh() { return fi - # Remove lock directory on exit. `return 1` is important for when trapping a SIGINT: + # Remove lock directory on exit. `return $ret` is important for when trapping a SIGINT: # The return status from the function is handled specially. If it is zero, the signal is # assumed to have been handled, and execution continues normally. Otherwise, the shell # will behave as interrupted except that the return status of the trap is retained. + # This means that for a CTRL+C, the trap needs to return the same exit status so that + # the shell actually exits what it's running. trap " - unset -f current_epoch update_last_updated_file update_ohmyzsh - command rm -rf '$ZSH/log/update.lock' - return 1 + ret=\$? + unset -f current_epoch update_last_updated_file update_ohmyzsh 2>/dev/null + command rm -rf '$ZSH/log/update.lock' + return \$ret " EXIT INT QUIT # Create or update .zsh-update file if missing or malformed From 5b4e3ee7f1c48505a3ec56ce38e444b88feda7a4 Mon Sep 17 00:00:00 2001 From: Robert Lankford Date: Mon, 12 Jul 2021 10:16:26 -0500 Subject: [PATCH 044/896] feat(gnu-utils): include ggrep in gcmds (#10044) Co-authored-by: Robert Lankford --- plugins/gnu-utils/gnu-utils.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/gnu-utils/gnu-utils.plugin.zsh b/plugins/gnu-utils/gnu-utils.plugin.zsh index 23e00c295..539e7fe4d 100644 --- a/plugins/gnu-utils/gnu-utils.plugin.zsh +++ b/plugins/gnu-utils/gnu-utils.plugin.zsh @@ -36,7 +36,7 @@ __gnu_utils() { gcmds+=('gfind' 'gxargs' 'glocate') # Not part of either coreutils or findutils, installed separately. - gcmds+=('gsed' 'gtar' 'gtime' 'gmake') + gcmds+=('gsed' 'gtar' 'gtime' 'gmake' 'ggrep') for gcmd in "${gcmds[@]}"; do # Do nothing if the command isn't found From e4f6f1698d4bf2cebe3fd0e2f5bae9f163780a50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Mon, 12 Jul 2021 17:34:34 +0200 Subject: [PATCH 045/896] fix(copybuffer): show error below the command line --- plugins/copybuffer/copybuffer.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/copybuffer/copybuffer.plugin.zsh b/plugins/copybuffer/copybuffer.plugin.zsh index 483ed5a5f..87a658d93 100644 --- a/plugins/copybuffer/copybuffer.plugin.zsh +++ b/plugins/copybuffer/copybuffer.plugin.zsh @@ -5,7 +5,7 @@ copybuffer () { if which clipcopy &>/dev/null; then printf "%s" "$BUFFER" | clipcopy else - echo "clipcopy function not found. Please make sure you have Oh My Zsh installed correctly." + zle -M "clipcopy not found. Please make sure you have Oh My Zsh installed correctly." fi } From 23f9348e2c2341df71b1891eb4607f60ddd5a204 Mon Sep 17 00:00:00 2001 From: Sergei Shvetsov Date: Tue, 13 Jul 2021 15:05:33 +0700 Subject: [PATCH 046/896] fix(aws): allow for profile switch w/o MFA configured (#9924) --- plugins/aws/aws.plugin.zsh | 70 +++++++++++++++++++------------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/plugins/aws/aws.plugin.zsh b/plugins/aws/aws.plugin.zsh index e1566b113..2d095635b 100644 --- a/plugins/aws/aws.plugin.zsh +++ b/plugins/aws/aws.plugin.zsh @@ -62,47 +62,47 @@ function acp() { read -r sess_duration fi mfa_opt=(--serial-number "$mfa_serial" --token-code "$mfa_token" --duration-seconds "${sess_duration:-3600}") + fi - # Now see whether we need to just MFA for the current role, or assume a different one - local role_arn="$(aws configure get role_arn --profile $profile)" - local sess_name="$(aws configure get role_session_name --profile $profile)" + # Now see whether we need to just MFA for the current role, or assume a different one + local role_arn="$(aws configure get role_arn --profile $profile)" + local sess_name="$(aws configure get role_session_name --profile $profile)" - if [[ -n "$role_arn" ]]; then - # Means we need to assume a specified role - aws_command=(aws sts assume-role --role-arn "$role_arn" "${mfa_opt[@]}") + if [[ -n "$role_arn" ]]; then + # Means we need to assume a specified role + aws_command=(aws sts assume-role --role-arn "$role_arn" "${mfa_opt[@]}") - # Check whether external_id is configured to use while assuming the role - local external_id="$(aws configure get external_id --profile $profile)" - if [[ -n "$external_id" ]]; then - aws_command+=(--external-id "$external_id") - fi - - # Get source profile to use to assume role - local source_profile="$(aws configure get source_profile --profile $profile)" - if [[ -z "$sess_name" ]]; then - sess_name="${source_profile:-profile}" - fi - aws_command+=(--profile="${source_profile:-profile}" --role-session-name "${sess_name}") - - echo "Assuming role $role_arn using profile ${source_profile:-profile}" - else - # Means we only need to do MFA - aws_command=(aws sts get-session-token --profile="$profile" "${mfa_opt[@]}") - echo "Obtaining session token for profile $profile" + # Check whether external_id is configured to use while assuming the role + local external_id="$(aws configure get external_id --profile $profile)" + if [[ -n "$external_id" ]]; then + aws_command+=(--external-id "$external_id") fi - # Format output of aws command for easier processing - aws_command+=(--query '[Credentials.AccessKeyId,Credentials.SecretAccessKey,Credentials.SessionToken]' --output text) - - # Run the aws command to obtain credentials - local -a credentials - credentials=(${(ps:\t:)"$(${aws_command[@]})"}) - - if [[ -n "$credentials" ]]; then - aws_access_key_id="${credentials[1]}" - aws_secret_access_key="${credentials[2]}" - aws_session_token="${credentials[3]}" + # Get source profile to use to assume role + local source_profile="$(aws configure get source_profile --profile $profile)" + if [[ -z "$sess_name" ]]; then + sess_name="${source_profile:-profile}" fi + aws_command+=(--profile="${source_profile:-profile}" --role-session-name "${sess_name}") + + echo "Assuming role $role_arn using profile ${source_profile:-profile}" + else + # Means we only need to do MFA + aws_command=(aws sts get-session-token --profile="$profile" "${mfa_opt[@]}") + echo "Obtaining session token for profile $profile" + fi + + # Format output of aws command for easier processing + aws_command+=(--query '[Credentials.AccessKeyId,Credentials.SecretAccessKey,Credentials.SessionToken]' --output text) + + # Run the aws command to obtain credentials + local -a credentials + credentials=(${(ps:\t:)"$(${aws_command[@]})"}) + + if [[ -n "$credentials" ]]; then + aws_access_key_id="${credentials[1]}" + aws_secret_access_key="${credentials[2]}" + aws_session_token="${credentials[3]}" fi # Switch to AWS profile From 4eadb9cf758b632b113bb793d5f1e38f4c304392 Mon Sep 17 00:00:00 2001 From: Mahdyar Hasanpour Date: Fri, 16 Jul 2021 14:11:00 +0430 Subject: [PATCH 047/896] chore: convert the repo issue templates to issue forms (#10050) --- .github/ISSUE_TEMPLATE/bug_report.md | 46 --------------- .github/ISSUE_TEMPLATE/bug_report.yml | 69 ++++++++++++++++++++++ .github/ISSUE_TEMPLATE/feature_request.md | 29 --------- .github/ISSUE_TEMPLATE/feature_request.yml | 32 ++++++++++ 4 files changed, 101 insertions(+), 75 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/bug_report.yml delete mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.yml diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index 88a6b814d..000000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,46 +0,0 @@ ---- -name: Bug report -about: Create a report to help us improve Oh My Zsh -labels: 'Bug' - ---- - - - -**Describe the bug** -A clear description of what the bug is. - -**To Reproduce** -Steps to reproduce the behavior, for example: -1. Enable this plugin '...' -2. Run command '...' or try the autocomplete command '...' -3. See error - -**Expected behavior** -A brief description of what should happen. - -**Screenshots and/or Recordings** -If applicable, add screenshots to help explain your problem. -You can also record an asciinema session: https://asciinema.org/ - -**Self Check** - -- Have you tried reaching out on the [Discord server](https://discord.gg/ohmyzsh)? - This can help cut down on filling up issues. We always have a few people - online that are in a variety of timezones that are willing to help you! - -- Also searching existing [GitHub Issues](https://github.com/ohmyzsh/ohmyzsh/issues?q=) might help you get quicker support - -**Desktop (please complete the following information):** - - - OS / Distro: [e.g. Arch Linux, macOS] - - If on Windows what version of WSL: [e.g. WSL1, WSL2] - - Latest ohmyzsh update?: [e.g. Yes/No] - - ZSH Version: [e.g. 5.6] - - Terminal emulator: [e.g. iTerm2] - -**Additional context** -Add any other context about the problem here. This can be themes, plugins, custom configs. diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 000000000..af2973fec --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,69 @@ +name: Bug report +description: Create a report to help us improve Oh My Zsh +labels: 'Bug' +body: + - type: markdown + attributes: + value: | + ## Self Check + - Try searching existing [GitHub Issues](https://github.com/ohmyzsh/ohmyzsh/issues?q=is%3Aissue) (open or closed) for similar issues. + - Try reaching out on the [Discord server](https://discord.gg/ohmyzsh) for help. + - type: textarea + validations: + required: true + attributes: + label: Describe the bug + description: A clear description of what the bug is. + - type: textarea + validations: + required: true + attributes: + label: Steps to reproduce + description: | + Steps to reproduce the problem. + placeholder: | + For example: + 1. Enable plugin '...' + 2. Run command '...' or try to complete command '...' + 3. See error + - type: textarea + validations: + required: true + attributes: + label: Expected behavior + description: A brief description of what should happen. + - type: textarea + attributes: + label: Screenshots and recordings + description: | + If applicable, add screenshots to help explain your problem. You can also record an asciinema session: https://asciinema.org/ + - type: input + validations: + required: true + attributes: + label: OS / Distro + placeholder: e.g. Windows 10, Ubuntu 20.04, Arch Linux, macOS 10.15... + - type: input + validations: + required: true + attributes: + label: Zsh version + description: Run `echo $ZSH_VERSION` to check. + placeholder: e.g. 5.6 + - type: input + validations: + required: true + attributes: + label: Terminal emulator + placeholder: e.g. iTerm2, Gnome Terminal... + - type: dropdown + attributes: + label: If using WSL on Windows, which version of WSL + description: Run `wsl -l -v` to check. + options: + - WSL1 + - WSL2 + - type: textarea + attributes: + label: Additional context + description: Add any other context about the problem here. This can be themes, plugins, custom settings... diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index 788f77368..000000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,29 +0,0 @@ ---- -name: Feature request -about: Suggest a feature for Oh My Zsh -labels: 'Feature' - ---- - - - -**Is your feature request related to a particular plugin or theme? If so, specify it.** -The name of the plugin, theme or alias that you would like us to improve. [...] - -**Is your feature request related to a problem? Please describe.** -A description of what the problem is. Ex. I'm always frustrated when [...] - -**Describe the solution you'd like** -A description of what you want to happen. [...] - -**Describe alternatives you've considered** -A description of any alternative solutions or features you've considered. This can also include other plugins or themes. - -**Additional context** -Add any other context, screenshots or discord conversations about the feature request here. Also if you have any PRs related to this issue that are already open that you would like us to look at. - -**Related Issues** -Is there any open or closed issues that is related to this feature request? If so please link them below! [...] diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 000000000..dc4baf2b1 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,32 @@ +name: Feature request +description: Suggest a feature for Oh My Zsh +labels: 'Feature' +body: + - type: input + attributes: + label: If the feature request is for a plugin or theme, specify it here. + description: The name of the plugin or theme that you would like us to improve. + placeholder: e.g. Git plugin, Agnoster theme + - type: textarea + attributes: + label: If the feature solves a problem you have, specify it here. + description: A description of what the problem is. + placeholder: Ex. I'm always frustrated when... + - type: textarea + attributes: + label: Describe the proposed feature. + description: A description of what you want to happen. Be as specific as possible. + validations: + required: true + - type: textarea + attributes: + label: Describe alternatives you've considered + description: A description of any alternative solutions or features you've considered. This can also include other plugins or themes. + - type: textarea + attributes: + label: Additional context + description: Add any other context, screenshots or Discord conversations about the feature request here. Also if you have any PRs related to this issue that are already open that you would like us to look at. + - type: textarea + attributes: + label: Related Issues + description: Is there any open or closed issues that is related to this feature request? If so please link them below! From dac3314c76e799cddbbe5cf63870d31861626059 Mon Sep 17 00:00:00 2001 From: "MalaGaM @ ARTiSPRETiS" Date: Fri, 16 Jul 2021 11:48:19 +0200 Subject: [PATCH 048/896] chore(github): add links to supported tools (#10057) --- plugins/github/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/github/README.md b/plugins/github/README.md index 70b863f64..af2b8a4e7 100644 --- a/plugins/github/README.md +++ b/plugins/github/README.md @@ -2,8 +2,8 @@ This plugin supports working with GitHub from the command line. It provides a few things: -* Sets up the `hub` wrapper and completions for the `git` command if you have `hub` installed. -* Completion for the `github` Ruby gem. +* Sets up the `hub` wrapper and completions for the `git` command if you have [`hub`](https://github.com/github/hub) installed. +* Completion for the [`github` Ruby gem](https://github.com/defunkt/github-gem). * Convenience functions for working with repos and URLs. ### Functions From d9ad99531f74df8b0d6622feeab5e253528b43d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=BDiga=20=C5=A0ebenik?= Date: Fri, 23 Jul 2021 12:39:51 +0200 Subject: [PATCH 049/896] feat(plugins): add fnm plugin (#9864) Co-authored-by: Ziga Sebenik --- plugins/fnm/.gitignore | 2 ++ plugins/fnm/README.md | 9 +++++++++ plugins/fnm/fnm.plugin.zsh | 12 ++++++++++++ 3 files changed, 23 insertions(+) create mode 100644 plugins/fnm/.gitignore create mode 100644 plugins/fnm/README.md create mode 100644 plugins/fnm/fnm.plugin.zsh diff --git a/plugins/fnm/.gitignore b/plugins/fnm/.gitignore new file mode 100644 index 000000000..0b2bc9ab7 --- /dev/null +++ b/plugins/fnm/.gitignore @@ -0,0 +1,2 @@ +_fnm + diff --git a/plugins/fnm/README.md b/plugins/fnm/README.md new file mode 100644 index 000000000..00fab5cd4 --- /dev/null +++ b/plugins/fnm/README.md @@ -0,0 +1,9 @@ +# fnm plugin + +This plugin adds autocompletion for [fnm](https://github.com/Schniz/fnm) - a Node.js version manager. + +To use it, add `fnm` to the plugins array in your zshrc file: + +```zsh +plugins=(... fnm) +``` diff --git a/plugins/fnm/fnm.plugin.zsh b/plugins/fnm/fnm.plugin.zsh new file mode 100644 index 000000000..5ce558dcb --- /dev/null +++ b/plugins/fnm/fnm.plugin.zsh @@ -0,0 +1,12 @@ +# COMPLETION FUNCTION +if (( $+commands[fnm] )); then + if [[ ! -f $ZSH_CACHE_DIR/fnm_version ]] \ + || [[ "$(fnm --version)" != "$(< "$ZSH_CACHE_DIR/fnm_version")" ]] \ + || [[ ! -f $ZSH/plugins/fnm/_fnm ]]; then + fnm completions --shell=zsh > $ZSH/plugins/fnm/_fnm + fnm --version > $ZSH_CACHE_DIR/fnm_version + fi + autoload -Uz _fnm + _comps[fnm]=_fnm +fi + From c8a258698de6a56145211657f05f8b554a8140b7 Mon Sep 17 00:00:00 2001 From: Neil Girdhar Date: Mon, 26 Jul 2021 05:45:02 -0400 Subject: [PATCH 050/896] fix(pyenv): fix pyenv PATH settings with a warning (#9935) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This change fixes the setting of $PATH for pyenv and its shims, while warning the user about non-interactive shells. Co-authored-by: Marc CornellĂ  --- plugins/pyenv/pyenv.plugin.zsh | 81 ++++++++++++++++++++++------------ 1 file changed, 52 insertions(+), 29 deletions(-) diff --git a/plugins/pyenv/pyenv.plugin.zsh b/plugins/pyenv/pyenv.plugin.zsh index 82ba6ff8c..fedde6342 100644 --- a/plugins/pyenv/pyenv.plugin.zsh +++ b/plugins/pyenv/pyenv.plugin.zsh @@ -3,44 +3,67 @@ # Load pyenv only if command not already available if command -v pyenv &> /dev/null && [[ "$(uname -r)" != *icrosoft* ]]; then - FOUND_PYENV=1 + FOUND_PYENV=1 else - FOUND_PYENV=0 + FOUND_PYENV=0 fi +# Look for pyenv and try to load it (will only work on interactive shells) if [[ $FOUND_PYENV -ne 1 ]]; then - pyenvdirs=("$HOME/.pyenv" "/usr/local/pyenv" "/opt/pyenv" "/usr/local/opt/pyenv") - for dir in $pyenvdirs; do - if [[ -d $dir/bin ]]; then - export PATH="$PATH:$dir/bin" - FOUND_PYENV=1 - break - fi - done -fi - -if [[ $FOUND_PYENV -ne 1 ]]; then - if (( $+commands[brew] )) && dir=$(brew --prefix pyenv 2>/dev/null); then - if [[ -d $dir/bin ]]; then - export PATH="$PATH:$dir/bin" - FOUND_PYENV=1 - fi + pyenvdirs=("$HOME/.pyenv" "/usr/local/pyenv" "/opt/pyenv" "/usr/local/opt/pyenv") + for dir in $pyenvdirs; do + if [[ -d "$dir/bin" ]]; then + FOUND_PYENV=1 + break fi + done + + if [[ $FOUND_PYENV -ne 1 ]]; then + if (( $+commands[brew] )) && dir=$(brew --prefix pyenv 2>/dev/null); then + if [[ -d "$dir/bin" ]]; then + FOUND_PYENV=1 + fi + fi + fi + + # If we found pyenv, load it but show a caveat about non-interactive shells + if [[ $FOUND_PYENV -eq 1 ]]; then + cat <&1 | cut -f 2 -d ' ')" - } + # Fall back to system python + function pyenv_prompt_info() { + echo "system: $(python -V 2>&1 | cut -f 2 -d ' ')" + } fi unset FOUND_PYENV pyenvdirs dir From 5377cc37c0f71fe22484303a4c6f387aa339f3f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Mon, 26 Jul 2021 11:46:15 +0200 Subject: [PATCH 051/896] fix(pyenv): fix for ignoring pyenv-win commands The previous fix ignored any pyenv command found in $PATH while on WSL, regardless of whether it was correctly set up or not. This change only ignores the pyenv command if it's proved to come from pyenv-win by looking at its full path. --- plugins/pyenv/pyenv.plugin.zsh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/plugins/pyenv/pyenv.plugin.zsh b/plugins/pyenv/pyenv.plugin.zsh index fedde6342..813f64b42 100644 --- a/plugins/pyenv/pyenv.plugin.zsh +++ b/plugins/pyenv/pyenv.plugin.zsh @@ -1,11 +1,13 @@ # This plugin loads pyenv into the current shell and provides prompt info via # the 'pyenv_prompt_info' function. Also loads pyenv-virtualenv if available. -# Load pyenv only if command not already available -if command -v pyenv &> /dev/null && [[ "$(uname -r)" != *icrosoft* ]]; then - FOUND_PYENV=1 -else +# Look for pyenv in $PATH and verify that it's not a part of pyenv-win in WSL +if ! command -v pyenv &>/dev/null; then FOUND_PYENV=0 +elif [[ "${commands[pyenv]}" = */pyenv-win/* && "$(uname -r)" = *icrosoft* ]]; then + FOUND_PYENV=0 +else + FOUND_PYENV=1 fi # Look for pyenv and try to load it (will only work on interactive shells) From 9c34c359c4c1ebb1bd0211d40c3bca0c6aa2ca97 Mon Sep 17 00:00:00 2001 From: Aayush Kapoor Date: Fri, 6 Aug 2021 19:21:19 +0530 Subject: [PATCH 052/896] chore(ag): fix README (#10001) --- plugins/ag/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/ag/README.md b/plugins/ag/README.md index 6acc54067..1983aaa41 100644 --- a/plugins/ag/README.md +++ b/plugins/ag/README.md @@ -5,7 +5,7 @@ This plugin provides completion support for [`ag`](https://github.com/ggreer/the To use it, add ag to the plugins array in your zshrc file. ```zsh -plugins=(... aws) +plugins=(... ag) ``` ## INSTALLATION NOTES From ab58594173c04f7fe2155a169d8906ef761ba0fc Mon Sep 17 00:00:00 2001 From: Max Eisner <4730112+max-ae@users.noreply.github.com> Date: Tue, 10 Aug 2021 16:31:49 +0200 Subject: [PATCH 053/896] feat(git): add `develop` branch name detection (#9881) --- plugins/git/README.md | 35 ++++++++++++++++++----------------- plugins/git/git.plugin.zsh | 19 ++++++++++++++++--- 2 files changed, 34 insertions(+), 20 deletions(-) diff --git a/plugins/git/README.md b/plugins/git/README.md index e00f4cf92..522257d2d 100644 --- a/plugins/git/README.md +++ b/plugins/git/README.md @@ -23,7 +23,7 @@ plugins=(... git) | gb | git branch | | gba | git branch -a | | gbd | git branch -d | -| gbda | git branch --no-color --merged \| command grep -vE "^(\+\|\*\|\s*($(git_main_branch)\|development\|develop\|devel\|dev)\s*$)" \| command xargs -n 1 git branch -d | +| gbda | git branch --no-color --merged \| command grep -vE "^(\+\|\*\|\s*($(git_main_branch)\|$(git_develop_branch))\s*$)" \| command xargs -n 1 git branch -d | | gbD | git branch -D | | gbl | git blame -b -w | | gbnm | git branch --no-merged | @@ -49,8 +49,8 @@ plugins=(... git) | gcl | git clone --recurse-submodules | | gclean | git clean -id | | gpristine | git reset --hard && git clean -dffx | -| gcm | git checkout $(git_main_branch) | -| gcd | git checkout develop | +| gcm | git checkout $(git_main_branch) | +| gcd | git checkout $(git_develop_branch) | | gcmsg | git commit -m | | gco | git checkout | | gcor | git checkout --recurse-submodules | @@ -88,7 +88,7 @@ plugins=(... git) | ghh | git help | | gignore | git update-index --assume-unchanged | | gignored | git ls-files -v \| grep "^[[:lower:]]" | -| git-svn-dcommit-push | git svn dcommit && git push github $(git_main_branch):svntrunk | +| git-svn-dcommit-push | git svn dcommit && git push github $(git_main_branch):svntrunk | | gk | gitk --all --branches | | gke | gitk --all $(git log -g --pretty=%h) | | gl | git pull | @@ -107,10 +107,10 @@ plugins=(... git) | gloga | git log --oneline --decorate --graph --all | | glp | git log --pretty=\ | | gm | git merge | -| gmom | git merge origin/$(git_main_branch) | +| gmom | git merge origin/$(git_main_branch) | | gmt | git mergetool --no-prompt | | gmtvim | git mergetool --no-prompt --tool=vimdiff | -| gmum | git merge upstream/$(git_main_branch) | +| gmum | git merge upstream/$(git_main_branch) | | gma | git merge --abort | | gp | git push | | gpd | git push --dry-run | @@ -125,10 +125,10 @@ plugins=(... git) | grb | git rebase | | grba | git rebase --abort | | grbc | git rebase --continue | -| grbd | git rebase develop | +| grbd | git rebase $(git_develop_branch) | | grbi | git rebase -i | -| grbm | git rebase $(git_main_branch) | -| grbo | git rebase --onto | +| grbm | git rebase $(git_main_branch) | +| grbo | git rebase --onto | | grbs | git rebase --skip | | grev | git revert | | grh | git reset | @@ -176,7 +176,7 @@ plugins=(... git) | gupv | git pull --rebase -v | | gupa | git pull --rebase --autostash | | gupav | git pull --rebase --autostash -v | -| glum | git pull upstream $(git_main_branch) | +| glum | git pull upstream $(git_main_branch) | | 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 | @@ -214,13 +214,14 @@ These are aliases that have been removed, renamed, or otherwise modified in a wa ### Current -| Command | Description | -|:-----------------------|:-----------------------------------------------------------------------------| -| `grename ` | Rename `old` branch to `new`, including in origin remote | -| current_branch | Return the name of the current branch | -| git_current_user_name | Returns the `user.name` config value | -| git_current_user_email | Returns the `user.email` config value | -| git_main_branch | Returns the name of the main branch: `main` if it exists, `master` otherwise | +| Command | Description | +|:-----------------------|:---------------------------------------------------------------------------------------------------------| +| `grename ` | Rename `old` branch to `new`, including in origin remote | +| current_branch | Return the name of the current branch | +| git_current_user_name | Returns the `user.name` config value | +| git_current_user_email | Returns the `user.email` config value | +| git_main_branch | Returns the name of the main branch: `main` if it exists, `master` otherwise | +| git_develop_branch | Returns the name of the develop branch: `dev`, `devel`, `development` if they exist, `develop` otherwise | ### Work in Progress (WIP) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 2a7c7290d..3cd558692 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -42,6 +42,19 @@ function git_main_branch() { echo master } +# Check for develop and similarly named branches +function git_develop_branch() { + command git rev-parse --git-dir &>/dev/null || return + local branch + for branch in dev devel development; do + if command git show-ref -q --verify refs/heads/$branch; then + echo $branch + return + fi + done + echo develop +} + # # Aliases # (sorted alphabetically) @@ -60,7 +73,7 @@ alias gapt='git apply --3way' 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*($(git_main_branch)|development|develop|devel|dev)\s*$)" | command xargs -n 1 git branch -d' +alias gbda='git branch --no-color --merged | command grep -vE "^(\+|\*|\s*($(git_main_branch)|$(git_develop_branch))\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' @@ -88,7 +101,7 @@ alias gcl='git clone --recurse-submodules' alias gclean='git clean -id' alias gpristine='git reset --hard && git clean -dffx' alias gcm='git checkout $(git_main_branch)' -alias gcd='git checkout develop' +alias gcd='git checkout $(git_develop_branch)' alias gcmsg='git commit -m' alias gco='git checkout' alias gcor='git checkout --recurse-submodules' @@ -227,7 +240,7 @@ alias gra='git remote add' alias grb='git rebase' alias grba='git rebase --abort' alias grbc='git rebase --continue' -alias grbd='git rebase develop' +alias grbd='git rebase $(git_develop_branch)' alias grbi='git rebase -i' alias grbm='git rebase $(git_main_branch)' alias grbo='git rebase --onto' From bca73e18584771fd6db770055dac25b5728764c3 Mon Sep 17 00:00:00 2001 From: Quentin Nerden Date: Tue, 10 Aug 2021 20:25:08 +0200 Subject: [PATCH 054/896] feat(plugins): add completion plugin for `invoke` (#7311) Co-authored-by: Quentin Nerden --- plugins/invoke/README.md | 10 ++++++++++ plugins/invoke/invoke.plugin.zsh | 5 +++++ 2 files changed, 15 insertions(+) create mode 100644 plugins/invoke/README.md create mode 100644 plugins/invoke/invoke.plugin.zsh diff --git a/plugins/invoke/README.md b/plugins/invoke/README.md new file mode 100644 index 000000000..3f4b88078 --- /dev/null +++ b/plugins/invoke/README.md @@ -0,0 +1,10 @@ +# Invoke plugin + +This plugin adds completion for [invoke](https://github.com/pyinvoke/invoke). + +To use it, add `invoke` to the plugins array in your `~/.zshrc` file: + +```zsh +plugins=(... invoke) +``` + diff --git a/plugins/invoke/invoke.plugin.zsh b/plugins/invoke/invoke.plugin.zsh new file mode 100644 index 000000000..8c807de02 --- /dev/null +++ b/plugins/invoke/invoke.plugin.zsh @@ -0,0 +1,5 @@ +# Autocompletion for invoke. +# +if [ $commands[invoke] ]; then + source <(invoke --print-completion-script=zsh) +fi From b79fba7b0d38aa61afaeeaaa7fab6992dbfb6db3 Mon Sep 17 00:00:00 2001 From: Gregor Trefs Date: Tue, 10 Aug 2021 21:02:06 +0200 Subject: [PATCH 055/896] feat(plugins): `octozen` shows an Octocat zen quote on startup (#5959) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Marc CornellĂ  --- plugins/octozen/README.md | 12 ++++++++++++ plugins/octozen/octozen.plugin.zsh | 11 +++++++++++ 2 files changed, 23 insertions(+) create mode 100644 plugins/octozen/README.md create mode 100644 plugins/octozen/octozen.plugin.zsh diff --git a/plugins/octozen/README.md b/plugins/octozen/README.md new file mode 100644 index 000000000..2051248ca --- /dev/null +++ b/plugins/octozen/README.md @@ -0,0 +1,12 @@ +# Octozen plugin + +Displays a zen quote from GitHub's Octocat on start up. + +To use it, add `octozen` to the plugins array in your zshrc file: + +```zsh +plugins=(... octozen) +``` + +It defines a `display_octozen` function that fetches a GitHub Octocat zen quote. +NOTE: Internet connection is required (will time out if not fetched in 2 seconds). diff --git a/plugins/octozen/octozen.plugin.zsh b/plugins/octozen/octozen.plugin.zsh new file mode 100644 index 000000000..71ee550a5 --- /dev/null +++ b/plugins/octozen/octozen.plugin.zsh @@ -0,0 +1,11 @@ +# octozen plugin + +# Displays a zen quote from octocat +function display_octozen() { + curl -m 2 -fsL "https://api.github.com/octocat" + add-zsh-hook -d precmd display_octozen +} + +# Display the octocat on the first precmd, after the whole starting process has finished +autoload -Uz add-zsh-hook +add-zsh-hook precmd display_octozen From c24928815179e1a8e1e3a0a4ab130e22ba2e0f1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 10 Aug 2021 21:05:00 +0200 Subject: [PATCH 056/896] feat(lib): add `mkcd` as equivalent to `takedir` (#9749) Fixes #9749 --- lib/functions.zsh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/functions.zsh b/lib/functions.zsh index 9cc735196..24b7254fb 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -13,10 +13,6 @@ function upgrade_oh_my_zsh() { omz update } -function takedir() { - mkdir -p $@ && cd ${@:$#} -} - function open_command() { local open_cmd @@ -37,6 +33,13 @@ function open_command() { ${=open_cmd} "$@" &>/dev/null } +# take functions + +# mkcd is equivalent to takedir +function mkcd takedir() { + mkdir -p $@ && cd ${@:$#} +} + function takeurl() { data=$(mktemp) curl -L $1 > $data From 7eeb1e193d4a55ab706931fb80ef556a939be8fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 10 Aug 2021 21:09:21 +0200 Subject: [PATCH 057/896] refactor(lib): refactor take functions --- lib/functions.zsh | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/lib/functions.zsh b/lib/functions.zsh index 24b7254fb..73b491a59 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -41,26 +41,27 @@ function mkcd takedir() { } function takeurl() { - data=$(mktemp) - curl -L $1 > $data - tar xf $data - thedir=$(tar tf $data | head -1) - rm $data - cd $thedir + local data thedir + data="$(mktemp)" + curl -L "$1" > "$data" + tar xf "$data" + thedir="$(tar tf "$data" | head -1)" + rm "$data" + cd "$thedir" } function takegit() { - git clone $1 - cd $(basename ${1%%.git}) + git clone "$1" + cd "$(basename ${1%%.git})" } function take() { if [[ $1 =~ ^(https?|ftp).*\.tar\.(gz|bz2|xz)$ ]]; then - takeurl $1 + takeurl "$1" elif [[ $1 =~ ^([A-Za-z0-9]\+@|https?|git|ssh|ftps?|rsync).*\.git/?$ ]]; then - takegit $1 + takegit "$1" else - takedir $1 + takedir "$@" fi } From 6e4c9df4a433849a2c636980dc317db0fba3a0f5 Mon Sep 17 00:00:00 2001 From: James Eapen Date: Fri, 13 Aug 2021 06:33:30 -0400 Subject: [PATCH 058/896] feat(cli): add `plugin load` subcommand (#9872) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #9672 Co-authored-by: Marc CornellĂ  --- lib/cli.zsh | 77 +++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 72 insertions(+), 5 deletions(-) diff --git a/lib/cli.zsh b/lib/cli.zsh index 38e2f72f8..7e3e37be8 100644 --- a/lib/cli.zsh +++ b/lib/cli.zsh @@ -37,7 +37,7 @@ function _omz { changelog) local -a refs refs=("${(@f)$(command git for-each-ref --format="%(refname:short):%(subject)" refs/heads refs/tags)}") _describe 'command' refs ;; - plugin) subcmds=('info:Get plugin information' 'list:List plugins') + plugin) subcmds=('info:Get plugin information' 'list:List plugins' 'load:Load plugin(s)') _describe 'command' subcmds ;; pr) subcmds=('test:Test a Pull Request' 'clean:Delete all Pull Request branches') _describe 'command' subcmds ;; @@ -46,10 +46,26 @@ function _omz { esac elif (( CURRENT == 4 )); then case "$words[2]::$words[3]" in - plugin::info) compadd "$ZSH"/plugins/*/README.md(.N:h:t) \ - "$ZSH_CUSTOM"/plugins/*/README.md(.N:h:t) ;; - theme::use) compadd "$ZSH"/themes/*.zsh-theme(.N:t:r) \ - "$ZSH_CUSTOM"/**/*.zsh-theme(.N:r:gs:"$ZSH_CUSTOM"/themes/:::gs:"$ZSH_CUSTOM"/:::) ;; + plugin::(info|load)) + local -aU plugins=("$ZSH"/plugins/*/{_*,*.plugin.zsh}(.N:h:t) "$ZSH_CUSTOM"/plugins/*/{_*,*.plugin.zsh}(.N:h:t)) + _describe 'plugin' plugins ;; + theme::use) + local -aU themes=("$ZSH"/themes/*.zsh-theme(.N:t:r) "$ZSH_CUSTOM"/**/*.zsh-theme(.N:r:gs:"$ZSH_CUSTOM"/themes/:::gs:"$ZSH_CUSTOM"/:::)) + _describe 'theme' themes ;; + esac + elif (( CURRENT > 4 )); then + case "$words[2]::$words[3]" in + plugin::load) + local -aU plugins=("$ZSH"/plugins/*/{_*,*.plugin.zsh}(.N:h:t) "$ZSH_CUSTOM"/plugins/*/{_*,*.plugin.zsh}(.N:h:t)) + + # Remove plugins already passed as arguments + # NOTE: $(( CURRENT - 1 )) is the last plugin argument completely passed, i.e. that which + # has a space after them. This is to avoid removing plugins partially passed, which makes + # the completion not add a space after the completed plugin. + local -a args=(${words[4,$(( CURRENT - 1))]}) + plugins=(${plugins:|args}) + + _describe 'plugin' plugins ;; esac fi @@ -147,6 +163,7 @@ Available commands: info Get information of a plugin list List all available Oh My Zsh plugins + load Load plugin(s) EOF return 1 @@ -205,6 +222,56 @@ function _omz::plugin::list { fi } +function _omz::plugin::load { + if [[ -z "$1" ]]; then + echo >&2 "Usage: omz plugin load [...]" + return 1 + fi + + local plugins=("$@") + local plugin base has_completion=0 + + for plugin in $plugins; do + if [[ -d "$ZSH_CUSTOM/plugins/$plugin" ]]; then + base="$ZSH_CUSTOM/plugins/$plugin" + elif [[ -d "$ZSH/plugins/$plugin" ]]; then + base="$ZSH/plugins/$plugin" + else + _omz::log warn "plugin '$plugin' not found" + continue + fi + + # Check if its a valid plugin + if [[ ! -f "$base/_$plugin" && ! -f "$base/$plugin.plugin.zsh" ]]; then + _omz::log warn "'$plugin' is not a valid plugin" + continue + # It it is a valid plugin, add its directory to $fpath unless it is already there + elif (( ! ${fpath[(Ie)$base]} )); then + fpath=("$base" $fpath) + fi + + # Check if it has completion to reload compinit + if [[ -f "$base/_$plugin" ]]; then + has_completion=1 + fi + + # Load the plugin + if [[ -f "$base/$plugin.plugin.zsh" ]]; then + source "$base/$plugin.plugin.zsh" + fi + done + + # If we have completion, we need to reload the completion + # We pass -D to avoid generating a new dump file, which would overwrite our + # current one for the next session (and we don't want that because we're not + # actually enabling the plugins for the next session). + # Note that we still have to pass -d "$_comp_dumpfile", so that compinit + # doesn't use the default zcompdump location (${ZDOTDIR:-$HOME}/.zcompdump). + if (( has_completion )); then + compinit -D -d "$_comp_dumpfile" + fi +} + function _omz::pr { (( $# > 0 && $+functions[_omz::pr::$1] )) || { cat < Date: Fri, 13 Aug 2021 12:38:22 +0200 Subject: [PATCH 059/896] refactor(fedora)!: remove deprecated `fedora` plugin BREAKING CHANGE: the `fedora` plugin has been removed. Use the `dnf` plugin instead. --- plugins/fedora/README.md | 1 - plugins/fedora/fedora.plugin.zsh | 3 --- 2 files changed, 4 deletions(-) delete mode 100644 plugins/fedora/README.md delete mode 100644 plugins/fedora/fedora.plugin.zsh diff --git a/plugins/fedora/README.md b/plugins/fedora/README.md deleted file mode 100644 index 85d8d7dea..000000000 --- a/plugins/fedora/README.md +++ /dev/null @@ -1 +0,0 @@ -The fedora plugin is deprecated. Use the [dnf plugin](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/dnf) instead. diff --git a/plugins/fedora/fedora.plugin.zsh b/plugins/fedora/fedora.plugin.zsh deleted file mode 100644 index 226506c05..000000000 --- a/plugins/fedora/fedora.plugin.zsh +++ /dev/null @@ -1,3 +0,0 @@ -print -P "%F{yellow}The 'fedora' plugin is deprecated. Use the '%Udnf%u' plugin instead.%f" - -source "$ZSH/plugins/dnf/dnf.plugin.zsh" From e1f0d826f1f0d362eb377ef4a8124062ec63c3e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Fri, 13 Aug 2021 12:40:20 +0200 Subject: [PATCH 060/896] refactor(go)!: remove deprecated `go` plugin BREAKING CHANGE: the `go` plugin has been removed. Use the `golang` plugin instead. --- plugins/go/README.md | 1 - plugins/go/go.plugin.zsh | 3 --- 2 files changed, 4 deletions(-) delete mode 100644 plugins/go/README.md delete mode 100644 plugins/go/go.plugin.zsh diff --git a/plugins/go/README.md b/plugins/go/README.md deleted file mode 100644 index bf43b9feb..000000000 --- a/plugins/go/README.md +++ /dev/null @@ -1 +0,0 @@ -The go plugin is deprecated. Use the [golang plugin](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/golang) instead. diff --git a/plugins/go/go.plugin.zsh b/plugins/go/go.plugin.zsh deleted file mode 100644 index da7c87cfd..000000000 --- a/plugins/go/go.plugin.zsh +++ /dev/null @@ -1,3 +0,0 @@ -print -P "%F{yellow}The 'go' plugin is deprecated. Use the '%Ugolang%u' plugin instead.%f" - -source "$ZSH/plugins/golang/golang.plugin.zsh" From af6c7f3d6782cf0a34e4e68f661df526d35795be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Fri, 13 Aug 2021 12:42:56 +0200 Subject: [PATCH 061/896] refactor(cloudapp)!: remove deprecated `cloudapp` plugin BREAKING CHANGE: the `cloudapp` plugin has been removed due to removed API. --- plugins/cloudapp/README.md | 26 -------------------------- plugins/cloudapp/cloudapp.plugin.zsh | 4 ---- 2 files changed, 30 deletions(-) delete mode 100644 plugins/cloudapp/README.md delete mode 100644 plugins/cloudapp/cloudapp.plugin.zsh diff --git a/plugins/cloudapp/README.md b/plugins/cloudapp/README.md deleted file mode 100644 index ef304edc2..000000000 --- a/plugins/cloudapp/README.md +++ /dev/null @@ -1,26 +0,0 @@ -# CloudApp plugin - -## The CloudApp API is deprecated, so the plugin will be removed shortly - -[CloudApp](https://www.getcloudapp.com) brings screen recording, screenshots, and GIF creation to the cloud, in an easy-to-use enterprise-level app. The CloudApp plugin allows you to upload a file to your CloadApp account from the command line. - -To use it, add `cloudapp` to the plugins array of your `~/.zshrc` file: - -```zsh -plugins=(... cloudapp) -``` - -## Requirements - -1. [Aaron Russell's `cloudapp_api` gem](https://github.com/aaronrussell/cloudapp_api#installation) - -2. That you set your CloudApp credentials in `~/.cloudapp` as a simple text file like below: - ``` - email - password - ``` - -## Usage - -- `cloudapp `: uploads `` to your CloudApp account, and if you're using - macOS, copies the URL to your clipboard. diff --git a/plugins/cloudapp/cloudapp.plugin.zsh b/plugins/cloudapp/cloudapp.plugin.zsh deleted file mode 100644 index a4d92a080..000000000 --- a/plugins/cloudapp/cloudapp.plugin.zsh +++ /dev/null @@ -1,4 +0,0 @@ -print -Pn "%F{yellow}" -print "[oh-my-zsh] The CloudApp API no longer works, so the cloudapp plugin will" -print "[oh-my-zsh] be removed shortly. Please remove it from your plugins list." -print -Pn "%f" From 6dc937ff685fcbc43056dbd7fb05ba01c56dfd1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 4 Aug 2021 15:49:11 +0200 Subject: [PATCH 062/896] feat(extract): add suport for .cab files via `cabextract` --- plugins/extract/README.md | 1 + plugins/extract/_extract | 2 +- plugins/extract/extract.plugin.zsh | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/extract/README.md b/plugins/extract/README.md index f2e6ad1d1..1dd8e19c0 100644 --- a/plugins/extract/README.md +++ b/plugins/extract/README.md @@ -21,6 +21,7 @@ plugins=(... extract) | `apk` | Android app file | | `aar` | Android library file | | `bz2` | Bzip2 file | +| `cab` | Microsoft cabinet archive | | `deb` | Debian package | | `ear` | Enterprise Application aRchive | | `gz` | Gzip file | diff --git a/plugins/extract/_extract b/plugins/extract/_extract index 267c4d4e1..31a7facbe 100644 --- a/plugins/extract/_extract +++ b/plugins/extract/_extract @@ -3,5 +3,5 @@ _arguments \ '(-r --remove)'{-r,--remove}'[Remove archive.]' \ - "*::archive file:_files -g '(#i)*.(7z|Z|apk|aar|bz2|deb|ear|gz|ipa|ipsw|jar|lrz|lz4|lzma|rar|rpm|sublime-package|tar|tar.bz2|tar.gz|tar.lrz|tar.lz|tar.lz4|tar.xz|tar.zma|tar.zst|tbz|tbz2|tgz|tlz|txz|tzst|war|whl|xpi|xz|zip|zst)(-.)'" \ + "*::archive file:_files -g '(#i)*.(7z|Z|apk|aar|bz2|cab|deb|ear|gz|ipa|ipsw|jar|lrz|lz4|lzma|rar|rpm|sublime-package|tar|tar.bz2|tar.gz|tar.lrz|tar.lz|tar.lz4|tar.xz|tar.zma|tar.zst|tbz|tbz2|tgz|tlz|txz|tzst|war|whl|xpi|xz|zip|zst)(-.)'" \ && return 0 diff --git a/plugins/extract/extract.plugin.zsh b/plugins/extract/extract.plugin.zsh index e390e2dcc..601272cac 100644 --- a/plugins/extract/extract.plugin.zsh +++ b/plugins/extract/extract.plugin.zsh @@ -55,7 +55,7 @@ extract() { (*.lz4) lz4 -d "$1" ;; (*.lzma) unlzma "$1" ;; (*.z) uncompress "$1" ;; - (*.zip|*.war|*.jar|*.ear|*.sublime-package|*.ipa|*.ipsw|*.xpi|*.apk|*.aar|*.whl) unzip "$1" -d $extract_dir ;; + (*.zip|*.war|*.jar|*.ear|*.sublime-package|*.ipa|*.ipsw|*.xpi|*.apk|*.aar|*.whl) unzip "$1" -d "$extract_dir" ;; (*.rar) unrar x -ad "$1" ;; (*.rpm) mkdir "$extract_dir" && cd "$extract_dir" && rpm2cpio "../$1" | cpio --quiet -id && cd .. ;; (*.7z) 7za x "$1" ;; @@ -69,6 +69,7 @@ extract() { cd .. ;; (*.zst) unzstd "$1" ;; + (*.cab) cabextract -d "$extract_dir" "$1" ;; (*) echo "extract: '$1' cannot be extracted" >&2 success=1 From 59a9b453d348baad4ff7b7cb2e1f205d615200e6 Mon Sep 17 00:00:00 2001 From: Alexander Kapshuna Date: Mon, 24 Jun 2019 00:54:28 +0300 Subject: [PATCH 063/896] fix(extract): support unpacking deb file from different directory --- plugins/extract/extract.plugin.zsh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/plugins/extract/extract.plugin.zsh b/plugins/extract/extract.plugin.zsh index 601272cac..e63b9494f 100644 --- a/plugins/extract/extract.plugin.zsh +++ b/plugins/extract/extract.plugin.zsh @@ -60,13 +60,13 @@ extract() { (*.rpm) mkdir "$extract_dir" && cd "$extract_dir" && rpm2cpio "../$1" | cpio --quiet -id && cd .. ;; (*.7z) 7za x "$1" ;; (*.deb) - mkdir -p "$extract_dir/control" - mkdir -p "$extract_dir/data" - cd "$extract_dir"; ar vx "../${1}" > /dev/null - cd control; tar xzvf ../control.tar.gz - cd ../data; extract ../data.tar.* - cd ..; rm *.tar.* debian-binary - cd .. + local pwd="$PWD" file="${1:A}" + mkdir -p "$extract_dir/control" "$extract_dir/data" + builtin cd -q "$extract_dir"; ar vx "$file" > /dev/null + builtin cd -q control; extract ../control.tar.* + builtin cd -q ../data; extract ../data.tar.* + builtin cd -q ..; command rm *.tar.* debian-binary + builtin cd -q "$pwd" ;; (*.zst) unzstd "$1" ;; (*.cab) cabextract -d "$extract_dir" "$1" ;; From 0b506fea0c9aeb450db6fdaba572041fd900c05b Mon Sep 17 00:00:00 2001 From: Xeonacid Date: Wed, 9 Jun 2021 19:29:04 +0800 Subject: [PATCH 064/896] feat(extract): add cpio support --- plugins/extract/README.md | 1 + plugins/extract/_extract | 2 +- plugins/extract/extract.plugin.zsh | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/extract/README.md b/plugins/extract/README.md index 1dd8e19c0..44f0b05a1 100644 --- a/plugins/extract/README.md +++ b/plugins/extract/README.md @@ -22,6 +22,7 @@ plugins=(... extract) | `aar` | Android library file | | `bz2` | Bzip2 file | | `cab` | Microsoft cabinet archive | +| `cpio` | Cpio archive | | `deb` | Debian package | | `ear` | Enterprise Application aRchive | | `gz` | Gzip file | diff --git a/plugins/extract/_extract b/plugins/extract/_extract index 31a7facbe..27b099c9e 100644 --- a/plugins/extract/_extract +++ b/plugins/extract/_extract @@ -3,5 +3,5 @@ _arguments \ '(-r --remove)'{-r,--remove}'[Remove archive.]' \ - "*::archive file:_files -g '(#i)*.(7z|Z|apk|aar|bz2|cab|deb|ear|gz|ipa|ipsw|jar|lrz|lz4|lzma|rar|rpm|sublime-package|tar|tar.bz2|tar.gz|tar.lrz|tar.lz|tar.lz4|tar.xz|tar.zma|tar.zst|tbz|tbz2|tgz|tlz|txz|tzst|war|whl|xpi|xz|zip|zst)(-.)'" \ + "*::archive file:_files -g '(#i)*.(7z|Z|apk|aar|bz2|cab|cpio|deb|ear|gz|ipa|ipsw|jar|lrz|lz4|lzma|rar|rpm|sublime-package|tar|tar.bz2|tar.gz|tar.lrz|tar.lz|tar.lz4|tar.xz|tar.zma|tar.zst|tbz|tbz2|tgz|tlz|txz|tzst|war|whl|xpi|xz|zip|zst)(-.)'" \ && return 0 diff --git a/plugins/extract/extract.plugin.zsh b/plugins/extract/extract.plugin.zsh index e63b9494f..ac181fa78 100644 --- a/plugins/extract/extract.plugin.zsh +++ b/plugins/extract/extract.plugin.zsh @@ -70,6 +70,7 @@ extract() { ;; (*.zst) unzstd "$1" ;; (*.cab) cabextract -d "$extract_dir" "$1" ;; + (*.cpio) cpio -idmvF "$1" ;; (*) echo "extract: '$1' cannot be extracted" >&2 success=1 From a2f1ef69b570b43bbdd0fa29bddb860293b7278b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Sat, 14 Aug 2021 21:57:56 +0200 Subject: [PATCH 065/896] fix(extract): correctly extract rpm files on other directories --- plugins/extract/extract.plugin.zsh | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/plugins/extract/extract.plugin.zsh b/plugins/extract/extract.plugin.zsh index ac181fa78..12a1ec948 100644 --- a/plugins/extract/extract.plugin.zsh +++ b/plugins/extract/extract.plugin.zsh @@ -20,6 +20,7 @@ extract() { shift fi + local pwd="$PWD" while (( $# > 0 )); do if [[ ! -f "$1" ]]; then echo "extract: '$1' is not a valid file" >&2 @@ -29,6 +30,7 @@ extract() { success=0 extract_dir="${1:t:r}" + local full_path="${1:A}" case "${1:l}" in (*.tar.gz|*.tgz) (( $+commands[pigz] )) && { pigz -dc "$1" | tar xv } || tar zxvf "$1" ;; (*.tar.bz2|*.tbz|*.tbz2) tar xvjf "$1" ;; @@ -57,17 +59,16 @@ extract() { (*.z) uncompress "$1" ;; (*.zip|*.war|*.jar|*.ear|*.sublime-package|*.ipa|*.ipsw|*.xpi|*.apk|*.aar|*.whl) unzip "$1" -d "$extract_dir" ;; (*.rar) unrar x -ad "$1" ;; - (*.rpm) mkdir "$extract_dir" && cd "$extract_dir" && rpm2cpio "../$1" | cpio --quiet -id && cd .. ;; + (*.rpm) + command mkdir -p "$extract_dir" && builtin cd -q "$extract_dir" \ + && rpm2cpio "$full_path" | cpio --quiet -id ;; (*.7z) 7za x "$1" ;; (*.deb) - local pwd="$PWD" file="${1:A}" - mkdir -p "$extract_dir/control" "$extract_dir/data" - builtin cd -q "$extract_dir"; ar vx "$file" > /dev/null + command mkdir -p "$extract_dir/control" "$extract_dir/data" + builtin cd -q "$extract_dir"; ar vx "$full_path" > /dev/null builtin cd -q control; extract ../control.tar.* builtin cd -q ../data; extract ../data.tar.* - builtin cd -q ..; command rm *.tar.* debian-binary - builtin cd -q "$pwd" - ;; + builtin cd -q ..; command rm *.tar.* debian-binary ;; (*.zst) unzstd "$1" ;; (*.cab) cabextract -d "$extract_dir" "$1" ;; (*.cpio) cpio -idmvF "$1" ;; @@ -77,8 +78,11 @@ extract() { ;; esac - (( success = $success > 0 ? $success : $? )) - (( $success == 0 )) && (( $remove_archive == 0 )) && rm "$1" + (( success = success > 0 ? success : $? )) + (( success == 0 && remove_archive == 0 )) && rm "$full_path" shift + + # Go back to original working directory in case we ran cd previously + builtin cd -q "$pwd" done } From 10a00085d027a969c7ef27e52085ca1fa7f5668c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Sat, 14 Aug 2021 22:05:48 +0200 Subject: [PATCH 066/896] fix(extract): don't push entries to dirstack when extracting rpm and deb files --- plugins/extract/extract.plugin.zsh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/extract/extract.plugin.zsh b/plugins/extract/extract.plugin.zsh index 12a1ec948..a257f6bc3 100644 --- a/plugins/extract/extract.plugin.zsh +++ b/plugins/extract/extract.plugin.zsh @@ -1,6 +1,8 @@ alias x=extract extract() { + setopt localoptions noautopushd + local remove_archive local success local extract_dir From 0b32e4b25fa7f3215964281a8af4e3ff2bf4cd68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Sat, 14 Aug 2021 22:03:41 +0200 Subject: [PATCH 067/896] style(extract): adopt main code style guide and refactor variables --- plugins/extract/extract.plugin.zsh | 153 ++++++++++++++--------------- 1 file changed, 74 insertions(+), 79 deletions(-) diff --git a/plugins/extract/extract.plugin.zsh b/plugins/extract/extract.plugin.zsh index a257f6bc3..1112dd52f 100644 --- a/plugins/extract/extract.plugin.zsh +++ b/plugins/extract/extract.plugin.zsh @@ -1,90 +1,85 @@ alias x=extract extract() { - setopt localoptions noautopushd + setopt localoptions noautopushd - local remove_archive - local success - local extract_dir + if (( $# == 0 )); then + cat >&2 <<'EOF' +Usage: extract [-option] [file ...] - if (( $# == 0 )); then - cat <<-'EOF' >&2 - Usage: extract [-option] [file ...] +Options: + -r, --remove Remove archive after unpacking. +EOF + fi - Options: - -r, --remove Remove archive after unpacking. - EOF - fi + local remove_archive=1 + if [[ "$1" == "-r" ]] || [[ "$1" == "--remove" ]]; then + remove_archive=0 + shift + fi - remove_archive=1 - if [[ "$1" == "-r" ]] || [[ "$1" == "--remove" ]]; then - remove_archive=0 - shift - fi + local pwd="$PWD" + while (( $# > 0 )); do + if [[ ! -f "$1" ]]; then + echo "extract: '$1' is not a valid file" >&2 + shift + continue + fi - local pwd="$PWD" - while (( $# > 0 )); do - if [[ ! -f "$1" ]]; then - echo "extract: '$1' is not a valid file" >&2 - shift - continue - fi + local success=0 + local extract_dir="${1:t:r}" + local file="$1" full_path="${1:A}" + case "${file:l}" in + (*.tar.gz|*.tgz) (( $+commands[pigz] )) && { pigz -dc "$file" | tar xv } || tar zxvf "$file" ;; + (*.tar.bz2|*.tbz|*.tbz2) tar xvjf "$file" ;; + (*.tar.xz|*.txz) + tar --xz --help &> /dev/null \ + && tar --xz -xvf "$file" \ + || xzcat "$file" | tar xvf - ;; + (*.tar.zma|*.tlz) + tar --lzma --help &> /dev/null \ + && tar --lzma -xvf "$file" \ + || lzcat "$file" | tar xvf - ;; + (*.tar.zst|*.tzst) + tar --zstd --help &> /dev/null \ + && tar --zstd -xvf "$file" \ + || zstdcat "$file" | tar xvf - ;; + (*.tar) tar xvf "$file" ;; + (*.tar.lz) (( $+commands[lzip] )) && tar xvf "$file" ;; + (*.tar.lz4) lz4 -c -d "$file" | tar xvf - ;; + (*.tar.lrz) (( $+commands[lrzuntar] )) && lrzuntar "$file" ;; + (*.gz) (( $+commands[pigz] )) && pigz -dk "$file" || gunzip -k "$file" ;; + (*.bz2) bunzip2 "$file" ;; + (*.xz) unxz "$file" ;; + (*.lrz) (( $+commands[lrunzip] )) && lrunzip "$file" ;; + (*.lz4) lz4 -d "$file" ;; + (*.lzma) unlzma "$file" ;; + (*.z) uncompress "$file" ;; + (*.zip|*.war|*.jar|*.ear|*.sublime-package|*.ipa|*.ipsw|*.xpi|*.apk|*.aar|*.whl) unzip "$file" -d "$extract_dir" ;; + (*.rar) unrar x -ad "$file" ;; + (*.rpm) + command mkdir -p "$extract_dir" && builtin cd -q "$extract_dir" \ + && rpm2cpio "$full_path" | cpio --quiet -id ;; + (*.7z) 7za x "$file" ;; + (*.deb) + command mkdir -p "$extract_dir/control" "$extract_dir/data" + builtin cd -q "$extract_dir"; ar vx "$full_path" > /dev/null + builtin cd -q control; extract ../control.tar.* + builtin cd -q ../data; extract ../data.tar.* + builtin cd -q ..; command rm *.tar.* debian-binary ;; + (*.zst) unzstd "$file" ;; + (*.cab) cabextract -d "$extract_dir" "$file" ;; + (*.cpio) cpio -idmvF "$file" ;; + (*) + echo "extract: '$file' cannot be extracted" >&2 + success=1 ;; + esac - success=0 - extract_dir="${1:t:r}" - local full_path="${1:A}" - case "${1:l}" in - (*.tar.gz|*.tgz) (( $+commands[pigz] )) && { pigz -dc "$1" | tar xv } || tar zxvf "$1" ;; - (*.tar.bz2|*.tbz|*.tbz2) tar xvjf "$1" ;; - (*.tar.xz|*.txz) - tar --xz --help &> /dev/null \ - && tar --xz -xvf "$1" \ - || xzcat "$1" | tar xvf - ;; - (*.tar.zma|*.tlz) - tar --lzma --help &> /dev/null \ - && tar --lzma -xvf "$1" \ - || lzcat "$1" | tar xvf - ;; - (*.tar.zst|*.tzst) - tar --zstd --help &> /dev/null \ - && tar --zstd -xvf "$1" \ - || zstdcat "$1" | tar xvf - ;; - (*.tar) tar xvf "$1" ;; - (*.tar.lz) (( $+commands[lzip] )) && tar xvf "$1" ;; - (*.tar.lz4) lz4 -c -d "$1" | tar xvf - ;; - (*.tar.lrz) (( $+commands[lrzuntar] )) && lrzuntar "$1" ;; - (*.gz) (( $+commands[pigz] )) && pigz -dk "$1" || gunzip -k "$1" ;; - (*.bz2) bunzip2 "$1" ;; - (*.xz) unxz "$1" ;; - (*.lrz) (( $+commands[lrunzip] )) && lrunzip "$1" ;; - (*.lz4) lz4 -d "$1" ;; - (*.lzma) unlzma "$1" ;; - (*.z) uncompress "$1" ;; - (*.zip|*.war|*.jar|*.ear|*.sublime-package|*.ipa|*.ipsw|*.xpi|*.apk|*.aar|*.whl) unzip "$1" -d "$extract_dir" ;; - (*.rar) unrar x -ad "$1" ;; - (*.rpm) - command mkdir -p "$extract_dir" && builtin cd -q "$extract_dir" \ - && rpm2cpio "$full_path" | cpio --quiet -id ;; - (*.7z) 7za x "$1" ;; - (*.deb) - command mkdir -p "$extract_dir/control" "$extract_dir/data" - builtin cd -q "$extract_dir"; ar vx "$full_path" > /dev/null - builtin cd -q control; extract ../control.tar.* - builtin cd -q ../data; extract ../data.tar.* - builtin cd -q ..; command rm *.tar.* debian-binary ;; - (*.zst) unzstd "$1" ;; - (*.cab) cabextract -d "$extract_dir" "$1" ;; - (*.cpio) cpio -idmvF "$1" ;; - (*) - echo "extract: '$1' cannot be extracted" >&2 - success=1 - ;; - esac + (( success = success > 0 ? success : $? )) + (( success == 0 && remove_archive == 0 )) && rm "$full_path" + shift - (( success = success > 0 ? success : $? )) - (( success == 0 && remove_archive == 0 )) && rm "$full_path" - shift - - # Go back to original working directory in case we ran cd previously - builtin cd -q "$pwd" - done + # Go back to original working directory in case we ran cd previously + builtin cd -q "$pwd" + done } From 7c5ab01a5f7b07481182108117db070b8cabb2e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Sat, 14 Aug 2021 22:41:48 +0200 Subject: [PATCH 068/896] fix(changelog): also display commits from merged branches --- tools/changelog.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tools/changelog.sh b/tools/changelog.sh index 56ea42cb1..6913ae49a 100755 --- a/tools/changelog.sh +++ b/tools/changelog.sh @@ -391,9 +391,7 @@ function main { # Get commit list from $until commit until $since commit, or until root # commit if $since is unset, in short hash form. - # --first-parent is used when dealing with merges: it only prints the - # merge commit, not the commits of the merged branch. - command git rev-list --first-parent --abbrev-commit --abbrev=7 ${since:+$since..}$until | while read hash; do + command git rev-list --abbrev-commit --abbrev=7 ${since:+$since..}$until | while read hash; do # Truncate list on versions with a lot of commits if [[ -z "$since" ]] && (( ++read_commits > 35 )); then truncate=1 From 11e22ed0b5c1aebd6e990ea7a885bdf03ab6555a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Sat, 14 Aug 2021 22:54:07 +0200 Subject: [PATCH 069/896] docs(dirhistory): document keyboard shortcut conflict with Windows Terminal Related: https://github.com/ohmyzsh/ohmyzsh/issues/8505#issuecomment-886241162 --- plugins/dirhistory/README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/dirhistory/README.md b/plugins/dirhistory/README.md index 223650727..602fc8284 100644 --- a/plugins/dirhistory/README.md +++ b/plugins/dirhistory/README.md @@ -17,6 +17,9 @@ plugins=(... dirhistory) | alt + up | Move into the parent directory | | alt + down | Move into the first child directory by alphabetical order | +NOTE: some terminals might override the ALT+Arrows key bindings (Windows Terminal, for example). +If these don't work check your terminal settings and change them to a different keyboard shortcut. + ## Usage This plugin allows you to navigate the history of previous current-working-directories using ALT-LEFT and ALT-RIGHT. ALT-LEFT moves back to directories that the user has changed to in the past, and ALT-RIGHT undoes ALT-LEFT. MAC users may alternately use OPT-LEFT and OPT-RIGHT. From 33847956d9969866dd8b502ffc88af58d2b427fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 17 Aug 2021 09:37:01 +0200 Subject: [PATCH 070/896] fix(colemak): remove `lesskey` usage in less v582 and newer (#10102) --- plugins/colemak/.gitignore | 1 + plugins/colemak/colemak.plugin.zsh | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 plugins/colemak/.gitignore diff --git a/plugins/colemak/.gitignore b/plugins/colemak/.gitignore new file mode 100644 index 000000000..8241f5ed6 --- /dev/null +++ b/plugins/colemak/.gitignore @@ -0,0 +1 @@ +.less diff --git a/plugins/colemak/colemak.plugin.zsh b/plugins/colemak/colemak.plugin.zsh index cb7cc5068..8d3393c44 100644 --- a/plugins/colemak/colemak.plugin.zsh +++ b/plugins/colemak/colemak.plugin.zsh @@ -19,4 +19,15 @@ bindkey -a 'N' vi-join bindkey -a 'j' vi-forward-word-end bindkey -a 'J' vi-forward-blank-word-end -lesskey $ZSH/plugins/colemak/colemak-less +# New less versions will read this file directly +export LESSKEYIN="${0:h:A}/colemak-less" + +# Only run lesskey if less version is older than v582 +less_ver=$(less --version | awk '{print $2;exit}') +autoload -Uz is-at-least +if ! is-at-least 582 $less_ver; then + # Old less versions will read this transformed file + export LESSKEY="${0:h:A}/.less" + lesskey -o "$LESSKEY" "$LESSKEYIN" 2>/dev/null +fi +unset less_ver From 4455c13e063cf81ba427f98e1dce2024ecd50762 Mon Sep 17 00:00:00 2001 From: pollyduan Date: Tue, 17 Aug 2021 18:10:54 +0800 Subject: [PATCH 071/896] feat(cli): add subcommands for plugin `enable` and `disable` (#9869) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Marc CornellĂ  --- lib/cli.zsh | 218 +++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 207 insertions(+), 11 deletions(-) diff --git a/lib/cli.zsh b/lib/cli.zsh index 7e3e37be8..1289df730 100644 --- a/lib/cli.zsh +++ b/lib/cli.zsh @@ -37,7 +37,13 @@ function _omz { changelog) local -a refs refs=("${(@f)$(command git for-each-ref --format="%(refname:short):%(subject)" refs/heads refs/tags)}") _describe 'command' refs ;; - plugin) subcmds=('info:Get plugin information' 'list:List plugins' 'load:Load plugin(s)') + plugin) subcmds=( + 'disable:Disable plugin(s)' + 'enable:Enable plugin(s)' + 'info:Get plugin information' + 'list:List plugins' + 'load:Load plugin(s)' + ) _describe 'command' subcmds ;; pr) subcmds=('test:Test a Pull Request' 'clean:Delete all Pull Request branches') _describe 'command' subcmds ;; @@ -45,8 +51,21 @@ function _omz { _describe 'command' subcmds ;; esac elif (( CURRENT == 4 )); then - case "$words[2]::$words[3]" in - plugin::(info|load)) + case "${words[2]}::${words[3]}" in + plugin::(disable|enable|load)) + local -aU valid_plugins + + if [[ "${words[3]}" = disable ]]; then + # if command is "disable", only offer already enabled plugins + valid_plugins=($plugins) + else + valid_plugins=("$ZSH"/plugins/*/{_*,*.plugin.zsh}(.N:h:t) "$ZSH_CUSTOM"/plugins/*/{_*,*.plugin.zsh}(.N:h:t)) + # if command is "enable", remove already enabled plugins + [[ "${words[3]}" = enable ]] && valid_plugins=(${valid_plugins:|plugins}) + fi + + _describe 'plugin' valid_plugins ;; + plugin::info) local -aU plugins=("$ZSH"/plugins/*/{_*,*.plugin.zsh}(.N:h:t) "$ZSH_CUSTOM"/plugins/*/{_*,*.plugin.zsh}(.N:h:t)) _describe 'plugin' plugins ;; theme::use) @@ -54,18 +73,27 @@ function _omz { _describe 'theme' themes ;; esac elif (( CURRENT > 4 )); then - case "$words[2]::$words[3]" in - plugin::load) - local -aU plugins=("$ZSH"/plugins/*/{_*,*.plugin.zsh}(.N:h:t) "$ZSH_CUSTOM"/plugins/*/{_*,*.plugin.zsh}(.N:h:t)) + case "${words[2]}::${words[3]}" in + plugin::(enable|disable|load)) + local -aU valid_plugins + + if [[ "${words[3]}" = disable ]]; then + # if command is "disable", only offer already enabled plugins + valid_plugins=($plugins) + else + valid_plugins=("$ZSH"/plugins/*/{_*,*.plugin.zsh}(.N:h:t) "$ZSH_CUSTOM"/plugins/*/{_*,*.plugin.zsh}(.N:h:t)) + # if command is "enable", remove already enabled plugins + [[ "${words[3]}" = enable ]] && valid_plugins=(${valid_plugins:|plugins}) + fi # Remove plugins already passed as arguments # NOTE: $(( CURRENT - 1 )) is the last plugin argument completely passed, i.e. that which # has a space after them. This is to avoid removing plugins partially passed, which makes # the completion not add a space after the completed plugin. local -a args=(${words[4,$(( CURRENT - 1))]}) - plugins=(${plugins:|args}) + valid_plugins=(${valid_plugins:|args}) - _describe 'plugin' plugins ;; + _describe 'plugin' valid_plugins ;; esac fi @@ -161,9 +189,11 @@ Usage: omz plugin [options] Available commands: - info Get information of a plugin - list List all available Oh My Zsh plugins - load Load plugin(s) + disable Disable plugin(s) + enable Enable plugin(s) + info Get information of a plugin + list List all available Oh My Zsh plugins + load Load plugin(s) EOF return 1 @@ -175,6 +205,172 @@ EOF _omz::plugin::$command "$@" } +function _omz::plugin::disable { + if [[ -z "$1" ]]; then + echo >&2 "Usage: omz plugin disable [...]" + return 1 + fi + + # Check that plugin is in $plugins + local -a dis_plugins=() + for plugin in "$@"; do + if [[ ${plugins[(Ie)$plugin]} -eq 0 ]]; then + _omz::log warn "plugin '$plugin' is not enabled." + continue + fi + dis_plugins+=("$plugin") + done + + # Exit if there are no enabled plugins to disable + if [[ ${#dis_plugins} -eq 0 ]]; then + return 1 + fi + + # Disable plugins awk script + local awk_script=" +# if plugins=() is in oneline form, substitute disabled plugins and go to next line +/^\s*plugins=\([^#]+\).*\$/ { + sub(/\s+(${(j:|:)dis_plugins})/, \"\") # with spaces before + sub(/(${(j:|:)dis_plugins})\s+/, \"\") # with spaces after + sub(/\((${(j:|:)dis_plugins})\)/, \"\") # without spaces (only plugin) + print \$0 + next +} + +# if plugins=() is in multiline form, enable multi flag and disable plugins if they're there +/^\s*plugins=\(/ { + multi=1 + sub(/\s+(${(j:|:)dis_plugins})/, \"\") + sub(/(${(j:|:)dis_plugins})\s+/, \"\") + sub(/\((${(j:|:)dis_plugins})\)/, \"\") + print \$0 + next +} + +# if multi flag is enabled and we find a valid closing parenthesis, +# add new plugins and disable multi flag +multi == 1 && /^[^#]*\)/ { + multi=0 + sub(/\s+(${(j:|:)dis_plugins})/, \"\") + sub(/(${(j:|:)dis_plugins})\s+/, \"\") + sub(/\((${(j:|:)dis_plugins})\)/, \"\") + print \$0 + next +} + +multi == 1 { + sub(/\s+(${(j:|:)dis_plugins})/, \"\") + sub(/(${(j:|:)dis_plugins})\s+/, \"\") + sub(/\((${(j:|:)dis_plugins})\)/, \"\") + print \$0 + next +} + +{ print \$0 } +" + + awk "$awk_script" ~/.zshrc > ~/.zshrc.disabled \ + && mv ~/.zshrc ~/.zshrc.swp \ + && mv ~/.zshrc.disabled ~/.zshrc + + # Exit if the new .zshrc file wasn't created correctly + [[ $? -eq 0 ]] || { + local ret=$? + _omz::log error "error disabling plugins." + return $ret + } + + # Exit if the new .zshrc file has syntax errors + if ! zsh -n ~/.zshrc; then + _omz::log error "broken syntax in ~/.zshrc. Rolling back changes..." + mv ~/.zshrc ~/.zshrc.disabled + mv ~/.zshrc.swp ~/.zshrc + return 1 + fi + + # Restart the zsh session if there were no errors + _omz::log info "" + + # Old zsh versions don't have ZSH_ARGZERO + local zsh="${ZSH_ARGZERO:-${functrace[-1]%:*}}" + # Check whether to run a login shell + [[ "$zsh" = -* || -o login ]] && exec -l "${zsh#-}" || exec "$zsh" +} + +function _omz::plugin::enable { + if [[ -z "$1" ]]; then + echo >&2 "Usage: omz plugin enable [...]" + return 1 + fi + + # Check that plugin is not in $plugins + local -a add_plugins=() + for plugin in "$@"; do + if [[ ${plugins[(Ie)$plugin]} -ne 0 ]]; then + _omz::log warn "plugin '$plugin' is already enabled." + continue + fi + add_plugins+=("$plugin") + done + + # Exit if there are no plugins to enable + if [[ ${#add_plugins} -eq 0 ]]; then + return 1 + fi + + # Enable plugins awk script + local awk_script=" +# if plugins=() is in oneline form, substitute ) with new plugins and go to the next line +/^\s*plugins=\([^#]+\).*\$/ { + sub(/\)/, \" $add_plugins&\") + print \$0 + next +} + +# if plugins=() is in multiline form, enable multi flag +/^\s*plugins=\(/ { + multi=1 +} + +# if multi flag is enabled and we find a valid closing parenthesis, +# add new plugins and disable multi flag +multi == 1 && /^[^#]*\)/ { + multi=0 + sub(/\)/, \" $add_plugins&\") + print \$0 + next +} + +{ print \$0 } +" + + awk "$awk_script" ~/.zshrc > ~/.zshrc.disabled \ + && mv ~/.zshrc ~/.zshrc.swp \ + && mv ~/.zshrc.disabled ~/.zshrc + + # Exit if the new .zshrc file wasn't created correctly + [[ $? -eq 0 ]] || { + local ret=$? + _omz::log error "error disabling plugins." + return $ret + } + + # Exit if the new .zshrc file has syntax errors + if ! zsh -n ~/.zshrc; then + _omz::log error "broken syntax in ~/.zshrc. Rolling back changes..." + mv ~/.zshrc ~/.zshrc.disabled + mv ~/.zshrc.swp ~/.zshrc + return 1 + fi + + # Restart the zsh session if there were no errors + + # Old zsh versions don't have ZSH_ARGZERO + local zsh="${ZSH_ARGZERO:-${functrace[-1]%:*}}" + # Check whether to run a login shell + [[ "$zsh" = -* || -o login ]] && exec -l "${zsh#-}" || exec "$zsh" +} + function _omz::plugin::info { if [[ -z "$1" ]]; then echo >&2 "Usage: omz plugin info " From 708bbe12c5817e380c83d0c49bf684b0fc5d0024 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 17 Aug 2021 12:31:37 +0200 Subject: [PATCH 072/896] fix(cli): fix multiple errors in `plugin disable/enable` --- lib/cli.zsh | 43 ++++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/lib/cli.zsh b/lib/cli.zsh index 1289df730..e490149e0 100644 --- a/lib/cli.zsh +++ b/lib/cli.zsh @@ -230,9 +230,9 @@ function _omz::plugin::disable { local awk_script=" # if plugins=() is in oneline form, substitute disabled plugins and go to next line /^\s*plugins=\([^#]+\).*\$/ { - sub(/\s+(${(j:|:)dis_plugins})/, \"\") # with spaces before - sub(/(${(j:|:)dis_plugins})\s+/, \"\") # with spaces after - sub(/\((${(j:|:)dis_plugins})\)/, \"\") # without spaces (only plugin) + gsub(/\s+(${(j:|:)dis_plugins})/, \"\") # with spaces before + gsub(/(${(j:|:)dis_plugins})\s+/, \"\") # with spaces after + gsub(/\((${(j:|:)dis_plugins})\)/, \"\") # without spaces (only plugin) print \$0 next } @@ -240,9 +240,9 @@ function _omz::plugin::disable { # if plugins=() is in multiline form, enable multi flag and disable plugins if they're there /^\s*plugins=\(/ { multi=1 - sub(/\s+(${(j:|:)dis_plugins})/, \"\") - sub(/(${(j:|:)dis_plugins})\s+/, \"\") - sub(/\((${(j:|:)dis_plugins})\)/, \"\") + gsub(/\s+(${(j:|:)dis_plugins})/, \"\") + gsub(/(${(j:|:)dis_plugins})\s+/, \"\") + gsub(/\((${(j:|:)dis_plugins})\)/, \"\") print \$0 next } @@ -251,17 +251,17 @@ function _omz::plugin::disable { # add new plugins and disable multi flag multi == 1 && /^[^#]*\)/ { multi=0 - sub(/\s+(${(j:|:)dis_plugins})/, \"\") - sub(/(${(j:|:)dis_plugins})\s+/, \"\") - sub(/\((${(j:|:)dis_plugins})\)/, \"\") + gsub(/\s+(${(j:|:)dis_plugins})/, \"\") + gsub(/(${(j:|:)dis_plugins})\s+/, \"\") + gsub(/\((${(j:|:)dis_plugins})\)/, \"\") print \$0 next } multi == 1 { - sub(/\s+(${(j:|:)dis_plugins})/, \"\") - sub(/(${(j:|:)dis_plugins})\s+/, \"\") - sub(/\((${(j:|:)dis_plugins})\)/, \"\") + gsub(/\s+(${(j:|:)dis_plugins})/, \"\") + gsub(/(${(j:|:)dis_plugins})\s+/, \"\") + gsub(/\((${(j:|:)dis_plugins})\)/, \"\") print \$0 next } @@ -283,13 +283,13 @@ multi == 1 { # Exit if the new .zshrc file has syntax errors if ! zsh -n ~/.zshrc; then _omz::log error "broken syntax in ~/.zshrc. Rolling back changes..." - mv ~/.zshrc ~/.zshrc.disabled - mv ~/.zshrc.swp ~/.zshrc + command mv -f ~/.zshrc ~/.zshrc.disabled + command mv -f ~/.zshrc.swp ~/.zshrc return 1 fi # Restart the zsh session if there were no errors - _omz::log info "" + _omz::log info "plugins disabled: ${(j:, :)dis_plugins}." # Old zsh versions don't have ZSH_ARGZERO local zsh="${ZSH_ARGZERO:-${functrace[-1]%:*}}" @@ -344,26 +344,27 @@ multi == 1 && /^[^#]*\)/ { { print \$0 } " - awk "$awk_script" ~/.zshrc > ~/.zshrc.disabled \ - && mv ~/.zshrc ~/.zshrc.swp \ - && mv ~/.zshrc.disabled ~/.zshrc + awk "$awk_script" ~/.zshrc > ~/.zshrc.enabled \ + && command mv -f ~/.zshrc ~/.zshrc.swp \ + && command mv -f ~/.zshrc.enabled ~/.zshrc # Exit if the new .zshrc file wasn't created correctly [[ $? -eq 0 ]] || { local ret=$? - _omz::log error "error disabling plugins." + _omz::log error "error enabling plugins." return $ret } # Exit if the new .zshrc file has syntax errors if ! zsh -n ~/.zshrc; then _omz::log error "broken syntax in ~/.zshrc. Rolling back changes..." - mv ~/.zshrc ~/.zshrc.disabled - mv ~/.zshrc.swp ~/.zshrc + command mv -f ~/.zshrc ~/.zshrc.enabled + command mv -f ~/.zshrc.swp ~/.zshrc return 1 fi # Restart the zsh session if there were no errors + _omz::log info "plugins enabled: ${(j:, :)add_plugins}." # Old zsh versions don't have ZSH_ARGZERO local zsh="${ZSH_ARGZERO:-${functrace[-1]%:*}}" From bf888680ea5b7161cf1d06011df33bfbeda8b255 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 17 Aug 2021 12:38:48 +0200 Subject: [PATCH 073/896] refactor(cli): extract substitution awk script in `plugin disable` --- lib/cli.zsh | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/lib/cli.zsh b/lib/cli.zsh index e490149e0..a10b0e147 100644 --- a/lib/cli.zsh +++ b/lib/cli.zsh @@ -226,13 +226,17 @@ function _omz::plugin::disable { return 1 fi + # Remove plugins substitution awk script + local awk_subst_plugins="\ + gsub(/\s+(${(j:|:)dis_plugins})/, \"\") # with spaces before + gsub(/(${(j:|:)dis_plugins})\s+/, \"\") # with spaces after + gsub(/\((${(j:|:)dis_plugins})\)/, \"\") # without spaces (only plugin) +" # Disable plugins awk script local awk_script=" # if plugins=() is in oneline form, substitute disabled plugins and go to next line /^\s*plugins=\([^#]+\).*\$/ { - gsub(/\s+(${(j:|:)dis_plugins})/, \"\") # with spaces before - gsub(/(${(j:|:)dis_plugins})\s+/, \"\") # with spaces after - gsub(/\((${(j:|:)dis_plugins})\)/, \"\") # without spaces (only plugin) + $awk_subst_plugins print \$0 next } @@ -240,29 +244,22 @@ function _omz::plugin::disable { # if plugins=() is in multiline form, enable multi flag and disable plugins if they're there /^\s*plugins=\(/ { multi=1 - gsub(/\s+(${(j:|:)dis_plugins})/, \"\") - gsub(/(${(j:|:)dis_plugins})\s+/, \"\") - gsub(/\((${(j:|:)dis_plugins})\)/, \"\") + $awk_subst_plugins print \$0 next } -# if multi flag is enabled and we find a valid closing parenthesis, -# add new plugins and disable multi flag +# if multi flag is enabled and we find a valid closing parenthesis, remove plugins and disable multi flag multi == 1 && /^[^#]*\)/ { multi=0 - gsub(/\s+(${(j:|:)dis_plugins})/, \"\") - gsub(/(${(j:|:)dis_plugins})\s+/, \"\") - gsub(/\((${(j:|:)dis_plugins})\)/, \"\") + $awk_subst_plugins print \$0 next } -multi == 1 { - gsub(/\s+(${(j:|:)dis_plugins})/, \"\") - gsub(/(${(j:|:)dis_plugins})\s+/, \"\") - gsub(/\((${(j:|:)dis_plugins})\)/, \"\") - print \$0 +multi == 1 && length(\$0) > 0 { + $awk_subst_plugins + if (length(\$0) > 0) print \$0 next } From bc7ce982ddcabdb7a6d446207ef4a0b78920da8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 17 Aug 2021 12:53:09 +0200 Subject: [PATCH 074/896] style(cli): fill rows in column output in theme and plugin `list` commands --- lib/cli.zsh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/cli.zsh b/lib/cli.zsh index a10b0e147..6bdac6cf1 100644 --- a/lib/cli.zsh +++ b/lib/cli.zsh @@ -405,14 +405,14 @@ function _omz::plugin::list { if (( ${#custom_plugins} )); then print -P "%U%BCustom plugins%b%u:" - print -l ${(q-)custom_plugins} | column + print -l ${(q-)custom_plugins} | column -x fi if (( ${#builtin_plugins} )); then (( ${#custom_plugins} )) && echo # add a line of separation print -P "%U%BBuilt-in plugins%b%u:" - print -l ${(q-)builtin_plugins} | column + print -l ${(q-)builtin_plugins} | column -x fi } @@ -631,14 +631,14 @@ function _omz::theme::list { if (( ${#custom_themes} )); then print -P "%U%BCustom themes%b%u:" - print -l ${(q-)custom_themes} | column + print -l ${(q-)custom_themes} | column -x fi if (( ${#builtin_themes} )); then (( ${#custom_themes} )) && echo # add a line of separation print -P "%U%BBuilt-in themes%b%u:" - print -l ${(q-)builtin_themes} | column + print -l ${(q-)builtin_themes} | column -x fi } From ad1837859bedc5283b69cfcabee6d2ba5e4ee71e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 17 Aug 2021 16:35:42 +0200 Subject: [PATCH 075/896] fix(updater): fix reset ANSI escape code for resetting underline format --- tools/upgrade.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/upgrade.sh b/tools/upgrade.sh index 38fac3ce0..e9f8bc0f9 100755 --- a/tools/upgrade.sh +++ b/tools/upgrade.sh @@ -30,7 +30,7 @@ if [ -t 1 ]; then BOLD=$(printf '\033[1m') DIM=$(printf '\033[2m') UNDER=$(printf '\033[4m') - RESET=$(printf '\033[m') + RESET=$(printf '\033[0m') fi # Update upstream remote to ohmyzsh org From 7a4f4ad91e1f937b36a54703984b958abe9da4b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 17 Aug 2021 17:38:31 +0200 Subject: [PATCH 076/896] fix(lib): fix clipboard copy on Termux --- lib/clipboard.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/clipboard.zsh b/lib/clipboard.zsh index 122145f15..4e3ba0a45 100644 --- a/lib/clipboard.zsh +++ b/lib/clipboard.zsh @@ -76,7 +76,7 @@ function detect-clipboard() { function clipcopy() { win32yank -i < "${1:-/dev/stdin}"; } function clippaste() { win32yank -o; } elif [[ $OSTYPE == linux-android* ]] && (( $+commands[termux-clipboard-set] )); then - function clipcopy() { termux-clipboard-set "${1:-/dev/stdin}"; } + function clipcopy() { termux-clipboard-set < "${1:-/dev/stdin}"; } function clippaste() { termux-clipboard-get; } elif [ -n "${TMUX:-}" ] && (( ${+commands[tmux]} )); then function clipcopy() { tmux load-buffer "${1:--}"; } From 10f3e0d4d498c68109bafd711d0bae7f6fa44071 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 18 Aug 2021 11:43:29 +0200 Subject: [PATCH 077/896] docs(pyenv): document necessity to logout after PATH settings --- plugins/pyenv/pyenv.plugin.zsh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/pyenv/pyenv.plugin.zsh b/plugins/pyenv/pyenv.plugin.zsh index 813f64b42..275c12c80 100644 --- a/plugins/pyenv/pyenv.plugin.zsh +++ b/plugins/pyenv/pyenv.plugin.zsh @@ -30,7 +30,7 @@ if [[ $FOUND_PYENV -ne 1 ]]; then # If we found pyenv, load it but show a caveat about non-interactive shells if [[ $FOUND_PYENV -eq 1 ]]; then - cat <&2 < Date: Wed, 18 Aug 2021 11:47:50 +0200 Subject: [PATCH 078/896] fix(pyenv): fix for checking if pyenv-virtualenv is installed Fixes #8467 --- plugins/pyenv/pyenv.plugin.zsh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/pyenv/pyenv.plugin.zsh b/plugins/pyenv/pyenv.plugin.zsh index 275c12c80..bcf80a6a2 100644 --- a/plugins/pyenv/pyenv.plugin.zsh +++ b/plugins/pyenv/pyenv.plugin.zsh @@ -46,16 +46,20 @@ For more info go to https://github.com/pyenv/pyenv/#installation. EOF # Configuring in .zshrc only makes pyenv available for interactive shells - export PYENV_ROOT=$dir + export PYENV_ROOT="$dir" export PATH="$PYENV_ROOT/bin:$PATH" eval "$(pyenv init --path)" fi fi if [[ $FOUND_PYENV -eq 1 ]]; then + if [[ -z "$PYENV_ROOT" ]]; then + export PYENV_ROOT="$(pyenv root)" + fi + eval "$(pyenv init - --no-rehash zsh)" - if (( ${+commands[pyenv-virtualenv-init]} )); then + if [[ -d "$PYENV_ROOT/plugins/pyenv-virtualenv" ]]; then eval "$(pyenv virtualenv-init - zsh)" fi From 8dedf26294d4236ffe84260d30d686a705b0d2ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 18 Aug 2021 12:50:22 +0200 Subject: [PATCH 079/896] style(cli): print usage messages to stderr --- lib/cli.zsh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/cli.zsh b/lib/cli.zsh index 6bdac6cf1..b49643339 100644 --- a/lib/cli.zsh +++ b/lib/cli.zsh @@ -150,7 +150,7 @@ function _omz::log { ## User-facing commands function _omz::help { - cat <&2 < [options] Available commands: @@ -171,7 +171,7 @@ function _omz::changelog { if ! command git -C "$ZSH" show-ref --verify refs/heads/$version &>/dev/null && \ ! command git -C "$ZSH" show-ref --verify refs/tags/$version &>/dev/null && \ ! command git -C "$ZSH" rev-parse --verify "${version}^{commit}" &>/dev/null; then - cat <&2 < must be a valid branch, tag or commit. @@ -184,7 +184,7 @@ EOF function _omz::plugin { (( $# > 0 && $+functions[_omz::plugin::$1] )) || { - cat <&2 < [options] Available commands: @@ -468,7 +468,7 @@ function _omz::plugin::load { function _omz::pr { (( $# > 0 && $+functions[_omz::pr::$1] )) || { - cat <&2 < [options] Available commands: @@ -600,7 +600,7 @@ function _omz::pr::test { function _omz::theme { (( $# > 0 && $+functions[_omz::theme::$1] )) || { - cat <&2 < [options] Available commands: From cbb534267aca09fd123635fc39a7d00c0e21a5f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 18 Aug 2021 16:57:56 +0200 Subject: [PATCH 080/896] feat(cli): add `theme set` subcommand to change theme in .zshrc Fixes #9087 --- lib/cli.zsh | 98 +++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 83 insertions(+), 15 deletions(-) diff --git a/lib/cli.zsh b/lib/cli.zsh index b49643339..2189e24ca 100644 --- a/lib/cli.zsh +++ b/lib/cli.zsh @@ -45,9 +45,9 @@ function _omz { 'load:Load plugin(s)' ) _describe 'command' subcmds ;; - pr) subcmds=('test:Test a Pull Request' 'clean:Delete all Pull Request branches') + pr) subcmds=('clean:Delete all Pull Request branches' 'test:Test a Pull Request') _describe 'command' subcmds ;; - theme) subcmds=('use:Load a theme' 'list:List themes') + theme) subcmds=('list:List themes' 'set:Set a theme in your .zshrc file' 'use:Load a theme') _describe 'command' subcmds ;; esac elif (( CURRENT == 4 )); then @@ -68,7 +68,7 @@ function _omz { plugin::info) local -aU plugins=("$ZSH"/plugins/*/{_*,*.plugin.zsh}(.N:h:t) "$ZSH_CUSTOM"/plugins/*/{_*,*.plugin.zsh}(.N:h:t)) _describe 'plugin' plugins ;; - theme::use) + theme::(set|use)) local -aU themes=("$ZSH"/themes/*.zsh-theme(.N:t:r) "$ZSH_CUSTOM"/**/*.zsh-theme(.N:r:gs:"$ZSH_CUSTOM"/themes/:::gs:"$ZSH_CUSTOM"/:::)) _describe 'theme' themes ;; esac @@ -266,9 +266,9 @@ multi == 1 && length(\$0) > 0 { { print \$0 } " - awk "$awk_script" ~/.zshrc > ~/.zshrc.disabled \ - && mv ~/.zshrc ~/.zshrc.swp \ - && mv ~/.zshrc.disabled ~/.zshrc + awk "$awk_script" ~/.zshrc > ~/.zshrc.new \ + && command mv -f ~/.zshrc ~/.zshrc.bck \ + && command mv -f ~/.zshrc.new ~/.zshrc # Exit if the new .zshrc file wasn't created correctly [[ $? -eq 0 ]] || { @@ -280,8 +280,8 @@ multi == 1 && length(\$0) > 0 { # Exit if the new .zshrc file has syntax errors if ! zsh -n ~/.zshrc; then _omz::log error "broken syntax in ~/.zshrc. Rolling back changes..." - command mv -f ~/.zshrc ~/.zshrc.disabled - command mv -f ~/.zshrc.swp ~/.zshrc + command mv -f ~/.zshrc ~/.zshrc.new + command mv -f ~/.zshrc.bck ~/.zshrc return 1 fi @@ -341,9 +341,9 @@ multi == 1 && /^[^#]*\)/ { { print \$0 } " - awk "$awk_script" ~/.zshrc > ~/.zshrc.enabled \ - && command mv -f ~/.zshrc ~/.zshrc.swp \ - && command mv -f ~/.zshrc.enabled ~/.zshrc + awk "$awk_script" ~/.zshrc > ~/.zshrc.new \ + && command mv -f ~/.zshrc ~/.zshrc.bck \ + && command mv -f ~/.zshrc.new ~/.zshrc # Exit if the new .zshrc file wasn't created correctly [[ $? -eq 0 ]] || { @@ -355,8 +355,8 @@ multi == 1 && /^[^#]*\)/ { # Exit if the new .zshrc file has syntax errors if ! zsh -n ~/.zshrc; then _omz::log error "broken syntax in ~/.zshrc. Rolling back changes..." - command mv -f ~/.zshrc ~/.zshrc.enabled - command mv -f ~/.zshrc.swp ~/.zshrc + command mv -f ~/.zshrc ~/.zshrc.new + command mv -f ~/.zshrc.bck ~/.zshrc return 1 fi @@ -606,7 +606,8 @@ Usage: omz theme [options] Available commands: list List all available Oh My Zsh themes - use Load an Oh My Zsh theme + set Set a theme in your .zshrc file + use Load a theme EOF return 1 @@ -642,6 +643,73 @@ function _omz::theme::list { fi } +function _omz::theme::set { + if [[ -z "$1" ]]; then + echo >&2 "Usage: omz theme set " + return 1 + fi + + # Check that theme exists + if [[ ! -f "$ZSH_CUSTOM/$1.zsh-theme" ]] \ + && [[ ! -f "$ZSH_CUSTOM/themes/$1.zsh-theme" ]] \ + && [[ ! -f "$ZSH/themes/$1.zsh-theme" ]]; then + _omz::log error "%B$1%b theme not found" + return 1 + fi + + # Enable theme in .zshrc + local awk_script=' +!set && /^\s*ZSH_THEME=[^#]+.*$/ { + set=1 + sub(/^\s*ZSH_THEME=[^#]+.*$/, "ZSH_THEME=\"'$1'\" # set by `omz`") + print $0 + next +} + +{ print $0 } + +END { + # If no ZSH_THEME= line was found, return an error + if (!set) exit 1 +} +' + + awk "$awk_script" ~/.zshrc > ~/.zshrc.new \ + || { + # Prepend ZSH_THEME= line to .zshrc if it doesn't exist + cat < ~/.zshrc.new \ + && command mv -f ~/.zshrc ~/.zshrc.bck \ + && command mv -f ~/.zshrc.new ~/.zshrc + + # Exit if the new .zshrc file wasn't created correctly + [[ $? -eq 0 ]] || { + local ret=$? + _omz::log error "error setting theme." + return $ret + } + + # Exit if the new .zshrc file has syntax errors + if ! zsh -n ~/.zshrc; then + _omz::log error "broken syntax in ~/.zshrc. Rolling back changes..." + command mv -f ~/.zshrc ~/.zshrc.new + command mv -f ~/.zshrc.bck ~/.zshrc + return 1 + fi + + # Restart the zsh session if there were no errors + _omz::log info "'$1' theme set correctly." + + # Old zsh versions don't have ZSH_ARGZERO + local zsh="${ZSH_ARGZERO:-${functrace[-1]%:*}}" + # Check whether to run a login shell + [[ "$zsh" = -* || -o login ]] && exec -l "${zsh#-}" || exec "$zsh" +} + function _omz::theme::use { if [[ -z "$1" ]]; then echo >&2 "Usage: omz theme use " @@ -656,7 +724,7 @@ function _omz::theme::use { elif [[ -f "$ZSH/themes/$1.zsh-theme" ]]; then source "$ZSH/themes/$1.zsh-theme" else - _omz::log error "theme '$1' not found" + _omz::log error "%B$1%b theme not found" return 1 fi } From 6d5b8484ce7198161d5f617c3db9fd7d3833d48c Mon Sep 17 00:00:00 2001 From: Ilya Bizyaev Date: Fri, 20 Aug 2021 13:25:58 +0300 Subject: [PATCH 081/896] fix(suse): avoid refresh attempts for Zypper queries (#9798) --- plugins/suse/README.md | 10 ++++++++-- plugins/suse/suse.plugin.zsh | 20 ++++++++++---------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/plugins/suse/README.md b/plugins/suse/README.md index b9b069574..06c6d9ef5 100644 --- a/plugins/suse/README.md +++ b/plugins/suse/README.md @@ -2,9 +2,9 @@ **Maintainer**: [r-darwish](https://github.com/r-darwish) - Alias for Zypper according to the official Zypper's alias +Alias for Zypper according to the official Zypper's alias - To use it add `suse` to the plugins array in you zshrc file. +To use it add `suse` to the plugins array in you zshrc file. ```zsh plugins=(... suse) @@ -60,6 +60,12 @@ plugins=(... suse) | zse | `zypper se` | search for packages | | zwp | `zypper wp` | list all packages providing the specified capability | +NOTE: `--no-refresh` is passed to zypper for speeding up the calls and avoid errors due to lack +of root privileges. If you need to refresh the repositories, call `sudo zypper ref` (`zref` alias) +before runing these aliases. + +Related: [#9798](https://github.com/ohmyzsh/ohmyzsh/pull/9798). + ## Repositories commands | Alias | Commands | Description | diff --git a/plugins/suse/suse.plugin.zsh b/plugins/suse/suse.plugin.zsh index dcfeccb03..56bc6f1c5 100644 --- a/plugins/suse/suse.plugin.zsh +++ b/plugins/suse/suse.plugin.zsh @@ -25,16 +25,16 @@ alias zup='sudo zypper up' alias zpatch='sudo zypper patch' #Request commands -alias zif='zypper if' -alias zpa='zypper pa' -alias zpatch-info='zypper patch-info' -alias zpattern-info='zypper pattern-info' -alias zproduct-info='zypper product-info' -alias zpch='zypper pch' -alias zpd='zypper pd' -alias zpt='zypper pt' -alias zse='zypper se' -alias zwp='zypper wp' +alias zif='zypper --no-refresh if' +alias zpa='zypper --no-refresh pa' +alias zpatch-info='zypper --no-refresh patch-info' +alias zpattern-info='zypper --no-refresh pattern-info' +alias zproduct-info='zypper --no-refresh product-info' +alias zpch='zypper --no-refresh pch' +alias zpd='zypper --no-refresh pd' +alias zpt='zypper --no-refresh pt' +alias zse='zypper --no-refresh se' +alias zwp='zypper --no-refresh wp' #Repositories commands alias zar='sudo zypper ar' From e13ff75f38200b03b26f798991b3ecf30e547d82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20=C3=96hrn?= Date: Tue, 24 Aug 2021 19:19:29 +0200 Subject: [PATCH 082/896] fix(kubectx): show plain context if not mapped (#10134) --- plugins/kubectx/kubectx.plugin.zsh | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/plugins/kubectx/kubectx.plugin.zsh b/plugins/kubectx/kubectx.plugin.zsh index 56b7217f1..abbdc254b 100644 --- a/plugins/kubectx/kubectx.plugin.zsh +++ b/plugins/kubectx/kubectx.plugin.zsh @@ -3,12 +3,7 @@ typeset -A kubectx_mapping function kubectx_prompt_info() { if [ $commands[kubectl] ]; then local current_ctx=`kubectl config current-context` - - #if associative array declared - if [[ -n $kubectx_mapping ]]; then - echo "${kubectx_mapping[$current_ctx]}" - else - echo $current_ctx - fi + # use value in associative array if it exists, otherwise fall back to the context name + echo "${kubectx_mapping[$current_ctx]:-$current_ctx}" fi } From c47ac2d86d1aec3dcc3106c58d3ef0a91aa8cc3c Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Wed, 25 Aug 2021 10:25:26 +0200 Subject: [PATCH 083/896] feat(mlh): let users configure the official MLH theme (#9997) --- themes/mlh.zsh-theme | 51 +++++++++++++++++++++++++++++++++----------- 1 file changed, 39 insertions(+), 12 deletions(-) diff --git a/themes/mlh.zsh-theme b/themes/mlh.zsh-theme index 33f238ed9..baff3fb63 100644 --- a/themes/mlh.zsh-theme +++ b/themes/mlh.zsh-theme @@ -12,17 +12,40 @@ # # # Feel free to customize! # # # # # # # # # # # # # # # # # # # # # +# To customize symbols (e.g MLH_AT_SYMBOL), simply set them as environment variables +# for example in your ~/.zshrc file, like this: +# MLH_AT_SYMBOL=" at " +# +# Settings *must* be set before sourcing oh-my-zsh.sh the .zshrc file. +# # To easily discover colors and their codes, type `spectrum_ls` in the terminal -# enable or disable particular elements -PRINT_EXIT_CODE=true -PRINT_TIME=true +# right prompt default settings +if [ -z "$MLH_PRINT_EXIT_CODE" ]; then + MLH_PRINT_EXIT_CODE=true +fi -# symbols -AT_SYMBOL=" @ " -IN_SYMBOL=" in " -ON_SYMBOL=" on " -SHELL_SYMBOL="$" +if [ -z "$MLH_PRINT_TIME" ]; then + MLH_PRINT_TIME=false +fi + +# left prompt symbols default settings + +if [ -z "$MLH_AT_SYMBOL" ]; then + MLH_AT_SYMBOL="@" +fi + +if [ -z "$MLH_IN_SYMBOL" ]; then + MLH_IN_SYMBOL=" in " +fi + +if [ -z "$MLH_ON_SYMBOL" ]; then + MLH_ON_SYMBOL=" on " +fi + +if [ -z "$MLH_SHELL_SYMBOL" ]; then + MLH_SHELL_SYMBOL="$ " +fi # colors USER_COLOR="%F{001}" @@ -47,24 +70,28 @@ directory() { # Prints current time current_time() { - if [ "$PRINT_TIME" = true ]; then + if [ "$MLH_PRINT_TIME" = true ]; then echo " $TIME_COLOR%*%f" fi } # Prints exit code of the last executed command exit_code() { - if [ "$PRINT_EXIT_CODE" = true ]; then + if [ "$MLH_PRINT_EXIT_CODE" = true ]; then echo "%(?..%F{001}exit %?)%f" fi } +prompt_end() { + printf "\n$MLH_SHELL_SYMBOL" +} + # Set git_prompt_info text -ZSH_THEME_GIT_PROMPT_PREFIX="${ON_SYMBOL}${BRANCH_COLOR}" +ZSH_THEME_GIT_PROMPT_PREFIX="${MLH_ON_SYMBOL}${BRANCH_COLOR}" ZSH_THEME_GIT_PROMPT_SUFFIX="%f" ZSH_THEME_GIT_PROMPT_DIRTY="" ZSH_THEME_GIT_PROMPT_CLEAN="" # %B and %b make the text bold -PROMPT='%b$(username)$AT_SYMBOL$(device)$IN_SYMBOL$(directory)$(git_prompt_info)%b $SHELL_SYMBOL ' +PROMPT='%b$(username)$MLH_AT_SYMBOL$(device)$MLH_IN_SYMBOL$(directory)$(git_prompt_info)%b$(prompt_end)' RPROMPT="$(exit_code)$(current_time)" From 5a9d9553cd6861d80cc958132ab5af40fe661ac4 Mon Sep 17 00:00:00 2001 From: Simone Gaiarin Date: Thu, 26 Aug 2021 11:42:17 +0200 Subject: [PATCH 084/896] feat(ssh-agent): allow using external helper to ask for passwords (#7631) --- plugins/ssh-agent/README.md | 9 ++ plugins/ssh-agent/ssh-agent.plugin.zsh | 128 ++++++++++++++----------- 2 files changed, 83 insertions(+), 54 deletions(-) diff --git a/plugins/ssh-agent/README.md b/plugins/ssh-agent/README.md index 8765a9c7e..f46e8bf6a 100644 --- a/plugins/ssh-agent/README.md +++ b/plugins/ssh-agent/README.md @@ -55,6 +55,15 @@ ssh-add -K -c -a /run/user/1000/ssh-auth For valid `ssh-add` arguments run `ssh-add --help` or `man ssh-add`. +---- + +To set an **external helper** to ask for the passwords and possibly store +them in the system keychain use the `helper` style. For example: + +```zsh +zstyle :omz:plugins:ssh-agent helper ksshaskpass +``` + ## Credits Based on code from Joseph M. Reagle: https://www.cygwin.com/ml/cygwin/2001-06/msg00537.html diff --git a/plugins/ssh-agent/ssh-agent.plugin.zsh b/plugins/ssh-agent/ssh-agent.plugin.zsh index d45406f63..9bc2e8a21 100644 --- a/plugins/ssh-agent/ssh-agent.plugin.zsh +++ b/plugins/ssh-agent/ssh-agent.plugin.zsh @@ -1,56 +1,76 @@ typeset _agent_forwarding _ssh_env_cache function _start_agent() { - local lifetime - zstyle -s :omz:plugins:ssh-agent lifetime lifetime + local lifetime + zstyle -s :omz:plugins:ssh-agent lifetime lifetime - # start ssh-agent and setup environment - echo Starting ssh-agent... - ssh-agent -s ${lifetime:+-t} ${lifetime} | sed 's/^echo/#echo/' >! $_ssh_env_cache - chmod 600 $_ssh_env_cache - . $_ssh_env_cache > /dev/null + # start ssh-agent and setup environment + echo Starting ssh-agent... + ssh-agent -s ${lifetime:+-t} ${lifetime} | sed 's/^echo/#echo/' >! $_ssh_env_cache + chmod 600 $_ssh_env_cache + . $_ssh_env_cache > /dev/null } function _add_identities() { - local id line sig lines - local -a identities loaded_sigs loaded_ids not_loaded - zstyle -a :omz:plugins:ssh-agent identities identities + local id line sig lines + local -a identities loaded_sigs loaded_ids not_loaded + zstyle -a :omz:plugins:ssh-agent identities identities - # check for .ssh folder presence - if [[ ! -d $HOME/.ssh ]]; then - return - fi + # check for .ssh folder presence + if [[ ! -d $HOME/.ssh ]]; then + return + fi - # add default keys if no identities were set up via zstyle - # this is to mimic the call to ssh-add with no identities - if [[ ${#identities} -eq 0 ]]; then - # key list found on `ssh-add` man page's DESCRIPTION section - for id in id_rsa id_dsa id_ecdsa id_ed25519 identity; do - # check if file exists - [[ -f "$HOME/.ssh/$id" ]] && identities+=$id - done - fi + # add default keys if no identities were set up via zstyle + # this is to mimic the call to ssh-add with no identities + if [[ ${#identities} -eq 0 ]]; then + # key list found on `ssh-add` man page's DESCRIPTION section + for id in id_rsa id_dsa id_ecdsa id_ed25519 identity; do + # check if file exists + [[ -f "$HOME/.ssh/$id" ]] && identities+=($id) + done + fi - # get list of loaded identities' signatures and filenames - if lines=$(ssh-add -l); then - for line in ${(f)lines}; do - loaded_sigs+=${${(z)line}[2]} - loaded_ids+=${${(z)line}[3]} - done - fi + # get list of loaded identities' signatures and filenames + if lines=$(ssh-add -l); then + for line in ${(f)lines}; do + loaded_sigs+=${${(z)line}[2]} + loaded_ids+=${${(z)line}[3]} + done + fi - # add identities if not already loaded - for id in $identities; do - # check for filename match, otherwise try for signature match - if [[ ${loaded_ids[(I)$HOME/.ssh/$id]} -le 0 ]]; then - sig="$(ssh-keygen -lf "$HOME/.ssh/$id" | awk '{print $2}')" - [[ ${loaded_sigs[(I)$sig]} -le 0 ]] && not_loaded+="$HOME/.ssh/$id" - fi - done + # add identities if not already loaded + for id in $identities; do + # check for filename match, otherwise try for signature match + if [[ ${loaded_ids[(I)$HOME/.ssh/$id]} -le 0 ]]; then + sig="$(ssh-keygen -lf "$HOME/.ssh/$id" | awk '{print $2}')" + [[ ${loaded_sigs[(I)$sig]} -le 0 ]] && not_loaded+=("$HOME/.ssh/$id") + fi + done - local args - zstyle -a :omz:plugins:ssh-agent ssh-add-args args - [[ -n "$not_loaded" ]] && ssh-add "${args[@]}" ${^not_loaded} + # abort if no identities need to be loaded + if [[ ${#not_loaded} -eq 0 ]]; then + return + fi + + # pass extra arguments to ssh-add + local args + zstyle -a :omz:plugins:ssh-agent ssh-add-args args + + # use user specified helper to ask for password (ksshaskpass, etc) + local helper + zstyle -s :omz:plugins:ssh-agent helper helper + + if [[ -n "$helper" ]]; then + if [[ -z "${commands[$helper]}" ]]; then + echo "ssh-agent: the helper '$helper' has not been found." + else + SSH_ASKPASS="$helper" ssh-add "${args[@]}" ${^not_loaded} < /dev/null + return $? + fi + fi + + ssh-add "${args[@]}" ${^not_loaded} } # Get the filename to store/lookup the environment from @@ -60,21 +80,21 @@ _ssh_env_cache="$HOME/.ssh/environment-$SHORT_HOST" zstyle -b :omz:plugins:ssh-agent agent-forwarding _agent_forwarding if [[ $_agent_forwarding == "yes" && -n "$SSH_AUTH_SOCK" ]]; then - # Add a nifty symlink for screen/tmux if agent forwarding - [[ -L $SSH_AUTH_SOCK ]] || ln -sf "$SSH_AUTH_SOCK" /tmp/ssh-agent-$USERNAME-screen + # Add a nifty symlink for screen/tmux if agent forwarding + [[ -L $SSH_AUTH_SOCK ]] || ln -sf "$SSH_AUTH_SOCK" /tmp/ssh-agent-$USERNAME-screen elif [[ -f "$_ssh_env_cache" ]]; then - # Source SSH settings, if applicable - . $_ssh_env_cache > /dev/null - if [[ $USERNAME == "root" ]]; then - FILTER="ax" - else - FILTER="x" - fi - ps $FILTER | grep ssh-agent | grep -q $SSH_AGENT_PID || { - _start_agent - } + # Source SSH settings, if applicable + . $_ssh_env_cache > /dev/null + if [[ $USERNAME == "root" ]]; then + FILTER="ax" + else + FILTER="x" + fi + ps $FILTER | grep ssh-agent | grep -q $SSH_AGENT_PID || { + _start_agent + } else - _start_agent + _start_agent fi _add_identities From 7692881d2a61a4ba47eeef5d7827c0d2cb896def Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Thu, 26 Aug 2021 12:14:53 +0200 Subject: [PATCH 085/896] feat(ssh-agent): only start ssh-agent once (#5359) Close #5359 Close #7379 Co-authored-by: Will Andrews Co-authored-by: zhangyc --- plugins/ssh-agent/ssh-agent.plugin.zsh | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/plugins/ssh-agent/ssh-agent.plugin.zsh b/plugins/ssh-agent/ssh-agent.plugin.zsh index 9bc2e8a21..acad4e83e 100644 --- a/plugins/ssh-agent/ssh-agent.plugin.zsh +++ b/plugins/ssh-agent/ssh-agent.plugin.zsh @@ -1,5 +1,3 @@ -typeset _agent_forwarding _ssh_env_cache - function _start_agent() { local lifetime zstyle -s :omz:plugins:ssh-agent lifetime lifetime @@ -97,7 +95,23 @@ else _start_agent fi -_add_identities +() { + emulate -L zsh + + command mkdir "$ZSH_CACHE_DIR/ssh-agent.lock" 2>/dev/null || return + + trap " + ret=\$? + + command rm -rf '$ZSH_CACHE_DIR/ssh-agent.lock' + unset _agent_forwarding _ssh_env_cache + unfunction _start_agent _add_identities 2>/dev/null + + return \$ret + " EXIT INT QUIT + + _add_identities +} # tidy up after ourselves unset _agent_forwarding _ssh_env_cache From 3f0672ff946a508329e382261e6eb8f837106e38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Thu, 26 Aug 2021 12:40:16 +0200 Subject: [PATCH 086/896] refactor(ssh-agent): clean up and reorganize code --- plugins/ssh-agent/ssh-agent.plugin.zsh | 47 +++++++++++++------------- 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/plugins/ssh-agent/ssh-agent.plugin.zsh b/plugins/ssh-agent/ssh-agent.plugin.zsh index acad4e83e..2049145fd 100644 --- a/plugins/ssh-agent/ssh-agent.plugin.zsh +++ b/plugins/ssh-agent/ssh-agent.plugin.zsh @@ -1,12 +1,25 @@ +# Get the filename to store/lookup the environment from +ssh_env_cache="$HOME/.ssh/environment-$SHORT_HOST" + function _start_agent() { + # Check if ssh-agent is already running + if [[ -f "$ssh_env_cache" ]]; then + . "$ssh_env_cache" > /dev/null + + { + [[ "$USERNAME" = root ]] && command ps ax || command ps x + } | command grep ssh-agent | command grep -q $SSH_AGENT_PID && return 0 + fi + + # Set a maximum lifetime for identities added to ssh-agent local lifetime zstyle -s :omz:plugins:ssh-agent lifetime lifetime # start ssh-agent and setup environment echo Starting ssh-agent... - ssh-agent -s ${lifetime:+-t} ${lifetime} | sed 's/^echo/#echo/' >! $_ssh_env_cache - chmod 600 $_ssh_env_cache - . $_ssh_env_cache > /dev/null + ssh-agent -s ${lifetime:+-t} ${lifetime} | sed '/^echo/d' >! "$ssh_env_cache" + chmod 600 "$ssh_env_cache" + . "$ssh_env_cache" > /dev/null } function _add_identities() { @@ -71,26 +84,12 @@ function _add_identities() { ssh-add "${args[@]}" ${^not_loaded} } -# Get the filename to store/lookup the environment from -_ssh_env_cache="$HOME/.ssh/environment-$SHORT_HOST" - # test if agent-forwarding is enabled -zstyle -b :omz:plugins:ssh-agent agent-forwarding _agent_forwarding +zstyle -b :omz:plugins:ssh-agent agent-forwarding agent_forwarding -if [[ $_agent_forwarding == "yes" && -n "$SSH_AUTH_SOCK" ]]; then - # Add a nifty symlink for screen/tmux if agent forwarding - [[ -L $SSH_AUTH_SOCK ]] || ln -sf "$SSH_AUTH_SOCK" /tmp/ssh-agent-$USERNAME-screen -elif [[ -f "$_ssh_env_cache" ]]; then - # Source SSH settings, if applicable - . $_ssh_env_cache > /dev/null - if [[ $USERNAME == "root" ]]; then - FILTER="ax" - else - FILTER="x" - fi - ps $FILTER | grep ssh-agent | grep -q $SSH_AGENT_PID || { - _start_agent - } +# Add a nifty symlink for screen/tmux if agent forwarding +if [[ $agent_forwarding = "yes" && -n "$SSH_AUTH_SOCK" && ! -L "$SSH_AUTH_SOCK" ]]; then + ln -sf "$SSH_AUTH_SOCK" /tmp/ssh-agent-$USERNAME-screen else _start_agent fi @@ -104,15 +103,15 @@ fi ret=\$? command rm -rf '$ZSH_CACHE_DIR/ssh-agent.lock' - unset _agent_forwarding _ssh_env_cache + unset agent_forwarding ssh_env_cache unfunction _start_agent _add_identities 2>/dev/null return \$ret " EXIT INT QUIT _add_identities + } -# tidy up after ourselves -unset _agent_forwarding _ssh_env_cache +unset agent_forwarding ssh_env_cache unfunction _start_agent _add_identities From 0c590aba74f28e94f03eb918c07a90cf1a51f525 Mon Sep 17 00:00:00 2001 From: wl2776 Date: Fri, 27 Aug 2021 19:07:19 +0300 Subject: [PATCH 087/896] fix(git): fix `gbda` alias when there are no merged branches (#10005) --- plugins/git/README.md | 2 +- plugins/git/git.plugin.zsh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/git/README.md b/plugins/git/README.md index 522257d2d..48cf87204 100644 --- a/plugins/git/README.md +++ b/plugins/git/README.md @@ -23,7 +23,7 @@ plugins=(... git) | gb | git branch | | gba | git branch -a | | gbd | git branch -d | -| gbda | git branch --no-color --merged \| command grep -vE "^(\+\|\*\|\s*($(git_main_branch)\|$(git_develop_branch))\s*$)" \| command xargs -n 1 git branch -d | +| gbda | git branch --no-color --merged \| grep -vE "^([+*]\|\s*($(git_main_branch)\|$(git_develop_branch))\s*$)" \| xargs git branch -d 2>/dev/null | | 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 3cd558692..f0d9aaedc 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -73,7 +73,7 @@ alias gapt='git apply --3way' 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*($(git_main_branch)|$(git_develop_branch))\s*$)" | command xargs -n 1 git branch -d' +alias gbda='git branch --no-color --merged | command grep -vE "^([+*]|\s*($(git_main_branch)|$(git_develop_branch))\s*$)" | command xargs git branch -d 2>/dev/null' alias gbD='git branch -D' alias gbl='git blame -b -w' alias gbnm='git branch --no-merged' From 4a69ee575c9a8ec96fb6378fecae7777c7afba84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Thu, 26 Aug 2021 15:52:09 +0200 Subject: [PATCH 088/896] feat(ssh-agent): allow specifying absolute path to `identities` Fixes #9650 --- plugins/ssh-agent/README.md | 9 +++++++++ plugins/ssh-agent/ssh-agent.plugin.zsh | 12 +++++++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/plugins/ssh-agent/README.md b/plugins/ssh-agent/README.md index f46e8bf6a..d1a504b1e 100644 --- a/plugins/ssh-agent/README.md +++ b/plugins/ssh-agent/README.md @@ -27,6 +27,15 @@ To **load multiple identities** use the `identities` style, For example: zstyle :omz:plugins:ssh-agent identities id_rsa id_rsa2 id_github ``` +**NOTE:** the identities may be an absolute path if they are somewhere other than +`~/.ssh`. For example: + +```zsh +zstyle :omz:plugins:ssh-agent identities ~/.config/ssh/id_rsa ~/.config/ssh/id_rsa2 ~/.config/ssh/id_github +# which can be simplified to +zstyle :omz:plugins:ssh-agent identities ~/.config/ssh/{id_rsa,id_rsa2,id_github} +``` + ---- To **set the maximum lifetime of the identities**, use the `lifetime` style. diff --git a/plugins/ssh-agent/ssh-agent.plugin.zsh b/plugins/ssh-agent/ssh-agent.plugin.zsh index 2049145fd..c2b9546a2 100644 --- a/plugins/ssh-agent/ssh-agent.plugin.zsh +++ b/plugins/ssh-agent/ssh-agent.plugin.zsh @@ -23,12 +23,12 @@ function _start_agent() { } function _add_identities() { - local id line sig lines + local id file line sig lines local -a identities loaded_sigs loaded_ids not_loaded zstyle -a :omz:plugins:ssh-agent identities identities # check for .ssh folder presence - if [[ ! -d $HOME/.ssh ]]; then + if [[ ! -d "$HOME/.ssh" ]]; then return fi @@ -52,10 +52,12 @@ function _add_identities() { # add identities if not already loaded for id in $identities; do + # if id is an absolute path, make file equal to id + [[ "$id" = /* ]] && file="$id" || file="$HOME/.ssh/$id" # check for filename match, otherwise try for signature match - if [[ ${loaded_ids[(I)$HOME/.ssh/$id]} -le 0 ]]; then - sig="$(ssh-keygen -lf "$HOME/.ssh/$id" | awk '{print $2}')" - [[ ${loaded_sigs[(I)$sig]} -le 0 ]] && not_loaded+=("$HOME/.ssh/$id") + if [[ ${loaded_ids[(I)$file]} -le 0 ]]; then + sig="$(ssh-keygen -lf "$file" | awk '{print $2}')" + [[ ${loaded_sigs[(I)$sig]} -le 0 ]] && not_loaded+=("$file") fi done From a1847dc860b85a0f0d97126ffe4b9b3a5276d1c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Thu, 19 Aug 2021 17:20:52 +0200 Subject: [PATCH 089/896] style(sudo): apply main style guide indentation --- plugins/sudo/sudo.plugin.zsh | 70 ++++++++++++++++++------------------ 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/plugins/sudo/sudo.plugin.zsh b/plugins/sudo/sudo.plugin.zsh index f2445a762..f0a01bc1f 100644 --- a/plugins/sudo/sudo.plugin.zsh +++ b/plugins/sudo/sudo.plugin.zsh @@ -15,48 +15,48 @@ # ------------------------------------------------------------------------------ __sudo-replace-buffer() { - local old=$1 new=$2 space=${2:+ } - if [[ ${#LBUFFER} -le ${#old} ]]; then - RBUFFER="${space}${BUFFER#$old }" - LBUFFER="${new}" - else - LBUFFER="${new}${space}${LBUFFER#$old }" - fi + local old=$1 new=$2 space=${2:+ } + if [[ ${#LBUFFER} -le ${#old} ]]; then + RBUFFER="${space}${BUFFER#$old }" + LBUFFER="${new}" + else + LBUFFER="${new}${space}${LBUFFER#$old }" + fi } sudo-command-line() { - [[ -z $BUFFER ]] && LBUFFER="$(fc -ln -1)" + [[ -z $BUFFER ]] && LBUFFER="$(fc -ln -1)" - # Save beginning space - local WHITESPACE="" - if [[ ${LBUFFER:0:1} = " " ]]; then - WHITESPACE=" " - LBUFFER="${LBUFFER:1}" + # Save beginning space + local WHITESPACE="" + if [[ ${LBUFFER:0:1} = " " ]]; then + WHITESPACE=" " + LBUFFER="${LBUFFER:1}" + fi + + # Get the first part of the typed command and check if it's an alias to $EDITOR + # If so, locally change $EDITOR to the alias so that it matches below + if [[ -n "$EDITOR" ]]; then + local cmd="${${(Az)BUFFER}[1]}" + if [[ "${aliases[$cmd]} " = (\$EDITOR|$EDITOR)\ * ]]; then + local EDITOR="$cmd" fi + fi - # Get the first part of the typed command and check if it's an alias to $EDITOR - # If so, locally change $EDITOR to the alias so that it matches below - if [[ -n "$EDITOR" ]]; then - local cmd="${${(Az)BUFFER}[1]}" - if [[ "${aliases[$cmd]} " = (\$EDITOR|$EDITOR)\ * ]]; then - local EDITOR="$cmd" - fi - fi + if [[ -n $EDITOR && $BUFFER = $EDITOR\ * ]]; then + __sudo-replace-buffer "$EDITOR" "sudoedit" + elif [[ -n $EDITOR && $BUFFER = \$EDITOR\ * ]]; then + __sudo-replace-buffer "\$EDITOR" "sudoedit" + elif [[ $BUFFER = sudoedit\ * ]]; then + __sudo-replace-buffer "sudoedit" "$EDITOR" + elif [[ $BUFFER = sudo\ * ]]; then + __sudo-replace-buffer "sudo" "" + else + LBUFFER="sudo $LBUFFER" + fi - if [[ -n $EDITOR && $BUFFER = $EDITOR\ * ]]; then - __sudo-replace-buffer "$EDITOR" "sudoedit" - elif [[ -n $EDITOR && $BUFFER = \$EDITOR\ * ]]; then - __sudo-replace-buffer "\$EDITOR" "sudoedit" - elif [[ $BUFFER = sudoedit\ * ]]; then - __sudo-replace-buffer "sudoedit" "$EDITOR" - elif [[ $BUFFER = sudo\ * ]]; then - __sudo-replace-buffer "sudo" "" - else - LBUFFER="sudo $LBUFFER" - fi - - # Preserve beginning space - LBUFFER="${WHITESPACE}${LBUFFER}" + # Preserve beginning space + LBUFFER="${WHITESPACE}${LBUFFER}" } zle -N sudo-command-line From 190325049ef93731ab28295dbedf36d44ab33d7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Thu, 19 Aug 2021 18:20:57 +0200 Subject: [PATCH 090/896] fix(sudo): allow different $EDITOR settings and fix zsh-syntax-highlighting redraw --- plugins/sudo/sudo.plugin.zsh | 64 ++++++++++++++++++++++++++---------- 1 file changed, 46 insertions(+), 18 deletions(-) diff --git a/plugins/sudo/sudo.plugin.zsh b/plugins/sudo/sudo.plugin.zsh index f0a01bc1f..e02f88a87 100644 --- a/plugins/sudo/sudo.plugin.zsh +++ b/plugins/sudo/sudo.plugin.zsh @@ -25,6 +25,7 @@ __sudo-replace-buffer() { } sudo-command-line() { + # If line is empty, get the last run command from history [[ -z $BUFFER ]] && LBUFFER="$(fc -ln -1)" # Save beginning space @@ -34,29 +35,56 @@ sudo-command-line() { LBUFFER="${LBUFFER:1}" fi - # Get the first part of the typed command and check if it's an alias to $EDITOR - # If so, locally change $EDITOR to the alias so that it matches below - if [[ -n "$EDITOR" ]]; then - local cmd="${${(Az)BUFFER}[1]}" - if [[ "${aliases[$cmd]} " = (\$EDITOR|$EDITOR)\ * ]]; then - local EDITOR="$cmd" - fi - fi - - if [[ -n $EDITOR && $BUFFER = $EDITOR\ * ]]; then - __sudo-replace-buffer "$EDITOR" "sudoedit" - elif [[ -n $EDITOR && $BUFFER = \$EDITOR\ * ]]; then - __sudo-replace-buffer "\$EDITOR" "sudoedit" - elif [[ $BUFFER = sudoedit\ * ]]; then - __sudo-replace-buffer "sudoedit" "$EDITOR" - elif [[ $BUFFER = sudo\ * ]]; then - __sudo-replace-buffer "sudo" "" + # If $EDITOR is not set, just toggle the sudo prefix on and off + if [[ -z "$EDITOR" ]]; then + case "$BUFFER" in + sudoedit\ *) __sudo-replace-buffer "sudoedit" "" ;; + sudo\ *) __sudo-replace-buffer "sudo" "" ;; + *) LBUFFER="sudo $LBUFFER" ;; + esac else - LBUFFER="sudo $LBUFFER" + # Check if the typed command is really an alias to $EDITOR + + # Get the first part of the typed command + local cmd="${${(Az)BUFFER}[1]}" + # Get the first part of the alias of the same name as $cmd, or $cmd if no alias matches + local realcmd="${${(Az)aliases[$cmd]}[1]:-$cmd}" + # Get the first part of the $EDITOR command ($EDITOR may have arguments after it) + local editorcmd="${${(Az)EDITOR}[1]}" + + # Note: ${var:c} makes a $PATH search and expands $var to the full path + # The if condition is met when: + # - $realcmd is '$EDITOR' + # - $realcmd is "cmd" and $EDITOR is "cmd" + # - $realcmd is "cmd" and $EDITOR is "cmd --with --arguments" + # - $realcmd is "/path/to/cmd" and $EDITOR is "cmd" + # - $realcmd is "/path/to/cmd" and $EDITOR is "/path/to/cmd" + # or + # - $realcmd is "cmd" and $EDITOR is "cmd" + # - $realcmd is "cmd" and $EDITOR is "/path/to/cmd" + # or + # - $realcmd is "cmd" and $EDITOR is /alternative/path/to/cmd that appears in $PATH + if [[ "$realcmd" = (\$EDITOR|$editorcmd|${editorcmd:c}) \ + || "${realcmd:c}" = ($editorcmd|${editorcmd:c}) ]] \ + || builtin which -a "$realcmd" | command grep -Fx -q "$editorcmd"; then + editorcmd="$cmd" # replace $editorcmd with the typed command so it matches below + fi + + # Check for editor commands in the typed command and replace accordingly + case "$BUFFER" in + $editorcmd\ *) __sudo-replace-buffer "$editorcmd" "sudoedit" ;; + \$EDITOR\ *) __sudo-replace-buffer '$EDITOR' "sudoedit" ;; + sudoedit\ *) __sudo-replace-buffer "sudoedit" "$EDITOR" ;; + sudo\ *) __sudo-replace-buffer "sudo" "" ;; + *) LBUFFER="sudo $LBUFFER" ;; + esac fi # Preserve beginning space LBUFFER="${WHITESPACE}${LBUFFER}" + + # Redisplay edit buffer (compatibility with zsh-syntax-highlighting) + zle redisplay } zle -N sudo-command-line From 21b385e7bd522983642b52b51db5d4a210a77717 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Thu, 2 Sep 2021 12:29:04 +0200 Subject: [PATCH 091/896] fix(frontend-search): fix codepen.io search (#10157) Fixes #10157 --- plugins/frontend-search/frontend-search.plugin.zsh | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/plugins/frontend-search/frontend-search.plugin.zsh b/plugins/frontend-search/frontend-search.plugin.zsh index 4517e21a8..437e477b9 100644 --- a/plugins/frontend-search/frontend-search.plugin.zsh +++ b/plugins/frontend-search/frontend-search.plugin.zsh @@ -29,14 +29,10 @@ alias unheap='frontend unheap' alias vuejs='frontend vuejs' function _frontend_fallback() { - local url - if [[ "$FRONTEND_SEARCH_FALLBACK" == duckduckgo ]]; then - url="https://duckduckgo.com/?sites=$1&q=" - else - url="https://google.com/search?as_sitesearch=$1&as_q=" - fi - - echo "$url" + case "$FRONTEND_SEARCH_FALLBACK" in + duckduckgo) echo "https://duckduckgo.com/?sites=$1&q=" ;; + *) echo "https://google.com/search?as_sitesearch=$1&as_q=" ;; + esac } function frontend() { @@ -51,7 +47,7 @@ function frontend() { bootsnipp 'https://bootsnipp.com/search?q=' bundlephobia 'https://bundlephobia.com/result?p=' caniuse 'https://caniuse.com/#search=' - codepen 'https://codepen.io/search?q=' + codepen 'https://codepen.io/search/pens?q=' compassdoc 'http://compass-style.org/search?q=' cssflow 'http://www.cssflow.com/search?q=' dartlang 'https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/dart:' From 53b54f5faa271ee90ec31fcffb559541c82b9703 Mon Sep 17 00:00:00 2001 From: Vitaly Polonetsky Date: Fri, 3 Sep 2021 02:43:53 -0700 Subject: [PATCH 092/896] feat(git): guess main branch name also from remotes (#10158) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Marc CornellĂ  --- plugins/git/git.plugin.zsh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index f0d9aaedc..2985ba024 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -32,10 +32,10 @@ function work_in_progress() { # Check if main exists and use instead of master function git_main_branch() { command git rev-parse --git-dir &>/dev/null || return - local branch - for branch in main trunk; do - if command git show-ref -q --verify refs/heads/$branch; then - echo $branch + local ref + for ref in refs/{heads,remotes/{origin,upstream}}/{main,trunk}; do + if command git show-ref -q --verify $ref; then + echo ${ref:t} return fi done From c08fb77c2fc62ba8df6ad690df0e1d5c9f24c075 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Fri, 3 Sep 2021 12:44:01 +0200 Subject: [PATCH 093/896] fix(pyenv): properly load pyenv shims and warn of broken configuration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #10133 Co-authored-by: ChloĂ© “Matcha” --- plugins/pyenv/pyenv.plugin.zsh | 48 +++++++++++++++++++++++----------- 1 file changed, 33 insertions(+), 15 deletions(-) diff --git a/plugins/pyenv/pyenv.plugin.zsh b/plugins/pyenv/pyenv.plugin.zsh index bcf80a6a2..f55701900 100644 --- a/plugins/pyenv/pyenv.plugin.zsh +++ b/plugins/pyenv/pyenv.plugin.zsh @@ -1,3 +1,22 @@ +pyenv_config_warning() { + local reason="$1" + local pyenv_root="${PYENV_ROOT/#$HOME/\$HOME}" + cat >&2 <&2 < Date: Fri, 3 Sep 2021 12:53:33 +0200 Subject: [PATCH 094/896] feat(pyenv): silence bad config warning with `ZSH_PYENV_QUIET=true` --- plugins/pyenv/README.md | 7 ++++++- plugins/pyenv/pyenv.plugin.zsh | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/plugins/pyenv/README.md b/plugins/pyenv/README.md index d063b55b9..810c67998 100644 --- a/plugins/pyenv/README.md +++ b/plugins/pyenv/README.md @@ -1,4 +1,4 @@ -# pyenv +# pyenv This plugin looks for [pyenv](https://github.com/pyenv/pyenv), a Simple Python version management system, and loads it if it's found. It also loads pyenv-virtualenv, a pyenv @@ -10,6 +10,11 @@ To use it, add `pyenv` to the plugins array in your zshrc file: plugins=(... pyenv) ``` +## Settings + +- `ZSH_PYENV_QUIET`: if set to `true`, the plugin will not print any messages if it + finds that `pyenv` is not properly configured. + ## Functions - `pyenv_prompt_info`: displays the Python version in use by pyenv; or the global Python diff --git a/plugins/pyenv/pyenv.plugin.zsh b/plugins/pyenv/pyenv.plugin.zsh index f55701900..679fc5e52 100644 --- a/plugins/pyenv/pyenv.plugin.zsh +++ b/plugins/pyenv/pyenv.plugin.zsh @@ -1,4 +1,6 @@ pyenv_config_warning() { + [[ "$ZSH_PYENV_QUIET" != true ]] || return 0 + local reason="$1" local pyenv_root="${PYENV_ROOT/#$HOME/\$HOME}" cat >&2 < Date: Fri, 3 Sep 2021 12:56:00 +0200 Subject: [PATCH 095/896] feat(pyenv): don't load pyenv-virtualenv with `ZSH_PYENV_VIRTUALENV=false` Closes #9443 Co-authored-by: Pandu POLUAN --- plugins/pyenv/README.md | 3 +++ plugins/pyenv/pyenv.plugin.zsh | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/pyenv/README.md b/plugins/pyenv/README.md index 810c67998..b9ee937b7 100644 --- a/plugins/pyenv/README.md +++ b/plugins/pyenv/README.md @@ -15,6 +15,9 @@ plugins=(... pyenv) - `ZSH_PYENV_QUIET`: if set to `true`, the plugin will not print any messages if it finds that `pyenv` is not properly configured. +- `ZSH_PYENV_VIRTUALENV`: if set to `false`, the plugin will not load pyenv-virtualenv + when it finds it. + ## Functions - `pyenv_prompt_info`: displays the Python version in use by pyenv; or the global Python diff --git a/plugins/pyenv/pyenv.plugin.zsh b/plugins/pyenv/pyenv.plugin.zsh index 679fc5e52..922df8ead 100644 --- a/plugins/pyenv/pyenv.plugin.zsh +++ b/plugins/pyenv/pyenv.plugin.zsh @@ -78,7 +78,7 @@ if [[ $FOUND_PYENV -eq 1 ]]; then eval "$(pyenv init - --no-rehash zsh)" # If pyenv-virtualenv exists, load it - if [[ -d "$PYENV_ROOT/plugins/pyenv-virtualenv" ]]; then + if [[ -d "$PYENV_ROOT/plugins/pyenv-virtualenv" && "$ZSH_PYENV_VIRTUALENV" != false ]]; then eval "$(pyenv virtualenv-init - zsh)" fi From 19710a2d17d69dc0315465875c4becbf5e4ead38 Mon Sep 17 00:00:00 2001 From: Terry Date: Mon, 6 Sep 2021 18:02:19 +0930 Subject: [PATCH 096/896] fix(pyenv): do not warn if PYENV_ROOT is undefined (#10162) Co-authored-by: Terry Moschou --- plugins/pyenv/pyenv.plugin.zsh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/pyenv/pyenv.plugin.zsh b/plugins/pyenv/pyenv.plugin.zsh index 922df8ead..d91b5daa7 100644 --- a/plugins/pyenv/pyenv.plugin.zsh +++ b/plugins/pyenv/pyenv.plugin.zsh @@ -62,14 +62,14 @@ if [[ $FOUND_PYENV -ne 1 ]]; then fi if [[ $FOUND_PYENV -eq 1 ]]; then - # Setup $PYENV_ROOT if not already set if [[ -z "$PYENV_ROOT" ]]; then + # This is only for backwards compatibility with users that previously relied + # on this plugin exporting it. pyenv itself does not require it to be exported export PYENV_ROOT="$(pyenv root)" - pyenv_config_warning 'missing $PYENV_ROOT' fi # Add pyenv shims to $PATH if not already added - if [[ -z "${path[(Re)$PYENV_ROOT/shims]}" ]]; then + if [[ -z "${path[(Re)$(pyenv root)/shims]}" ]]; then eval "$(pyenv init --path)" pyenv_config_warning 'missing pyenv shims in $PATH' fi @@ -78,7 +78,7 @@ if [[ $FOUND_PYENV -eq 1 ]]; then eval "$(pyenv init - --no-rehash zsh)" # If pyenv-virtualenv exists, load it - if [[ -d "$PYENV_ROOT/plugins/pyenv-virtualenv" && "$ZSH_PYENV_VIRTUALENV" != false ]]; then + if [[ -d "$(pyenv root)/plugins/pyenv-virtualenv" && "$ZSH_PYENV_VIRTUALENV" != false ]]; then eval "$(pyenv virtualenv-init - zsh)" fi From a5850d441b2168bbcc17ddcbe03c9b9cdb2720e0 Mon Sep 17 00:00:00 2001 From: Neil Girdhar Date: Mon, 6 Sep 2021 05:21:44 -0400 Subject: [PATCH 097/896] feat(git): change from commiter to author in `git log` aliases (#9670) --- plugins/git/README.md | 6 +++--- plugins/git/git.plugin.zsh | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/plugins/git/README.md b/plugins/git/README.md index 48cf87204..13571c821 100644 --- a/plugins/git/README.md +++ b/plugins/git/README.md @@ -98,11 +98,11 @@ plugins=(... git) | glgga | git log --graph --decorate --all | | glgm | git log --graph --max-count=10 | | glo | git log --oneline --decorate | -| glol | git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' | -| glols | git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --stat | +| glol | git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset' | +| glols | git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset' --stat | | glod | git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset' | | glods | git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset' --date=short | -| glola | git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --all | +| glola | git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset' --all | | glog | git log --oneline --decorate --graph | | gloga | git log --oneline --decorate --graph --all | | glp | git log --pretty=\ | diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 2985ba024..03769ed0f 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -210,11 +210,11 @@ alias glgg='git log --graph' alias glgga='git log --graph --decorate --all' alias glgm='git log --graph --max-count=10' alias glo='git log --oneline --decorate' -alias glol="git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'" -alias glols="git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --stat" +alias glol="git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset'" +alias glols="git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset' --stat" alias glod="git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset'" alias glods="git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset' --date=short" -alias glola="git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --all" +alias glola="git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset' --all" alias glog='git log --oneline --decorate --graph' alias gloga='git log --oneline --decorate --graph --all' alias glp="_git_log_prettily" From a15ac80bba400cffd6a2e2e32be9c39cd7d13411 Mon Sep 17 00:00:00 2001 From: Gijs Key Date: Mon, 6 Sep 2021 11:28:32 +0200 Subject: [PATCH 098/896] feat(gcloud): add Mac M1 Homebrew path (#10143) Homebrew on Mac M1 is moved to the /opt/Homebrew location. This change updates the search locations with this path. --- plugins/gcloud/gcloud.plugin.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/gcloud/gcloud.plugin.zsh b/plugins/gcloud/gcloud.plugin.zsh index c7aebe697..7368eb3a6 100644 --- a/plugins/gcloud/gcloud.plugin.zsh +++ b/plugins/gcloud/gcloud.plugin.zsh @@ -7,6 +7,7 @@ if [[ -z "${CLOUDSDK_HOME}" ]]; then search_locations=( "$HOME/google-cloud-sdk" "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk" + "/opt/homebrew/Caskroom/google-cloud-sdk/latest/google-cloud-sdk" "/usr/share/google-cloud-sdk" "/snap/google-cloud-sdk/current" "/usr/lib64/google-cloud-sdk/" From 4d5bfe4c69360353cf7ed9d99b672cb840e9bbcf Mon Sep 17 00:00:00 2001 From: Julian Horsch Date: Mon, 6 Sep 2021 11:30:28 +0200 Subject: [PATCH 099/896] feat(autojump): add new Homebrew default path on M1 Macs (#9637) On M1-Macs homebrew uses /opt/homebrew as default location for ARM packages. This results in the autojump plugin not being able to find autojump after a clean default installation. This commit adds the new default location to the autojump plugin. --- plugins/autojump/autojump.plugin.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/autojump/autojump.plugin.zsh b/plugins/autojump/autojump.plugin.zsh index f40b0e931..3117c6da4 100644 --- a/plugins/autojump/autojump.plugin.zsh +++ b/plugins/autojump/autojump.plugin.zsh @@ -10,6 +10,7 @@ autojump_paths=( /usr/local/share/autojump/autojump.zsh # FreeBSD installation /opt/local/etc/profile.d/autojump.sh # macOS with MacPorts /usr/local/etc/profile.d/autojump.sh # macOS with Homebrew (default) + /opt/homebrew/etc/profile.d/autojump.sh # macOS with Homebrew (default on M1 macs) ) for file in $autojump_paths; do From 97b4ab76b8c3743187495599a1ca87c520665299 Mon Sep 17 00:00:00 2001 From: "Michael J. Cohen" Date: Mon, 6 Sep 2021 05:31:56 -0400 Subject: [PATCH 100/896] fix(chruby): fix typo in test for Homebrew path (#9887) --- plugins/chruby/chruby.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/chruby/chruby.plugin.zsh b/plugins/chruby/chruby.plugin.zsh index f7fedb5f2..32f0525aa 100644 --- a/plugins/chruby/chruby.plugin.zsh +++ b/plugins/chruby/chruby.plugin.zsh @@ -37,7 +37,7 @@ _homebrew-installed() { } _chruby-from-homebrew-installed() { - [ -r _brew_prefix ] &> /dev/null + [ -r $_brew_prefix ] &> /dev/null } _ruby-build_installed() { From 7336ebcd8f095b0ead7e1e39bdc2fff57275acfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Mon, 6 Sep 2021 13:30:16 +0200 Subject: [PATCH 101/896] feat(changelog): change style of `BREAKING CHANGES` header --- tools/changelog.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/changelog.sh b/tools/changelog.sh index 6913ae49a..b4b8d0c9e 100755 --- a/tools/changelog.sh +++ b/tools/changelog.sh @@ -285,8 +285,9 @@ function display-release { (( $#breaking != 0 )) || return 0 case "$output" in + text) fmt:header "\e[31mBREAKING CHANGES" 3 ;; raw) fmt:header "BREAKING CHANGES" 3 ;; - text|md) fmt:header "âš  BREAKING CHANGES" 3 ;; + md) fmt:header "BREAKING CHANGES âš " 3 ;; esac local hash subject From 5a4159cd29ab9dfa31e7747dd676f3cf0e19bf81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Mon, 6 Sep 2021 13:25:35 +0200 Subject: [PATCH 102/896] fix(git)!: rename `git mergetool` aliases to `gmtl*` (#9154) BREAKING CHANGE: the `gmt` alias conflicts with the Generic Mapping Tools command. For that, the `gmt` alias has been renamed to `gmtl`, and `gmtvim` has been renamed to `gmtlvim` for consistency. Fixes #9154 --- plugins/git/README.md | 4 ++-- plugins/git/git.plugin.zsh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/git/README.md b/plugins/git/README.md index 13571c821..64c507345 100644 --- a/plugins/git/README.md +++ b/plugins/git/README.md @@ -108,8 +108,8 @@ plugins=(... git) | glp | git log --pretty=\ | | gm | git merge | | gmom | git merge origin/$(git_main_branch) | -| gmt | git mergetool --no-prompt | -| gmtvim | git mergetool --no-prompt --tool=vimdiff | +| gmtl | git mergetool --no-prompt | +| gmtlvim | git mergetool --no-prompt --tool=vimdiff | | gmum | git merge upstream/$(git_main_branch) | | gma | git merge --abort | | gp | git push | diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 03769ed0f..d030d2801 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -221,8 +221,8 @@ alias glp="_git_log_prettily" alias gm='git merge' alias gmom='git merge origin/$(git_main_branch)' -alias gmt='git mergetool --no-prompt' -alias gmtvim='git mergetool --no-prompt --tool=vimdiff' +alias gmtl='git mergetool --no-prompt' +alias gmtlvim='git mergetool --no-prompt --tool=vimdiff' alias gmum='git merge upstream/$(git_main_branch)' alias gma='git merge --abort' From ab8b9913cb6cba35da3126887d4c0b67f033fffa Mon Sep 17 00:00:00 2001 From: Xuehai Pan Date: Mon, 6 Sep 2021 23:46:56 +0800 Subject: [PATCH 103/896] fix(git-auto-fetch): cancel fetch if we don't have permission over git folder (#10010) --- plugins/git-auto-fetch/git-auto-fetch.plugin.zsh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh b/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh index 0da84f2f5..dbc949621 100644 --- a/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh +++ b/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh @@ -11,8 +11,9 @@ function git-fetch-all { return 0 fi - # Do nothing if auto-fetch disabled - if [[ -z "$gitdir" || -f "$gitdir/NO_AUTO_FETCH" ]]; then + # Do nothing if auto-fetch is disabled or don't have permissions + if [[ ! -w "$gitdir" || -f "$gitdir/NO_AUTO_FETCH" ]] || + [[ -f "$gitdir/FETCH_LOG" && ! -w "$gitdir/FETCH_LOG" ]]; then return 0 fi From af271c9e387f9b536205a7f459802369cb26a7e0 Mon Sep 17 00:00:00 2001 From: Moshe Avni Date: Mon, 6 Sep 2021 18:56:39 +0300 Subject: [PATCH 104/896] feat(git-auto-fetch): add date to git-auto-fetch log file (#10021) --- plugins/git-auto-fetch/git-auto-fetch.plugin.zsh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh b/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh index dbc949621..efe8cbe66 100644 --- a/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh +++ b/plugins/git-auto-fetch/git-auto-fetch.plugin.zsh @@ -25,8 +25,9 @@ function git-fetch-all { fi # Fetch all remotes (avoid ssh passphrase prompt) + date -R &>! "$gitdir/FETCH_LOG" GIT_SSH_COMMAND="command ssh -o BatchMode=yes" \ - command git fetch --all 2>/dev/null &>! "$gitdir/FETCH_LOG" + command git fetch --all 2>/dev/null &>> "$gitdir/FETCH_LOG" ) &| } From f341c8c20646bd82d5d84fae32f68b760e0f1be0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 7 Sep 2021 17:08:46 +0200 Subject: [PATCH 105/896] feat(changelog): print BREAKING CHANGE messages in a prettier way --- tools/changelog.sh | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/tools/changelog.sh b/tools/changelog.sh index b4b8d0c9e..966e91c25 100755 --- a/tools/changelog.sh +++ b/tools/changelog.sh @@ -181,6 +181,12 @@ function display-release { return fi + # Get length of longest scope for padding + local max_scope=0 + for hash in ${(k)scopes}; do + max_scope=$(( max_scope < ${#scopes[$hash]} ? ${#scopes[$hash]} : max_scope )) + done + ##* Formatting functions # Format the hash according to output format @@ -220,18 +226,13 @@ function display-release { #* Uses $scopes (A) and $hash from outer scope local scope="${1:-${scopes[$hash]}}" - # Get length of longest scope for padding - local max_scope=0 padding=0 - for hash in ${(k)scopes}; do - max_scope=$(( max_scope < ${#scopes[$hash]} ? ${#scopes[$hash]} : max_scope )) - done - # If no scopes, exit the function if [[ $max_scope -eq 0 ]]; then return fi # Get how much padding is required for this scope + local padding=0 padding=$(( max_scope < ${#scope} ? 0 : max_scope - ${#scope} )) padding="${(r:$padding:: :):-}" @@ -290,11 +291,15 @@ function display-release { md) fmt:header "BREAKING CHANGES âš " 3 ;; esac - local hash subject + local hash message + local wrap_width=$(( (COLUMNS < 100 ? COLUMNS : 100) - 3 )) for hash message in ${(kv)breaking}; do - echo " - $(fmt:hash) $(fmt:scope)$(fmt:subject "${message}")" - done | sort - echo + # Format the BREAKING CHANGE message by word-wrapping it at maximum 100 characters + # (use $COLUMNS if smaller than 100), and adding a 3-space left padding. + message="$(fmt -w $wrap_width <<< "$message" | sed 's/^/ /')" + # Display hash and scope first, and then the full message with newline separators + echo " - $(fmt:hash) $(fmt:scope)\n\n$(fmt:subject "$message")\n" + done } function display:type { From 37a60eebc107c08047d4b5716c1c1760104aa25d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 7 Sep 2021 17:13:46 +0200 Subject: [PATCH 106/896] chore(changelog): fix first-letter uppercase in breaking change messages --- tools/changelog.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tools/changelog.sh b/tools/changelog.sh index 966e91c25..7329a9526 100755 --- a/tools/changelog.sh +++ b/tools/changelog.sh @@ -294,11 +294,12 @@ function display-release { local hash message local wrap_width=$(( (COLUMNS < 100 ? COLUMNS : 100) - 3 )) for hash message in ${(kv)breaking}; do - # Format the BREAKING CHANGE message by word-wrapping it at maximum 100 characters - # (use $COLUMNS if smaller than 100), and adding a 3-space left padding. - message="$(fmt -w $wrap_width <<< "$message" | sed 's/^/ /')" - # Display hash and scope first, and then the full message with newline separators - echo " - $(fmt:hash) $(fmt:scope)\n\n$(fmt:subject "$message")\n" + # Format the BREAKING CHANGE message by word-wrapping it at maximum 100 + # characters (use $COLUMNS if smaller than 100) + message="$(fmt -w $wrap_width <<< "$message")" + # Display hash and scope in their own line, and then the full message with + # blank lines as separators and a 3-space left padding + echo " - $(fmt:hash) $(fmt:scope)\n\n$(fmt:subject "$message" | sed 's/^/ /')\n" done } From 450acc0113b114352ce3b94870fe63fc461844bd Mon Sep 17 00:00:00 2001 From: Carlo Sala Date: Tue, 7 Sep 2021 20:02:20 +0200 Subject: [PATCH 107/896] fix: automatically create completion for `cargo` and `rustup` plugins (#10087) --- plugins/cargo/.gitignore | 1 + plugins/cargo/_cargo | 407 ----------- plugins/cargo/cargo.plugin.zsh | 11 + plugins/rustup/.gitignore | 1 + plugins/rustup/_rustup | 1143 ------------------------------ plugins/rustup/rustup.plugin.zsh | 12 + 6 files changed, 25 insertions(+), 1550 deletions(-) create mode 100644 plugins/cargo/.gitignore delete mode 100644 plugins/cargo/_cargo create mode 100644 plugins/cargo/cargo.plugin.zsh create mode 100644 plugins/rustup/.gitignore delete mode 100644 plugins/rustup/_rustup create mode 100644 plugins/rustup/rustup.plugin.zsh diff --git a/plugins/cargo/.gitignore b/plugins/cargo/.gitignore new file mode 100644 index 000000000..42d7ecdd6 --- /dev/null +++ b/plugins/cargo/.gitignore @@ -0,0 +1 @@ +_cargo diff --git a/plugins/cargo/_cargo b/plugins/cargo/_cargo deleted file mode 100644 index ebff99310..000000000 --- a/plugins/cargo/_cargo +++ /dev/null @@ -1,407 +0,0 @@ -#compdef cargo - -autoload -U regexp-replace - -_cargo() { - local curcontext="$curcontext" ret=1 - local -a command_scope_spec common parallel features msgfmt triple target registry - local -a state line state_descr # These are set by _arguments - typeset -A opt_args - - common=( - '(-q --quiet)*'{-v,--verbose}'[use verbose output]' - '(-q --quiet -v --verbose)'{-q,--quiet}'[no output printed to stdout]' - '-Z+[pass unstable (nightly-only) flags to cargo]: :_cargo_unstable_flags' - '--frozen[require that Cargo.lock and cache are up to date]' - '--locked[require that Cargo.lock is up to date]' - '--color=[specify colorization option]:coloring:(auto always never)' - '(- 1 *)'{-h,--help}'[show help message]' - ) - - # leading items in parentheses are an exclusion list for the arguments following that arg - # See: http://zsh.sourceforge.net/Doc/Release/Completion-System.html#Completion-Functions - # - => exclude all other options - # 1 => exclude positional arg 1 - # * => exclude all other args - # +blah => exclude +blah - _arguments -s -S -C $common \ - '(- 1 *)--list[list installed commands]' \ - '(- 1 *)--explain=[provide a detailed explanation of an error message]:error code' \ - '(- 1 *)'{-V,--version}'[show version information]' \ - '(+beta +nightly)+stable[use the stable toolchain]' \ - '(+stable +nightly)+beta[use the beta toolchain]' \ - '(+stable +beta)+nightly[use the nightly toolchain]' \ - '1: :_cargo_cmds' \ - '*:: :->args' - - # These flags are mutually exclusive specifiers for the scope of a command; as - # they are used in multiple places without change, they are expanded into the - # appropriate command's `_arguments` where appropriate. - command_scope_spec=( - '(--bin --example --test --lib)--bench=[specify benchmark name]: :_cargo_benchmark_names' - '(--bench --bin --test --lib)--example=[specify example name]:example name' - '(--bench --example --test --lib)--bin=[specify binary name]:binary name' - '(--bench --bin --example --test)--lib=[specify library name]:library name' - '(--bench --bin --example --lib)--test=[specify test name]:test name' - ) - - parallel=( - '(-j --jobs)'{-j+,--jobs=}'[specify number of parallel jobs]:jobs [# of CPUs]' - ) - - features=( - '(--all-features)--features=[specify features to activate]:feature' - '(--features)--all-features[activate all available features]' - "--no-default-features[don't build the default features]" - ) - - msgfmt='--message-format=[specify error format]:error format [human]:(human json short)' - triple='--target=[specify target triple]:target triple' - target='--target-dir=[specify directory for all generated artifacts]:directory:_directories' - manifest='--manifest-path=[specify path to manifest]:path:_directories' - registry='--registry=[specify registry to use]:registry' - - case $state in - args) - curcontext="${curcontext%:*}-${words[1]}:" - case ${words[1]} in - bench) - _arguments -s -A "^--" $common $parallel $features $msgfmt $triple $target $manifest \ - "${command_scope_spec[@]}" \ - '--all-targets[benchmark all targets]' \ - "--no-run[compile but don't run]" \ - '(-p --package)'{-p+,--package=}'[specify package to run benchmarks for]:package:_cargo_package_names' \ - '--exclude=[exclude packages from the benchmark]:spec' \ - '--no-fail-fast[run all benchmarks regardless of failure]' \ - '1: :_guard "^-*" "bench name"' \ - '*:args:_default' - ;; - - build|b) - _arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \ - '--all-targets[equivalent to specifying --lib --bins --tests --benches --examples]' \ - "${command_scope_spec[@]}" \ - '(-p --package)'{-p+,--package=}'[specify package to build]:package:_cargo_package_names' \ - '--release[build in release mode]' \ - '--build-plan[output the build plan in JSON]' \ - ;; - - check|c) - _arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \ - '--all-targets[equivalent to specifying --lib --bins --tests --benches --examples]' \ - "${command_scope_spec[@]}" \ - '(-p --package)'{-p+,--package=}'[specify package to check]:package:_cargo_package_names' \ - '--release[check in release mode]' \ - ;; - - clean) - _arguments -s -S $common $triple $target $manifest \ - '(-p --package)'{-p+,--package=}'[specify package to clean]:package:_cargo_package_names' \ - '--release[clean release artifacts]' \ - '--doc[clean just the documentation directory]' - ;; - - doc) - _arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \ - '--no-deps[do not build docs for dependencies]' \ - '--document-private-items[include non-public items in the documentation]' \ - '--open[open docs in browser after the build]' \ - '(-p --package)'{-p+,--package=}'[specify package to document]:package:_cargo_package_names' \ - '--release[build artifacts in release mode, with optimizations]' \ - ;; - - fetch) - _arguments -s -S $common $triple $manifest - ;; - - fix) - _arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \ - "${command_scope_spec[@]}" \ - '--broken-code[fix code even if it already has compiler errors]' \ - '--edition[fix in preparation for the next edition]' \ - '--edition-idioms[fix warnings to migrate to the idioms of an edition]' \ - '--allow-no-vcs[fix code even if a VCS was not detected]' \ - '--allow-dirty[fix code even if the working directory is dirty]' \ - '--allow-staged[fix code even if the working directory has staged changes]' - ;; - - generate-lockfile) - _arguments -s -S $common $manifest - ;; - - git-checkout) - _arguments -s -S $common \ - '--reference=:reference' \ - '--url=:url:_urls' - ;; - - help) - _cargo_cmds - ;; - - init) - _arguments -s -S $common $registry \ - '--lib[use library template]' \ - '--edition=[specify edition to set for the crate generated]:edition:(2015 2018)' \ - '--vcs=[initialize a new repo with a given VCS]:vcs:(git hg pijul fossil none)' \ - '--name=[set the resulting package name]:name' \ - '1:path:_directories' - ;; - - install) - _arguments -s -S $common $parallel $features $triple $registry \ - '(-f --force)'{-f,--force}'[force overwriting of existing crates or binaries]' \ - '--bin=[only install the specified binary]:binary' \ - '--branch=[branch to use when installing from git]:branch' \ - '--debug[build in debug mode instead of release mode]' \ - '--example=[install the specified example instead of binaries]:example' \ - '--git=[specify URL from which to install the crate]:url:_urls' \ - '--path=[local filesystem path to crate to install]: :_directories' \ - '--rev=[specific commit to use when installing from git]:commit' \ - '--root=[directory to install packages into]: :_directories' \ - '--tag=[tag to use when installing from git]:tag' \ - '--vers=[version to install from crates.io]:version' \ - '--list[list all installed packages and their versions]' \ - '*: :_guard "^-*" "crate"' - ;; - - locate-project) - _arguments -s -S $common $manifest - ;; - - login) - _arguments -s -S $common $registry \ - '*: :_guard "^-*" "token"' - ;; - - metadata) - _arguments -s -S $common $features $manifest \ - "--no-deps[output information only about the root package and don't fetch dependencies]" \ - '--format-version=[specify format version]:version [1]:(1)' - ;; - - new) - _arguments -s -S $common $registry \ - '--lib[use library template]' \ - '--vcs:initialize a new repo with a given VCS:(git hg none)' \ - '--name=[set the resulting package name]' - ;; - - owner) - _arguments -s -S $common $registry \ - '(-a --add)'{-a,--add}'[specify name of a user or team to invite as an owner]:name' \ - '--index=[specify registry index]:index' \ - '(-l --list)'{-l,--list}'[list owners of a crate]' \ - '(-r --remove)'{-r,--remove}'[specify name of a user or team to remove as an owner]:name' \ - '--token=[specify API token to use when authenticating]:token' \ - '*: :_guard "^-*" "crate"' - ;; - - package) - _arguments -s -S $common $parallel $features $triple $target $manifest \ - '(-l --list)'{-l,--list}'[print files included in a package without making one]' \ - '--no-metadata[ignore warnings about a lack of human-usable metadata]' \ - '--allow-dirty[allow dirty working directories to be packaged]' \ - "--no-verify[don't build to verify contents]" - ;; - - pkgid) - _arguments -s -S $common $manifest \ - '(-p --package)'{-p+,--package=}'[specify package to get ID specifier for]:package:_cargo_package_names' \ - '*: :_guard "^-*" "spec"' - ;; - - publish) - _arguments -s -S $common $parallel $features $triple $target $manifest $registry \ - '--index=[specify registry index]:index' \ - '--allow-dirty[allow dirty working directories to be packaged]' \ - "--no-verify[don't verify the contents by building them]" \ - '--token=[specify token to use when uploading]:token' \ - '--dry-run[perform all checks without uploading]' - ;; - - read-manifest) - _arguments -s -S $common $manifest - ;; - - run|r) - _arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \ - '--example=[name of the bin target]:name' \ - '--bin=[name of the bin target]:name' \ - '(-p --package)'{-p+,--package=}'[specify package with the target to run]:package:_cargo_package_names' \ - '--release[build in release mode]' \ - '*: :_default' - ;; - - rustc) - _arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \ - '(-p --package)'{-p+,--package=}'[specify package to build]:package:_cargo_package_names' \ - '--profile=[specify profile to build the selected target for]:profile' \ - '--release[build artifacts in release mode, with optimizations]' \ - "${command_scope_spec[@]}" \ - '*: : _dispatch rustc rustc -default-' - ;; - - rustdoc) - _arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \ - '--document-private-items[include non-public items in the documentation]' \ - '--open[open the docs in a browser after the operation]' \ - '(-p --package)'{-p+,--package=}'[specify package to document]:package:_cargo_package_names' \ - '--release[build artifacts in release mode, with optimizations]' \ - "${command_scope_spec[@]}" \ - '*: : _dispatch rustdoc rustdoc -default-' - ;; - - search) - _arguments -s -S $common $registry \ - '--index=[specify registry index]:index' \ - '--limit=[limit the number of results]:results [10]' \ - '*: :_guard "^-*" "query"' - ;; - - test|t) - _arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \ - '--test=[test name]: :_cargo_test_names' \ - '--no-fail-fast[run all tests regardless of failure]' \ - '--no-run[compile but do not run]' \ - '(-p --package)'{-p+,--package=}'[package to run tests for]:package:_cargo_package_names' \ - '--all[test all packages in the workspace]' \ - '--release[build artifacts in release mode, with optimizations]' \ - '1: :_cargo_test_names' \ - '(--doc --bin --example --test --bench)--lib[only test library]' \ - '(--lib --bin --example --test --bench)--doc[only test documentation]' \ - '(--lib --doc --example --test --bench)--bin=[binary name]' \ - '(--lib --doc --bin --test --bench)--example=[example name]' \ - '(--lib --doc --bin --example --bench)--test=[test name]' \ - '(--lib --doc --bin --example --test)--bench=[benchmark name]' \ - '*: :_default' - ;; - - uninstall) - _arguments -s -S $common \ - '(-p --package)'{-p+,--package=}'[specify package to uninstall]:package:_cargo_package_names' \ - '--bin=[only uninstall the specified binary]:name' \ - '--root=[directory to uninstall packages from]: :_files -/' \ - '*:crate:_cargo_installed_crates -F line' - ;; - - update) - _arguments -s -S $common $manifest \ - '--aggressive=[force dependency update]' \ - "--dry-run[don't actually write the lockfile]" \ - '(-p --package)'{-p+,--package=}'[specify package to update]:package:_cargo_package_names' \ - '--precise=[update single dependency to precise release]:release' - ;; - - verify-project) - _arguments -s -S $common $manifest - ;; - - version) - _arguments -s -S $common - ;; - - yank) - _arguments -s -S $common $registry \ - '--vers=[specify yank version]:version' \ - '--undo[undo a yank, putting a version back into the index]' \ - '--index=[specify registry index to yank from]:registry index' \ - '--token=[specify API token to use when authenticating]:token' \ - '*: :_guard "^-*" "crate"' - ;; - *) - # allow plugins to define their own functions - if ! _call_function ret _cargo-${words[1]}; then - # fallback on default completion for unknown commands - _default && ret=0 - fi - (( ! ret )) - ;; - esac - ;; - esac -} - -_cargo_unstable_flags() { - local flags - flags=( help ${${${(M)${(f)"$(_call_program flags cargo -Z help)"}:#*--*}/ #-- #/:}##*-Z } ) - _describe -t flags 'unstable flag' flags -} - -_cargo_installed_crates() { - local expl - _description crates expl 'crate' - compadd "$@" "$expl[@]" - ${${${(f)"$(cargo install --list)"}:# *}%% *} -} - -_cargo_cmds() { - local -a commands - # This uses Parameter Expansion Flags, which are a built-in Zsh feature. - # See more: http://zsh.sourceforge.net/Doc/Release/Expansion.html#Parameter-Expansion-Flags - # and http://zsh.sourceforge.net/Doc/Release/Expansion.html#Parameter-Expansion - # - # # How this work? - # - # First it splits the result of `cargo --list` at newline, then it removes the first line. - # Then it removes indentation (4 whitespaces) before each items. (Note the x## pattern [1]). - # Then it replaces those spaces between item and description with a `:` - # - # [1]: https://github.com/zsh-users/zsh-completions/blob/master/zsh-completions-howto.org#patterns - commands=( ${${${(M)"${(f)$(_call_program commands cargo --list)}":# *}/ ##/}/ ##/:} ) - _describe -t commands 'command' commands -} - - -#FIXME: Disabled until fixed -#gets package names from the manifest file -_cargo_package_names() { - _message -e packages package -} - -# Extracts the values of "name" from the array given in $1 and shows them as -# command line options for completion -_cargo_names_from_array() { - # strip json from the path - local manifest=${${${"$(cargo locate-project)"}%\"\}}##*\"} - if [[ -z $manifest ]]; then - return 0 - fi - - local last_line - local -a names; - local in_block=false - local block_name=$1 - names=() - while read -r line; do - if [[ $last_line == "[[$block_name]]" ]]; then - in_block=true - else - if [[ $last_line =~ '\s*\[\[.*' ]]; then - in_block=false - fi - fi - - if [[ $in_block == true ]]; then - if [[ $line =~ '\s*name\s*=' ]]; then - regexp-replace line '^\s*name\s*=\s*|"' '' - names+=( "$line" ) - fi - fi - - last_line=$line - done < "$manifest" - _describe "$block_name" names - -} - -#Gets the test names from the manifest file -_cargo_test_names() { - _cargo_names_from_array "test" -} - -#Gets the bench names from the manifest file -_cargo_benchmark_names() { - _cargo_names_from_array "bench" -} - -_cargo diff --git a/plugins/cargo/cargo.plugin.zsh b/plugins/cargo/cargo.plugin.zsh new file mode 100644 index 000000000..92eae5359 --- /dev/null +++ b/plugins/cargo/cargo.plugin.zsh @@ -0,0 +1,11 @@ +# COMPLETION FUNCTION +if (( $+commands[rustup] && $+commands[cargo] )); then + if [[ ! -f $ZSH_CACHE_DIR/cargo_version ]] \ + || [[ "$(cargo --version)" != "$(< "$ZSH_CACHE_DIR/cargo_version")" ]] \ + || [[ ! -f $ZSH/plugins/cargo/_cargo ]]; then + rustup completions zsh cargo > $ZSH/plugins/cargo/_cargo + cargo --version > $ZSH_CACHE_DIR/cargo_version + fi + autoload -Uz _cargo + _comps[cargo]=_cargo +fi diff --git a/plugins/rustup/.gitignore b/plugins/rustup/.gitignore new file mode 100644 index 000000000..ad38ae3bf --- /dev/null +++ b/plugins/rustup/.gitignore @@ -0,0 +1 @@ +_rustup diff --git a/plugins/rustup/_rustup b/plugins/rustup/_rustup deleted file mode 100644 index dab33533a..000000000 --- a/plugins/rustup/_rustup +++ /dev/null @@ -1,1143 +0,0 @@ -#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 diff --git a/plugins/rustup/rustup.plugin.zsh b/plugins/rustup/rustup.plugin.zsh new file mode 100644 index 000000000..c7a9b3060 --- /dev/null +++ b/plugins/rustup/rustup.plugin.zsh @@ -0,0 +1,12 @@ +# COMPLETION FUNCTION +if (( $+commands[rustup] )); then + if [[ ! -f $ZSH_CACHE_DIR/rustup_version ]] \ + || [[ "$(rustup --version 2> /dev/null)" \ + != "$(< "$ZSH_CACHE_DIR/rustup_version")" ]] \ + || [[ ! -f $ZSH/plugins/rustup/_rustup ]]; then + rustup completions zsh > $ZSH/plugins/rustup/_rustup + rustup --version 2> /dev/null > $ZSH_CACHE_DIR/rustup_version + fi + autoload -Uz _rustup + _comps[rustup]=_rustup +fi From 130f35fcb2e175e28178f834b16e00f121319bc4 Mon Sep 17 00:00:00 2001 From: Claas Augner Date: Thu, 9 Sep 2021 19:16:15 +0200 Subject: [PATCH 108/896] feat(git): add `gdu` alias to diff against upstream (#8721) --- plugins/git/README.md | 1 + plugins/git/git.plugin.zsh | 1 + 2 files changed, 2 insertions(+) diff --git a/plugins/git/README.md b/plugins/git/README.md index 64c507345..e53d93b0b 100644 --- a/plugins/git/README.md +++ b/plugins/git/README.md @@ -66,6 +66,7 @@ plugins=(... git) | gds | git diff --staged | | gdt | git diff-tree --no-commit-id --name-only -r | | gdnolock | git diff $@ ":(exclude)package-lock.json" ":(exclude)*.lock" | +| gdu | git diff @{u} | | 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 d030d2801..76e0faed3 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -119,6 +119,7 @@ alias gdcw='git diff --cached --word-diff' alias gdct='git describe --tags $(git rev-list --tags --max-count=1)' alias gds='git diff --staged' alias gdt='git diff-tree --no-commit-id --name-only -r' +alias gdu='git diff @{u}' alias gdw='git diff --word-diff' function gdnolock() { From aa6e932b06137a697296ea5be62c73905ff68848 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3hann=20Fri=C3=B0riksson?= Date: Thu, 9 Sep 2021 19:31:01 +0200 Subject: [PATCH 109/896] fix(vim-interaction): look up the newest GVim instance (#9095) Instead of relying on a hardcoded instance-name existing for the default-value, let's look up the latest instance. This also resolves my problem where MacVim had a servername of "VIM" instead of "GVIM". Co-authored-by: Johann Fridriksson --- plugins/vim-interaction/vim-interaction.plugin.zsh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/vim-interaction/vim-interaction.plugin.zsh b/plugins/vim-interaction/vim-interaction.plugin.zsh index 010f998d3..53ec453e8 100644 --- a/plugins/vim-interaction/vim-interaction.plugin.zsh +++ b/plugins/vim-interaction/vim-interaction.plugin.zsh @@ -22,7 +22,8 @@ EOH local cmd="" local before="" local after="" - local name="GVIM" + # Look up the newest instance + local name="$(gvim --serverlist | tail -n 1)" while getopts ":b:a:n:" option do case $option in From 358ac6a141010b19175d0eb5a6f28ff544aa75d3 Mon Sep 17 00:00:00 2001 From: Xuehai Pan Date: Fri, 10 Sep 2021 04:18:09 +0800 Subject: [PATCH 110/896] fix(cp): add unique suffix to rsync backup directory for each user (#10170) * fix(cp): add unique suffix to rsync backup directory for each user * fix(cp): use `USERNAME` rather than `USER` --- plugins/cp/README.md | 2 +- plugins/cp/cp.plugin.zsh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/cp/README.md b/plugins/cp/README.md index e8a9b6ccc..23734243c 100644 --- a/plugins/cp/README.md +++ b/plugins/cp/README.md @@ -25,7 +25,7 @@ The enabled options for rsync are: * `-hhh`: outputs numbers in human-readable format, in units of 1024 (K, M, G, T). -* `--backup-dir=/tmp/rsync`: move backup copies to "/tmp/rsync". +* `--backup-dir="/tmp/rsync-$USERNAME"`: move backup copies to "/tmp/rsync-$USERNAME". * `-e /dev/null`: only work on local files (disable remote shells). diff --git a/plugins/cp/cp.plugin.zsh b/plugins/cp/cp.plugin.zsh index fe6ea87a8..a56259106 100644 --- a/plugins/cp/cp.plugin.zsh +++ b/plugins/cp/cp.plugin.zsh @@ -1,4 +1,4 @@ cpv() { - rsync -pogbr -hhh --backup-dir=/tmp/rsync -e /dev/null --progress "$@" + rsync -pogbr -hhh --backup-dir="/tmp/rsync-${USERNAME}" -e /dev/null --progress "$@" } compdef _files cpv From 81edb03c5261658d40885abf4bcd54cf9dbbc6a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Fri, 10 Sep 2021 17:06:24 +0200 Subject: [PATCH 111/896] fix(copybuffer): define CTRL+O binding for all keymaps (#6442) Fixes #6442 --- plugins/copybuffer/copybuffer.plugin.zsh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/copybuffer/copybuffer.plugin.zsh b/plugins/copybuffer/copybuffer.plugin.zsh index 87a658d93..e67f920f0 100644 --- a/plugins/copybuffer/copybuffer.plugin.zsh +++ b/plugins/copybuffer/copybuffer.plugin.zsh @@ -11,4 +11,6 @@ copybuffer () { zle -N copybuffer -bindkey "^O" copybuffer +bindkey -M emacs "^O" copybuffer +bindkey -M viins "^O" copybuffer +bindkey -M vicmd "^O" copybuffer From 735808f48d54aabce540f6c90294e21118104cf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Fri, 10 Sep 2021 18:01:43 +0200 Subject: [PATCH 112/896] Revert "feat(ssh-agent): only start ssh-agent once (#5359)" This reverts commit 7692881d2a61a4ba47eeef5d7827c0d2cb896def. --- plugins/ssh-agent/ssh-agent.plugin.zsh | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/plugins/ssh-agent/ssh-agent.plugin.zsh b/plugins/ssh-agent/ssh-agent.plugin.zsh index c2b9546a2..2d7d8a2a0 100644 --- a/plugins/ssh-agent/ssh-agent.plugin.zsh +++ b/plugins/ssh-agent/ssh-agent.plugin.zsh @@ -96,24 +96,7 @@ else _start_agent fi -() { - emulate -L zsh - - command mkdir "$ZSH_CACHE_DIR/ssh-agent.lock" 2>/dev/null || return - - trap " - ret=\$? - - command rm -rf '$ZSH_CACHE_DIR/ssh-agent.lock' - unset agent_forwarding ssh_env_cache - unfunction _start_agent _add_identities 2>/dev/null - - return \$ret - " EXIT INT QUIT - - _add_identities - -} +_add_identities unset agent_forwarding ssh_env_cache unfunction _start_agent _add_identities From c21ff38b8fda0584208ffd697dac0502e2327466 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 15 Sep 2021 17:44:36 +0200 Subject: [PATCH 113/896] fix(docker): remove unwanted asterisk in completed docker commands Also update upstream completion to version fe2008d04e80fafd. NOTE: this fix means the version bundled within Oh My Zsh has diverged from the upstream version. --- plugins/docker/_docker | 100 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 97 insertions(+), 3 deletions(-) diff --git a/plugins/docker/_docker b/plugins/docker/_docker index 7fe204313..8ee35abcf 100644 --- a/plugins/docker/_docker +++ b/plugins/docker/_docker @@ -1343,7 +1343,7 @@ __docker_node_complete_ls_filters() { ;; esac else - opts=('id' 'label' 'membership' 'name' 'role') + opts=('id' 'label' 'membership' 'name' 'node.label' 'role') _describe -t filter-opts "filter options" opts -qS "=" && ret=0 fi @@ -2544,6 +2544,82 @@ __docker_volume_subcommand() { # EO volume +# BO context + +__docker_complete_contexts() { + [[ $PREFIX = -* ]] && return 1 + integer ret=1 + declare -a contexts + + contexts=(${(f)${:-"$(_call_program commands docker $docker_options context ls -q)"$'\n'}}) + + _describe -t context-list "context" contexts && ret=0 + return ret +} + +__docker_context_commands() { + local -a _docker_context_subcommands + _docker_context_subcommands=( + "create:Create new context" + "inspect:Display detailed information on one or more contexts" + "list:List available contexts" + "rm:Remove one or more contexts" + "show:Print the current context" + "update:Update a context" + "use:Set the default context" + ) + _describe -t docker-context-commands "docker context command" _docker_context_subcommands +} + +__docker_context_subcommand() { + local -a _command_args opts_help + local expl help="--help" + integer ret=1 + + opts_help=("(: -)--help[Print usage]") + + case "$words[1]" in + (create) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help)--default-stack-orchestrator=[Default orchestrator for stack operations to use with this context]:default-stack-orchestrator:(swarm kubernetes all)" \ + "($help)--description=[Description of the context]:description:" \ + "($help)--docker=[Set the docker endpoint]:docker:" \ + "($help)--kubernetes=[Set the kubernetes endpoint]:kubernetes:" \ + "($help)--from=[Create context from a named context]:from:__docker_complete_contexts" \ + "($help -):name: " && ret=0 + ;; + (use) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -)1:context:__docker_complete_contexts" && ret=0 + ;; + (inspect) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -)1:context:__docker_complete_contexts" && ret=0 + ;; + (rm) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -)1:context:__docker_complete_contexts" && ret=0 + ;; + (update) + _arguments $(__docker_arguments) \ + $opts_help \ + "($help)--default-stack-orchestrator=[Default orchestrator for stack operations to use with this context]:default-stack-orchestrator:(swarm kubernetes all)" \ + "($help)--description=[Description of the context]:description:" \ + "($help)--docker=[Set the docker endpoint]:docker:" \ + "($help)--kubernetes=[Set the kubernetes endpoint]:kubernetes:" \ + "($help -):name:" && ret=0 + ;; + esac + + return ret +} + +# EO context + __docker_caching_policy() { oldp=( "$1"(Nmh+1) ) # 1 hour (( $#oldp )) @@ -2576,7 +2652,7 @@ __docker_commands() { then local -a lines lines=(${(f)"$(_call_program commands docker 2>&1)"}) - _docker_subcommands=(${${${(M)${lines[$((${lines[(i)*Commands:]} + 1)),-1]}:# *}## #}/ ##/:}) + _docker_subcommands=(${${${(M)${lines[$((${lines[(i)*Commands:]} + 1)),-1]}:# *}## #}/\*# ##/:}) _docker_subcommands=($_docker_subcommands 'daemon:Enable daemon mode' 'help:Show help for a command') (( $#_docker_subcommands > 2 )) && _store_cache docker_subcommands _docker_subcommands fi @@ -2631,6 +2707,23 @@ __docker_subcommand() { ;; esac ;; + (context) + local curcontext="$curcontext" state + _arguments $(__docker_arguments) \ + $opts_help \ + "($help -): :->command" \ + "($help -)*:: :->option-or-argument" && ret=0 + + case $state in + (command) + __docker_context_commands && ret=0 + ;; + (option-or-argument) + curcontext=${curcontext%:*:*}:docker-${words[-1]}: + __docker_context_subcommand && ret=0 + ;; + esac + ;; (daemon) _arguments $(__docker_arguments) \ $opts_help \ @@ -2698,7 +2791,8 @@ __docker_subcommand() { "($help)--tlsverify[Use TLS and verify the remote]" \ "($help)--userns-remap=[User/Group setting for user namespaces]:user\:group:->users-groups" \ "($help)--userland-proxy[Use userland proxy for loopback traffic]" \ - "($help)--userland-proxy-path=[Path to the userland proxy binary]:binary:_files" && ret=0 + "($help)--userland-proxy-path=[Path to the userland proxy binary]:binary:_files" \ + "($help)--validate[Validate daemon configuration and exit]" && ret=0 case $state in (cluster-store) From 4e6e49652b69557c01ef1ce81c96da7eb9b34e6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 15 Sep 2021 18:18:25 +0200 Subject: [PATCH 114/896] fix(plugins): fix `_comps` error in completion generation plugins (#10190) Fixes #10190 --- plugins/cargo/cargo.plugin.zsh | 17 +++++++++++------ plugins/deno/deno.plugin.zsh | 16 +++++++++++----- plugins/fnm/fnm.plugin.zsh | 17 +++++++++++------ plugins/gh/gh.plugin.zsh | 17 +++++++++++------ plugins/rustup/rustup.plugin.zsh | 18 +++++++++++------- 5 files changed, 55 insertions(+), 30 deletions(-) diff --git a/plugins/cargo/cargo.plugin.zsh b/plugins/cargo/cargo.plugin.zsh index 92eae5359..b636d492f 100644 --- a/plugins/cargo/cargo.plugin.zsh +++ b/plugins/cargo/cargo.plugin.zsh @@ -1,11 +1,16 @@ -# COMPLETION FUNCTION if (( $+commands[rustup] && $+commands[cargo] )); then - if [[ ! -f $ZSH_CACHE_DIR/cargo_version ]] \ - || [[ "$(cargo --version)" != "$(< "$ZSH_CACHE_DIR/cargo_version")" ]] \ - || [[ ! -f $ZSH/plugins/cargo/_cargo ]]; then - rustup completions zsh cargo > $ZSH/plugins/cargo/_cargo - cargo --version > $ZSH_CACHE_DIR/cargo_version + ver="$(cargo --version)" + ver_file="$ZSH_CACHE_DIR/cargo_version" + comp_file="$ZSH/plugins/cargo/_cargo" + + if [[ ! -f "$comp_file" || ! -f "$ver_file" || "$ver" != "$(< "$ver_file")" ]]; then + rustup completions zsh cargo >| "$comp_file" + echo "$ver" >| "$ver_file" fi + + declare -A _comps autoload -Uz _cargo _comps[cargo]=_cargo + + unset ver ver_file comp_file fi diff --git a/plugins/deno/deno.plugin.zsh b/plugins/deno/deno.plugin.zsh index a37b3bec4..71749f4a0 100644 --- a/plugins/deno/deno.plugin.zsh +++ b/plugins/deno/deno.plugin.zsh @@ -12,12 +12,18 @@ alias dup='deno upgrade' # COMPLETION FUNCTION if (( $+commands[deno] )); then - if [[ ! -f $ZSH_CACHE_DIR/deno_version ]] \ - || [[ "$(deno --version)" != "$(< "$ZSH_CACHE_DIR/deno_version")" ]] \ - || [[ ! -f $ZSH/plugins/deno/_deno ]]; then - deno completions zsh > $ZSH/plugins/deno/_deno - deno --version > $ZSH_CACHE_DIR/deno_version + ver="$(deno --version)" + ver_file="$ZSH_CACHE_DIR/deno_version" + comp_file="$ZSH/plugins/deno/_deno" + + if [[ ! -f "$comp_file" || ! -f "$ver_file" || "$ver" != "$(< "$ver_file")" ]]; then + deno completions zsh >| "$comp_file" + echo "$ver" >| "$ver_file" fi + + declare -A _comps autoload -Uz _deno _comps[deno]=_deno + + unset ver ver_file comp_file fi diff --git a/plugins/fnm/fnm.plugin.zsh b/plugins/fnm/fnm.plugin.zsh index 5ce558dcb..29b759abb 100644 --- a/plugins/fnm/fnm.plugin.zsh +++ b/plugins/fnm/fnm.plugin.zsh @@ -1,12 +1,17 @@ -# COMPLETION FUNCTION if (( $+commands[fnm] )); then - if [[ ! -f $ZSH_CACHE_DIR/fnm_version ]] \ - || [[ "$(fnm --version)" != "$(< "$ZSH_CACHE_DIR/fnm_version")" ]] \ - || [[ ! -f $ZSH/plugins/fnm/_fnm ]]; then - fnm completions --shell=zsh > $ZSH/plugins/fnm/_fnm - fnm --version > $ZSH_CACHE_DIR/fnm_version + ver="$(fnm --version)" + ver_file="$ZSH_CACHE_DIR/fnm_version" + comp_file="$ZSH/plugins/fnm/_fnm" + + if [[ ! -f "$comp_file" || ! -f "$ver_file" || "$ver" != "$(< "$ver_file")" ]]; then + fnm completions --shell=zsh >| "$comp_file" + echo "$ver" >| "$ver_file" fi + + declare -A _comps autoload -Uz _fnm _comps[fnm]=_fnm + + unset ver ver_file comp_file fi diff --git a/plugins/gh/gh.plugin.zsh b/plugins/gh/gh.plugin.zsh index 8e055ec35..c3d87848d 100644 --- a/plugins/gh/gh.plugin.zsh +++ b/plugins/gh/gh.plugin.zsh @@ -1,13 +1,18 @@ # Autocompletion for the GitHub CLI (gh). - if (( $+commands[gh] )); then - if [[ ! -r "$ZSH_CACHE_DIR/gh_version" \ - || "$(gh --version)" != "$(< "$ZSH_CACHE_DIR/gh_version")" - || ! -f "$ZSH/plugins/gh/_gh" ]]; then - gh completion --shell zsh > $ZSH/plugins/gh/_gh - gh --version > $ZSH_CACHE_DIR/gh_version + ver="$(gh --version)" + ver_file="$ZSH_CACHE_DIR/gh_version" + comp_file="$ZSH/plugins/gh/_gh" + + if [[ ! -f "$comp_file" || ! -f "$ver_file" || "$ver" != "$(< "$ver_file")" ]]; then + gh completion --shell zsh >| "$comp_file" + echo "$ver" >| "$ver_file" fi + + declare -A _comps autoload -Uz _gh _comps[gh]=_gh + + unset ver ver_file comp_file fi diff --git a/plugins/rustup/rustup.plugin.zsh b/plugins/rustup/rustup.plugin.zsh index c7a9b3060..e709f41bd 100644 --- a/plugins/rustup/rustup.plugin.zsh +++ b/plugins/rustup/rustup.plugin.zsh @@ -1,12 +1,16 @@ -# COMPLETION FUNCTION if (( $+commands[rustup] )); then - if [[ ! -f $ZSH_CACHE_DIR/rustup_version ]] \ - || [[ "$(rustup --version 2> /dev/null)" \ - != "$(< "$ZSH_CACHE_DIR/rustup_version")" ]] \ - || [[ ! -f $ZSH/plugins/rustup/_rustup ]]; then - rustup completions zsh > $ZSH/plugins/rustup/_rustup - rustup --version 2> /dev/null > $ZSH_CACHE_DIR/rustup_version + ver="$(rustup --version 2>/dev/null)" + ver_file="$ZSH_CACHE_DIR/rustup_version" + comp_file="$ZSH/plugins/rustup/_rustup" + + if [[ ! -f "$comp_file" || ! -f "$ver_file" || "$ver" != "$(< "$ver_file")" ]]; then + rustup completions zsh >| "$comp_file" + echo "$ver" >| "$ver_file" fi + + declare -A _comps autoload -Uz _rustup _comps[rustup]=_rustup + + unset ver ver_file comp_file fi From d2269180b074263f4a0d3df3f9de15a1abae8110 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 15 Sep 2021 18:41:44 +0200 Subject: [PATCH 115/896] fix(core): move plugin-generated completion files to `$ZSH_CACHE_DIR/completions` Fixes #10183 --- oh-my-zsh.sh | 4 ++++ plugins/cargo/cargo.plugin.zsh | 5 ++++- plugins/deno/deno.plugin.zsh | 5 ++++- plugins/fnm/fnm.plugin.zsh | 5 ++++- plugins/gh/gh.plugin.zsh | 5 ++++- plugins/rustup/rustup.plugin.zsh | 5 ++++- 6 files changed, 24 insertions(+), 5 deletions(-) diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index 16e244be5..442972a9a 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -7,6 +7,10 @@ if [[ -z "$ZSH_CACHE_DIR" ]]; then ZSH_CACHE_DIR="$ZSH/cache" fi +# Create completions cache dir and add to $fpath +mkdir -p "$ZSH_CACHE_DIR/completions" +(( ${fpath[(Ie)$ZSH_CACHE_DIR/completions]} )) || fpath=("$ZSH_CACHE_DIR/completions" $fpath) + # Check for updates on initial load... if [ "$DISABLE_AUTO_UPDATE" != "true" ]; then source $ZSH/tools/check_for_upgrade.sh diff --git a/plugins/cargo/cargo.plugin.zsh b/plugins/cargo/cargo.plugin.zsh index b636d492f..95e63dd3c 100644 --- a/plugins/cargo/cargo.plugin.zsh +++ b/plugins/cargo/cargo.plugin.zsh @@ -1,7 +1,10 @@ if (( $+commands[rustup] && $+commands[cargo] )); then ver="$(cargo --version)" ver_file="$ZSH_CACHE_DIR/cargo_version" - comp_file="$ZSH/plugins/cargo/_cargo" + comp_file="$ZSH_CACHE_DIR/completions/_cargo" + + mkdir -p "${comp_file:h}" + (( ${fpath[(Ie)${comp_file:h}]} )) || fpath=("${comp_file:h}" $fpath) if [[ ! -f "$comp_file" || ! -f "$ver_file" || "$ver" != "$(< "$ver_file")" ]]; then rustup completions zsh cargo >| "$comp_file" diff --git a/plugins/deno/deno.plugin.zsh b/plugins/deno/deno.plugin.zsh index 71749f4a0..e22c4e4c8 100644 --- a/plugins/deno/deno.plugin.zsh +++ b/plugins/deno/deno.plugin.zsh @@ -14,7 +14,10 @@ alias dup='deno upgrade' if (( $+commands[deno] )); then ver="$(deno --version)" ver_file="$ZSH_CACHE_DIR/deno_version" - comp_file="$ZSH/plugins/deno/_deno" + comp_file="$ZSH_CACHE_DIR/completions/_deno" + + mkdir -p "${comp_file:h}" + (( ${fpath[(Ie)${comp_file:h}]} )) || fpath=("${comp_file:h}" $fpath) if [[ ! -f "$comp_file" || ! -f "$ver_file" || "$ver" != "$(< "$ver_file")" ]]; then deno completions zsh >| "$comp_file" diff --git a/plugins/fnm/fnm.plugin.zsh b/plugins/fnm/fnm.plugin.zsh index 29b759abb..efb81a6fa 100644 --- a/plugins/fnm/fnm.plugin.zsh +++ b/plugins/fnm/fnm.plugin.zsh @@ -1,7 +1,10 @@ if (( $+commands[fnm] )); then ver="$(fnm --version)" ver_file="$ZSH_CACHE_DIR/fnm_version" - comp_file="$ZSH/plugins/fnm/_fnm" + comp_file="$ZSH_CACHE_DIR/completions/_fnm" + + mkdir -p "${comp_file:h}" + (( ${fpath[(Ie)${comp_file:h}]} )) || fpath=("${comp_file:h}" $fpath) if [[ ! -f "$comp_file" || ! -f "$ver_file" || "$ver" != "$(< "$ver_file")" ]]; then fnm completions --shell=zsh >| "$comp_file" diff --git a/plugins/gh/gh.plugin.zsh b/plugins/gh/gh.plugin.zsh index c3d87848d..a346ccf65 100644 --- a/plugins/gh/gh.plugin.zsh +++ b/plugins/gh/gh.plugin.zsh @@ -2,7 +2,10 @@ if (( $+commands[gh] )); then ver="$(gh --version)" ver_file="$ZSH_CACHE_DIR/gh_version" - comp_file="$ZSH/plugins/gh/_gh" + comp_file="$ZSH_CACHE_DIR/completions/_gh" + + mkdir -p "${comp_file:h}" + (( ${fpath[(Ie)${comp_file:h}]} )) || fpath=("${comp_file:h}" $fpath) if [[ ! -f "$comp_file" || ! -f "$ver_file" || "$ver" != "$(< "$ver_file")" ]]; then gh completion --shell zsh >| "$comp_file" diff --git a/plugins/rustup/rustup.plugin.zsh b/plugins/rustup/rustup.plugin.zsh index e709f41bd..8740f255a 100644 --- a/plugins/rustup/rustup.plugin.zsh +++ b/plugins/rustup/rustup.plugin.zsh @@ -1,7 +1,10 @@ if (( $+commands[rustup] )); then ver="$(rustup --version 2>/dev/null)" ver_file="$ZSH_CACHE_DIR/rustup_version" - comp_file="$ZSH/plugins/rustup/_rustup" + comp_file="$ZSH_CACHE_DIR/completions/_rustup" + + mkdir -p "${comp_file:h}" + (( ${fpath[(Ie)${comp_file:h}]} )) || fpath=("${comp_file:h}" $fpath) if [[ ! -f "$comp_file" || ! -f "$ver_file" || "$ver" != "$(< "$ver_file")" ]]; then rustup completions zsh >| "$comp_file" From eb2eacaf0c46ace8e0eb3543199851a8249338fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 15 Sep 2021 18:47:51 +0200 Subject: [PATCH 116/896] refactor(plugins): remove old generated completion files This removes .gitignore plugin files and adds a force-rm of the old completion file, which ignores any errors if the file doesn't exist. --- plugins/cargo/.gitignore | 1 - plugins/cargo/cargo.plugin.zsh | 4 ++++ plugins/deno/.gitignore | 1 - plugins/deno/deno.plugin.zsh | 3 +++ plugins/fnm/.gitignore | 2 -- plugins/fnm/fnm.plugin.zsh | 3 +++ plugins/gh/.gitignore | 1 - plugins/gh/gh.plugin.zsh | 3 +++ plugins/rustup/.gitignore | 1 - plugins/rustup/rustup.plugin.zsh | 3 +++ 10 files changed, 16 insertions(+), 6 deletions(-) delete mode 100644 plugins/cargo/.gitignore delete mode 100644 plugins/deno/.gitignore delete mode 100644 plugins/fnm/.gitignore delete mode 100644 plugins/gh/.gitignore delete mode 100644 plugins/rustup/.gitignore diff --git a/plugins/cargo/.gitignore b/plugins/cargo/.gitignore deleted file mode 100644 index 42d7ecdd6..000000000 --- a/plugins/cargo/.gitignore +++ /dev/null @@ -1 +0,0 @@ -_cargo diff --git a/plugins/cargo/cargo.plugin.zsh b/plugins/cargo/cargo.plugin.zsh index 95e63dd3c..7082d2d55 100644 --- a/plugins/cargo/cargo.plugin.zsh +++ b/plugins/cargo/cargo.plugin.zsh @@ -1,4 +1,8 @@ if (( $+commands[rustup] && $+commands[cargo] )); then + # remove old generated completion file + command rm -f "${0:A:h}/_cargo" + + # generate new completion file ver="$(cargo --version)" ver_file="$ZSH_CACHE_DIR/cargo_version" comp_file="$ZSH_CACHE_DIR/completions/_cargo" diff --git a/plugins/deno/.gitignore b/plugins/deno/.gitignore deleted file mode 100644 index cba5b03e8..000000000 --- a/plugins/deno/.gitignore +++ /dev/null @@ -1 +0,0 @@ -_deno diff --git a/plugins/deno/deno.plugin.zsh b/plugins/deno/deno.plugin.zsh index e22c4e4c8..34adddc37 100644 --- a/plugins/deno/deno.plugin.zsh +++ b/plugins/deno/deno.plugin.zsh @@ -12,6 +12,9 @@ alias dup='deno upgrade' # COMPLETION FUNCTION if (( $+commands[deno] )); then + # remove old generated completion file + command rm -f "${0:A:h}/_deno" + ver="$(deno --version)" ver_file="$ZSH_CACHE_DIR/deno_version" comp_file="$ZSH_CACHE_DIR/completions/_deno" diff --git a/plugins/fnm/.gitignore b/plugins/fnm/.gitignore deleted file mode 100644 index 0b2bc9ab7..000000000 --- a/plugins/fnm/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -_fnm - diff --git a/plugins/fnm/fnm.plugin.zsh b/plugins/fnm/fnm.plugin.zsh index efb81a6fa..c161b27cd 100644 --- a/plugins/fnm/fnm.plugin.zsh +++ b/plugins/fnm/fnm.plugin.zsh @@ -1,4 +1,7 @@ if (( $+commands[fnm] )); then + # remove old generated completion file + command rm -f "${0:A:h}/_fnm" + ver="$(fnm --version)" ver_file="$ZSH_CACHE_DIR/fnm_version" comp_file="$ZSH_CACHE_DIR/completions/_fnm" diff --git a/plugins/gh/.gitignore b/plugins/gh/.gitignore deleted file mode 100644 index fa1244ab5..000000000 --- a/plugins/gh/.gitignore +++ /dev/null @@ -1 +0,0 @@ -_gh diff --git a/plugins/gh/gh.plugin.zsh b/plugins/gh/gh.plugin.zsh index a346ccf65..3e4cdee5e 100644 --- a/plugins/gh/gh.plugin.zsh +++ b/plugins/gh/gh.plugin.zsh @@ -1,5 +1,8 @@ # Autocompletion for the GitHub CLI (gh). if (( $+commands[gh] )); then + # remove old generated completion file + command rm -f "${0:A:h}/_gh" + ver="$(gh --version)" ver_file="$ZSH_CACHE_DIR/gh_version" comp_file="$ZSH_CACHE_DIR/completions/_gh" diff --git a/plugins/rustup/.gitignore b/plugins/rustup/.gitignore deleted file mode 100644 index ad38ae3bf..000000000 --- a/plugins/rustup/.gitignore +++ /dev/null @@ -1 +0,0 @@ -_rustup diff --git a/plugins/rustup/rustup.plugin.zsh b/plugins/rustup/rustup.plugin.zsh index 8740f255a..c6efc1b13 100644 --- a/plugins/rustup/rustup.plugin.zsh +++ b/plugins/rustup/rustup.plugin.zsh @@ -1,4 +1,7 @@ if (( $+commands[rustup] )); then + # remove old generated completion file + command rm -f "${0:A:h}/_rustup" + ver="$(rustup --version 2>/dev/null)" ver_file="$ZSH_CACHE_DIR/rustup_version" comp_file="$ZSH_CACHE_DIR/completions/_rustup" From 8784e88552ad7f6f6a9c149a739474e0b168a840 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 15 Sep 2021 20:38:54 +0200 Subject: [PATCH 117/896] fix(core): use `$HOME/.cache` if default cache dir is non-writable (#10193) Fixes #10193 --- oh-my-zsh.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index 442972a9a..cea466100 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -7,7 +7,12 @@ if [[ -z "$ZSH_CACHE_DIR" ]]; then ZSH_CACHE_DIR="$ZSH/cache" fi -# Create completions cache dir and add to $fpath +# Make sure $ZSH_CACHE_DIR is writable, otherwise use a directory in $HOME +if [[ ! -w "$ZSH_CACHE_DIR" ]]; then + ZSH_CACHE_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/ohmyzsh" +fi + +# Create cache and completions dir and add to $fpath mkdir -p "$ZSH_CACHE_DIR/completions" (( ${fpath[(Ie)$ZSH_CACHE_DIR/completions]} )) || fpath=("$ZSH_CACHE_DIR/completions" $fpath) From 93b557e291ba60286bcd49f5d3e4ac61730b3f7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 15 Sep 2021 20:45:26 +0200 Subject: [PATCH 118/896] style(core): make alternative cache directory equivalent to Arch Linux package The oh-my-zsh-git package sets the cache directory to `$HOME/.cache/oh-my-zsh`, so Oh My Zsh will be compatible with it. --- oh-my-zsh.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index cea466100..83c8f8057 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -9,7 +9,7 @@ fi # Make sure $ZSH_CACHE_DIR is writable, otherwise use a directory in $HOME if [[ ! -w "$ZSH_CACHE_DIR" ]]; then - ZSH_CACHE_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/ohmyzsh" + ZSH_CACHE_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/oh-my-zsh" fi # Create cache and completions dir and add to $fpath From 29ec52602ff947675ea9a1788d62c0c552bd01af Mon Sep 17 00:00:00 2001 From: Muhammad Zahalqa Date: Thu, 16 Sep 2021 17:44:35 +0300 Subject: [PATCH 119/896] feat(golang): add `gota` to test current directory recursively (#8974) --- plugins/golang/README.md | 1 + plugins/golang/golang.plugin.zsh | 1 + 2 files changed, 2 insertions(+) diff --git a/plugins/golang/README.md b/plugins/golang/README.md index 0a1b43c30..0c90aa10b 100644 --- a/plugins/golang/README.md +++ b/plugins/golang/README.md @@ -27,4 +27,5 @@ plugins=(... golang) | gops | `cd $GOPATH/src` | Takes you to $GOPATH/src | | gor | `go run` | Compiles and runs your code | | got | `go test` | Runs tests | +| gota | `go test ./...` | Runs tests in all subdirectories | | gov | `go vet` | Vet examines Go source code and reports suspicious constructs | diff --git a/plugins/golang/golang.plugin.zsh b/plugins/golang/golang.plugin.zsh index 398bd966f..eedde2573 100644 --- a/plugins/golang/golang.plugin.zsh +++ b/plugins/golang/golang.plugin.zsh @@ -271,4 +271,5 @@ alias gopb='cd $GOPATH/bin' alias gops='cd $GOPATH/src' alias gor='go run' alias got='go test' +alias gota='go test ./...' alias gov='go vet' From 4bd5d03e51ae289a986ab63e94bf4e1c96a75786 Mon Sep 17 00:00:00 2001 From: Tristan Messner Date: Sun, 21 Apr 2019 20:20:23 -0400 Subject: [PATCH 120/896] feat(golang): add `goga` alias to install dependencies in current directory, recursively (#7786) Closes #7786 --- plugins/golang/README.md | 1 + plugins/golang/golang.plugin.zsh | 1 + 2 files changed, 2 insertions(+) diff --git a/plugins/golang/README.md b/plugins/golang/README.md index 0c90aa10b..af2c4dff9 100644 --- a/plugins/golang/README.md +++ b/plugins/golang/README.md @@ -19,6 +19,7 @@ plugins=(... golang) | gof | `go fmt` | Gofmt formats (aligns and indents) Go programs. | | gofa | `go fmt ./...` | Run go fmt for all packages in current directory, recursively | | gog | `go get` | Downloads packages and then installs them to $GOPATH | +| gog | `go get ./...` | Installs all dependencies in current directory, recursively | | goi | `go install` | Compiles and installs packages to $GOPATH | | gol | `go list` | Lists Go packages | | gom | `go mod` | Access to operations on modules | diff --git a/plugins/golang/golang.plugin.zsh b/plugins/golang/golang.plugin.zsh index eedde2573..fce663fd6 100644 --- a/plugins/golang/golang.plugin.zsh +++ b/plugins/golang/golang.plugin.zsh @@ -263,6 +263,7 @@ alias god='go doc' alias gof='go fmt' alias gofa='go fmt ./...' alias gog='go get' +alias goga='go get ./...' alias goi='go install' alias gol='go list' alias gom='go mod' From b79726b1c33149a429bbade49e9567a08ffa98af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 15 Sep 2021 19:06:51 +0200 Subject: [PATCH 121/896] fix(update): silence `typeset` calls in `upgrade.sh` script (#10048) Co-authored-by: yyny <6576327+yyny@users.noreply.github.com> --- tools/upgrade.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tools/upgrade.sh b/tools/upgrade.sh index e9f8bc0f9..7dec398fd 100755 --- a/tools/upgrade.sh +++ b/tools/upgrade.sh @@ -1,16 +1,23 @@ #!/usr/bin/env zsh +# Protect against running with shells other than zsh if [ -z "$ZSH_VERSION" ]; then exec zsh "$0" "$@" fi +# Protect against unwanted sourcing +case "$ZSH_EVAL_CONTEXT" in + *:file) echo "error: this file should not be sourced" && return ;; +esac + cd "$ZSH" # Use colors, but only if connected to a terminal # and that terminal supports them. -local -a RAINBOW -local RED GREEN YELLOW BLUE BOLD DIM UNDER RESET +setopt typeset_silent +typeset -a RAINBOW +typeset RED GREEN YELLOW BLUE BOLD DIM UNDER RESET if [ -t 1 ]; then RAINBOW=( From eba3be243f634a80ae8d8134bf88657afda71fbb Mon Sep 17 00:00:00 2001 From: Al-Amin Ahamed <34349365+mralaminahamed@users.noreply.github.com> Date: Sat, 18 Sep 2021 03:31:56 +0600 Subject: [PATCH 122/896] feat(archlinux): add cleanup aliases to `yaourt` and `yay` (#10184) --- plugins/archlinux/README.md | 4 ++++ plugins/archlinux/archlinux.plugin.zsh | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/plugins/archlinux/README.md b/plugins/archlinux/README.md index d6b41ee40..d4706e220 100644 --- a/plugins/archlinux/README.md +++ b/plugins/archlinux/README.md @@ -143,6 +143,8 @@ upgrades were available. Use `pacman -Que` instead. | yaupd | `yaourt -Sy` | Update and refresh local package, ABS and AUR databases | | yaupg | `yaourt -Syua` | Sync with repositories before upgrading all packages (from AUR too) | | yasu | `yaourt -Syua --no-confirm` | Same as `yaupg`, but without confirmation | +| yaclun | `yaourt -Yc` | Remove unneeded installed packages | +| yaclf | `yaourt -Scc` | Remove cache directories | | upgrade[²](#f2) | `yaourt -Syu` | Sync with repositories before upgrading packages | #### Yay[Âą](#f1) @@ -165,6 +167,8 @@ upgrades were available. Use `pacman -Que` instead. | yaupd | `yay -Sy` | Update and refresh local package, ABS and AUR databases | | yaupg | `yay -Syu` | Sync with repositories before upgrading packages | | yasu | `yay -Syu --no-confirm` | Same as `yaupg`, but without confirmation | +| yaclun | `yay -Yc` | Remove unneeded installed packages | +| yaclf | `yay -Scc` | Remove cache directories | | upgrade[²](#f2) | `yay -Syu` | Sync with repositories before upgrading packages | --- diff --git a/plugins/archlinux/archlinux.plugin.zsh b/plugins/archlinux/archlinux.plugin.zsh index c94fb8f6c..d34a4cd96 100644 --- a/plugins/archlinux/archlinux.plugin.zsh +++ b/plugins/archlinux/archlinux.plugin.zsh @@ -170,6 +170,8 @@ if (( $+commands[yaourt] )); then alias yainsd='yaourt -S --asdeps' alias yamir='yaourt -Syy' alias yaupd="yaourt -Sy" + alias yaclun='yaourt -Yc' + alias yaclf='yaourt -Scc' alias upgrade='yaourt -Syu' fi @@ -190,6 +192,8 @@ if (( $+commands[yay] )); then alias yainsd='yay -S --asdeps' alias yamir='yay -Syy' alias yaupd="yay -Sy" + alias yaclun='yay -Yc' + alias yaclf='yay -Scc' alias upgrade='yay -Syu' fi From 4d7f0cfb47b04f218a05f0f2b3deebdb7e3fdb99 Mon Sep 17 00:00:00 2001 From: Ken Crawford Date: Fri, 17 Sep 2021 17:33:12 -0400 Subject: [PATCH 123/896] docs(kubectx): fix README sample code syntax (#10199) --- plugins/kubectx/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/kubectx/README.md b/plugins/kubectx/README.md index 9a1df2617..98f1cf032 100644 --- a/plugins/kubectx/README.md +++ b/plugins/kubectx/README.md @@ -17,7 +17,7 @@ One can rename default context name for better readability. _Example_. Add to **.zshrc**: ``` -kubectx_mapping[minikube] = "mini" +kubectx_mapping[minikube]="mini" kubectx_mapping[context_name_from_kubeconfig]="$emoji[wolf_face]" kubectx_mapping[production_cluster]="%{$fg[yellow]%}prod!%{$reset_color%}" ``` From a4e68967a472132b4ffb05fbd1c86ac88d27fe42 Mon Sep 17 00:00:00 2001 From: Joshua Bedford Date: Fri, 17 Sep 2021 16:36:27 -0500 Subject: [PATCH 124/896] feat(lando): add support for `php` command (#10146) Co-authored-by: Joshua Bedford --- plugins/lando/lando.plugin.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/lando/lando.plugin.zsh b/plugins/lando/lando.plugin.zsh index aa74c9924..af53e7e5a 100644 --- a/plugins/lando/lando.plugin.zsh +++ b/plugins/lando/lando.plugin.zsh @@ -8,6 +8,7 @@ function artisan \ drush \ gulp \ npm \ + php \ wp \ yarn { if checkForLandoFile; then From f9d9d33ba42d3038a45c98d95343030f7ec39efa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Mon, 20 Sep 2021 19:57:04 +0200 Subject: [PATCH 125/896] refactor(jsontools): restructure and simplify logic --- plugins/jsontools/jsontools.plugin.zsh | 61 +++++++++++++++++--------- 1 file changed, 40 insertions(+), 21 deletions(-) diff --git a/plugins/jsontools/jsontools.plugin.zsh b/plugins/jsontools/jsontools.plugin.zsh index 912c83509..f92d336da 100644 --- a/plugins/jsontools/jsontools.plugin.zsh +++ b/plugins/jsontools/jsontools.plugin.zsh @@ -1,42 +1,61 @@ # JSON Tools # Adds command line aliases useful for dealing with JSON -if [[ $(whence $JSONTOOLS_METHOD) = "" ]]; then - JSONTOOLS_METHOD="" +# Check that user-defined method is installed +if [[ -n "$JSONTOOLS_METHOD" ]]; then + (( $+commands[$JSONTOOLS_METHOD] )) || unset JSONTOOLS_METHOD fi -if [[ $(whence node) != "" && ( "x$JSONTOOLS_METHOD" = "x" || "x$JSONTOOLS_METHOD" = "xnode" ) ]]; then - alias pp_json='xargs -0 node -e "console.log(JSON.stringify(JSON.parse(process.argv[1]), null, 4));"' - alias is_json='xargs -0 node -e "try {json = JSON.parse(process.argv[1]);} catch (e) { console.log(false); json = null; } if(json) { console.log(true); }"' - alias urlencode_json='xargs -0 node -e "console.log(encodeURIComponent(process.argv[1]))"' - alias urldecode_json='xargs -0 node -e "console.log(decodeURIComponent(process.argv[1]))"' -elif [[ $(whence python) != "" && ( "x$JSONTOOLS_METHOD" = "x" || "x$JSONTOOLS_METHOD" = "xpython" ) ]]; then - alias pp_json='python -c "import sys; del sys.path[0]; import runpy; runpy._run_module_as_main(\"json.tool\")"' - alias is_json='python -c " +# If method undefined, find the first one that is installed +if [[ ! -v JSONTOOLS_METHOD ]]; then + for JSONTOOLS_METHOD in node python ruby; do + # If method found, break out of loop + (( $+commands[$JSONTOOLS_METHOD] )) && break + # Otherwise unset the variable + unset JSONTOOLS_METHOD + done + + # If no methods were found, exit the plugin + [[ -v JSONTOOLS_METHOD ]] || return 1 +fi + +# Define json tools for each method +case "$JSONTOOLS_METHOD" in + node) + alias pp_json='xargs -0 node -e "console.log(JSON.stringify(JSON.parse(process.argv[1]), null, 4));"' + alias is_json='xargs -0 node -e "try {json = JSON.parse(process.argv[1]);} catch (e) { console.log(false); json = null; } if(json) { console.log(true); }"' + alias urlencode_json='xargs -0 node -e "console.log(encodeURIComponent(process.argv[1]))"' + alias urldecode_json='xargs -0 node -e "console.log(decodeURIComponent(process.argv[1]))"' + ;; + python) + alias pp_json='python -c "import sys; del sys.path[0]; import runpy; runpy._run_module_as_main(\"json.tool\")"' + alias is_json='python -c " import sys; del sys.path[0]; import json; try: - json.loads(sys.stdin.read()) + json.loads(sys.stdin.read()) except ValueError, e: - print False + print False else: - print True + print True sys.exit(0)"' - alias urlencode_json='python -c " + alias urlencode_json='python -c " import sys; del sys.path[0]; import urllib, json; print urllib.quote_plus(sys.stdin.read()) sys.exit(0)"' - alias urldecode_json='python -c " + alias urldecode_json='python -c " import sys; del sys.path[0]; import urllib, json; print urllib.unquote_plus(sys.stdin.read()) sys.exit(0)"' -elif [[ $(whence ruby) != "" && ( "x$JSONTOOLS_METHOD" = "x" || "x$JSONTOOLS_METHOD" = "xruby" ) ]]; then - alias pp_json='ruby -e "require \"json\"; require \"yaml\"; puts JSON.parse(STDIN.read).to_yaml"' - alias is_json='ruby -e "require \"json\"; begin; JSON.parse(STDIN.read); puts true; rescue Exception => e; puts false; end"' - alias urlencode_json='ruby -e "require \"uri\"; puts URI.escape(STDIN.read)"' - alias urldecode_json='ruby -e "require \"uri\"; puts URI.unescape(STDIN.read)"' -fi + ;; + ruby) + alias pp_json='ruby -e "require \"json\"; require \"yaml\"; puts JSON.parse(STDIN.read).to_yaml"' + alias is_json='ruby -e "require \"json\"; begin; JSON.parse(STDIN.read); puts true; rescue Exception => e; puts false; end"' + alias urlencode_json='ruby -e "require \"uri\"; puts URI.escape(STDIN.read)"' + alias urldecode_json='ruby -e "require \"uri\"; puts URI.unescape(STDIN.read)"' + ;; +esac unset JSONTOOLS_METHOD From b5909396370db43ba1c6c2513b1745991e5f60d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Mon, 20 Sep 2021 19:58:34 +0200 Subject: [PATCH 126/896] refactor(jsontools): move to functions, align `is_json` tool to return exit code Also: - Fix Python code in accordance with Python 3 - Use CGI module in Ruby to encode/decode strings --- plugins/jsontools/jsontools.plugin.zsh | 96 +++++++++++++++++++------- 1 file changed, 70 insertions(+), 26 deletions(-) diff --git a/plugins/jsontools/jsontools.plugin.zsh b/plugins/jsontools/jsontools.plugin.zsh index f92d336da..b518288ad 100644 --- a/plugins/jsontools/jsontools.plugin.zsh +++ b/plugins/jsontools/jsontools.plugin.zsh @@ -22,39 +22,83 @@ fi # Define json tools for each method case "$JSONTOOLS_METHOD" in node) - alias pp_json='xargs -0 node -e "console.log(JSON.stringify(JSON.parse(process.argv[1]), null, 4));"' - alias is_json='xargs -0 node -e "try {json = JSON.parse(process.argv[1]);} catch (e) { console.log(false); json = null; } if(json) { console.log(true); }"' - alias urlencode_json='xargs -0 node -e "console.log(encodeURIComponent(process.argv[1]))"' - alias urldecode_json='xargs -0 node -e "console.log(decodeURIComponent(process.argv[1]))"' + # node doesn't make it easy to deal with stdin, so we pass it as an argument with xargs -0 + function pp_json() { + xargs -0 node -e 'console.log(JSON.stringify(JSON.parse(process.argv[1]), null, 4));' + } + function is_json() { + xargs -0 node -e ' + try { + json = JSON.parse(process.argv[1]); + console.log("true"); + process.exit(0); + } catch (e) { + console.log("false"); + process.exit(1); + } + ' + } + function urlencode_json() { + xargs -0 node -e "console.log(encodeURIComponent(process.argv[1]))" + } + function urldecode_json() { + xargs -0 node -e "console.log(decodeURIComponent(process.argv[1]))" + } ;; python) - alias pp_json='python -c "import sys; del sys.path[0]; import runpy; runpy._run_module_as_main(\"json.tool\")"' - alias is_json='python -c " + function pp_json() { + python -c 'import sys; del sys.path[0]; import runpy; runpy._run_module_as_main("json.tool")' + } + function is_json() { + python -c ' import sys; del sys.path[0]; -import json; -try: - json.loads(sys.stdin.read()) -except ValueError, e: - print False -else: - print True -sys.exit(0)"' - alias urlencode_json='python -c " +import json +try: + json.loads(sys.stdin.read()) + print("true"); sys.exit(0) +except ValueError: + print("false"); sys.exit(1) + ' + } + function urlencode_json() { + python -c ' import sys; del sys.path[0]; -import urllib, json; -print urllib.quote_plus(sys.stdin.read()) -sys.exit(0)"' - alias urldecode_json='python -c " +from urllib.parse import quote_plus +print(quote_plus(sys.stdin.read())) + ' + } + function urldecode_json() { + python -c ' import sys; del sys.path[0]; -import urllib, json; -print urllib.unquote_plus(sys.stdin.read()) -sys.exit(0)"' +from urllib.parse import unquote_plus +print(unquote_plus(sys.stdin.read())) + ' + } ;; ruby) - alias pp_json='ruby -e "require \"json\"; require \"yaml\"; puts JSON.parse(STDIN.read).to_yaml"' - alias is_json='ruby -e "require \"json\"; begin; JSON.parse(STDIN.read); puts true; rescue Exception => e; puts false; end"' - alias urlencode_json='ruby -e "require \"uri\"; puts URI.escape(STDIN.read)"' - alias urldecode_json='ruby -e "require \"uri\"; puts URI.unescape(STDIN.read)"' + function pp_json() { + ruby -e ' + require "json" + require "yaml" + puts JSON.parse(STDIN.read).to_yaml + ' + } + function is_json() { + ruby -e ' + require "json" + begin + puts !!JSON.parse(STDIN.read); exit(0) + rescue JSON::ParserError + puts false; exit(1) + end + ' + } + function urlencode_json() { + ruby -e 'require "cgi"; puts CGI.escape(STDIN.read)' + } + function urldecode_json() { + ruby -e 'require "cgi"; puts CGI.unescape(STDIN.read)' + } ;; esac From 7ded6752fd34c513b0110b236c2ebd4fbbcd1a6f Mon Sep 17 00:00:00 2001 From: Eduardo Flores Date: Fri, 10 Sep 2021 17:52:00 -0500 Subject: [PATCH 127/896] feat(jsontools): add tools to pretty print json-lines (ndjson) (#10176) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Marc CornellĂ  --- plugins/jsontools/README.md | 47 +++++++++++++++++++++----- plugins/jsontools/jsontools.plugin.zsh | 10 +++++- 2 files changed, 48 insertions(+), 9 deletions(-) diff --git a/plugins/jsontools/README.md b/plugins/jsontools/README.md index 1fa2b8eed..6a2740014 100644 --- a/plugins/jsontools/README.md +++ b/plugins/jsontools/README.md @@ -17,32 +17,63 @@ Usage is simple... just take your json data and pipe it into the appropriate jso - `urlencode_json`: returns a url encoded string for the given json. - `urldecode_json`: returns decoded json for the given url encoded string. +### Supports NDJSON (Newline Delimited JSON) + +The plugin also supports [NDJSON](http://ndjson.org/) input, which means all functions +have an alternative function that reads and processes the input line by line. These +functions have the same name except using `ndjson` instead of `json`: + +> `pp_ndjson`, `is_ndjson`, `urlencode_ndjson`, `urldecode_ndjson`. + ### Examples - **pp_json**: -```sh +```console # curl json data and pretty print the results curl https://coderwall.com/bobwilliams.json | pp_json ``` - **is_json**: -```sh -# Validate if file's content conforms to a valid JSON schema -less data.json | is_json +```console +# validate if file's content conforms to a valid JSON schema +$ is_json < data.json +true +# shows true / false and returns the proper exit code +$ echo $? +0 ``` - **urlencode_json**: -```sh +```console # json data directly from the command line -echo '{"b":2, "a":1}' | urlencode_json +$ echo '{"b":2, "a":1}' | urlencode_json +%7B%22b%22:2,%20%22a%22:1%7D ``` - **urldecode_json**: -```sh +```console # url encoded string to decode -echo '%7B%22b%22:2,%20%22a%22:1%7D%0A' | urldecode_json +$ echo '%7B%22b%22:2,%20%22a%22:1%7D' | urldecode_json +{"b":2, "a":1} +``` + +- **pp_ndjson**: + +```console +# echo two separate json objects and pretty print both +$ echo '{"a": "b"}\n{"c": [1,2,3]}' | pp_ndjson +{ + "a": "b" +} +{ + "c": [ + 1, + 2, + 3 + ] +} ``` diff --git a/plugins/jsontools/jsontools.plugin.zsh b/plugins/jsontools/jsontools.plugin.zsh index b518288ad..ed45cfa8e 100644 --- a/plugins/jsontools/jsontools.plugin.zsh +++ b/plugins/jsontools/jsontools.plugin.zsh @@ -101,5 +101,13 @@ print(unquote_plus(sys.stdin.read())) } ;; esac - unset JSONTOOLS_METHOD + +## Add NDJSON support + +function {pp,is,urlencode,urldecode}_ndjson() { + local json jsonfunc="${0//ndjson/json}" + while read -r json; do + $jsonfunc <<< "$json" + done +} From 098bcda6910aa2f734fb0ad59ac089157a239c87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Thu, 9 Sep 2021 12:57:59 +0200 Subject: [PATCH 128/896] feat(update): allow updating from branch set up on install Closes #8788 Co-authored-by: Nikolas Garofil --- tools/install.sh | 42 ++++++++++++++++++++++-------------------- tools/upgrade.sh | 17 +++++++++++++++-- 2 files changed, 37 insertions(+), 22 deletions(-) diff --git a/tools/install.sh b/tools/install.sh index cfc2808fe..510f83ce8 100755 --- a/tools/install.sh +++ b/tools/install.sh @@ -53,7 +53,7 @@ KEEP_ZSHRC=${KEEP_ZSHRC:-no} command_exists() { - command -v "$@" >/dev/null 2>&1 + command -v "$@" >/dev/null 2>&1 } fmt_error() { @@ -65,27 +65,27 @@ fmt_underline() { } fmt_code() { - # shellcheck disable=SC2016 # backtic in single-quote + # shellcheck disable=SC2016 # backtick in single-quote printf '`\033[38;5;247m%s%s`\n' "$*" "$RESET" } setup_color() { - # Only use colors if connected to a terminal - if [ -t 1 ]; then - RED=$(printf '\033[31m') - GREEN=$(printf '\033[32m') - YELLOW=$(printf '\033[33m') - BLUE=$(printf '\033[34m') - BOLD=$(printf '\033[1m') - RESET=$(printf '\033[m') - else - RED="" - GREEN="" - YELLOW="" - BLUE="" - BOLD="" - RESET="" - fi + # Only use colors if connected to a terminal + if [ -t 1 ]; then + RED=$(printf '\033[31m') + GREEN=$(printf '\033[32m') + YELLOW=$(printf '\033[33m') + BLUE=$(printf '\033[34m') + BOLD=$(printf '\033[1m') + RESET=$(printf '\033[m') + else + RED="" + GREEN="" + YELLOW="" + BLUE="" + BOLD="" + RESET="" + fi } setup_ohmyzsh() { @@ -114,6 +114,8 @@ setup_ohmyzsh() { -c fsck.zeroPaddedFilemode=ignore \ -c fetch.fsck.zeroPaddedFilemode=ignore \ -c receive.fsck.zeroPaddedFilemode=ignore \ + -c oh-my-zsh.remote=origin \ + -c oh-my-zsh.branch="$BRANCH" \ --depth=1 --branch "$BRANCH" "$REMOTE" "$ZSH" || { fmt_error "git clone of oh-my-zsh repo failed" exit 1 @@ -157,9 +159,9 @@ setup_zshrc() { sed "/^export ZSH=/ c\\ export ZSH=\"$ZSH\" " "$ZSH/templates/zshrc.zsh-template" > ~/.zshrc-omztemp - mv -f ~/.zshrc-omztemp ~/.zshrc + mv -f ~/.zshrc-omztemp ~/.zshrc - echo + echo } setup_shell() { diff --git a/tools/upgrade.sh b/tools/upgrade.sh index 7dec398fd..1424d1433 100755 --- a/tools/upgrade.sh +++ b/tools/upgrade.sh @@ -66,10 +66,20 @@ git config rebase.autoStash true local ret=0 +# repository settings +remote=${"$(git config --local oh-my-zsh.remote)":-origin} +branch=${"$(git config --local oh-my-zsh.branch)":-master} + +# repository state +last_head=$(git symbolic-ref --quiet --short HEAD || git rev-parse HEAD) +# checkout update branch +git checkout -q "$branch" -- || exit 1 +# branch commit before update (used in changelog) +last_commit=$(git rev-parse "$branch") + # Update Oh My Zsh printf "${BLUE}%s${RESET}\n" "Updating Oh My Zsh" -last_commit=$(git rev-parse HEAD) -if git pull --rebase --stat origin master; then +if git pull --rebase --stat $remote $branch; then # Check if it was really updated or not if [[ "$(git rev-parse HEAD)" = "$last_commit" ]]; then message="Oh My Zsh is already at the latest version." @@ -103,6 +113,9 @@ else printf "${RED}%s${RESET}\n" 'There was an error updating. Try again later?' fi +# go back to HEAD previous to update +git checkout -q "$last_head" -- + # Unset git-config values set just for the upgrade case "$resetAutoStash" in "") git config --unset rebase.autoStash ;; From 3e4b520190f1e4aaced9267bd5dcde59b3d0211f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 22 Sep 2021 10:36:28 +0200 Subject: [PATCH 129/896] refactor(django)!: deprecate plugin in favor of Zsh's django completion BREAKING CHANGE: Zsh already provides completion for the `django-admin` and `manage.py` commands, which is substantially better than the one provided by this plugin. We're therefore deprecating this plugin and we will remove it in the near future. --- plugins/django/README.md | 38 ++++++-------------------------- plugins/django/django.plugin.zsh | 3 +++ 2 files changed, 10 insertions(+), 31 deletions(-) diff --git a/plugins/django/README.md b/plugins/django/README.md index 1740e55e5..cfab43980 100644 --- a/plugins/django/README.md +++ b/plugins/django/README.md @@ -1,36 +1,12 @@ # Django plugin -This plugin adds completion and hints for the [Django Project](https://www.djangoproject.com/) `manage.py` commands -and options. +This plugin adds completion for the [Django Project](https://www.djangoproject.com/) commands +(`manage.py`, `django-admin`, ...). -To use it, add `django` to the plugins array in your zshrc file: +## Deprecation (2021-09-22) -```zsh -plugins=(... django) -``` +The plugin used to provide completion for `./manage.py` and `django-admin`, but Zsh already provides +a better, more extensive completion for those, so this plugin is no longer needed. -## Usage - -```zsh -$> python manage.py (press here) -``` - -Would result in: - -```zsh -cleanup -- remove old data from the database -compilemessages -- compile .po files to .mo for use with gettext -createcachetable -- creates table for SQL cache backend -createsuperuser -- create a superuser -dbshell -- run command-line client for the current database -diffsettings -- display differences between the current settings and Django defaults -dumpdata -- output contents of database as a fixture -flush -- execute 'sqlflush' on the current database -inspectdb -- output Django model module for tables in database -loaddata -- install the named fixture(s) in the database -makemessages -- pull out all strings marked for translation -reset -- executes 'sqlreset' for the given app(s) -runfcgi -- run this project as a fastcgi -runserver -- start a lightweight web server for development -... -``` +Right now a warning message is shown, but in the near future the plugin will stop working altogether. +So you can remove it from your plugins and you'll automatically start using Zsh's django completion. diff --git a/plugins/django/django.plugin.zsh b/plugins/django/django.plugin.zsh index c2d00c171..a07a30889 100644 --- a/plugins/django/django.plugin.zsh +++ b/plugins/django/django.plugin.zsh @@ -402,3 +402,6 @@ compdef _managepy django compdef _managepy django-admin compdef _managepy django-admin.py compdef _managepy django-manage + +print -P "%F{yellow}The django plugin is deprecated in favor of Zsh's Django completion. +%BPlease remove it from your plugins to stop using it.%b%f" From 16de51404773a5e849c25a95e7612e212e7256a7 Mon Sep 17 00:00:00 2001 From: Simon Rogers Date: Thu, 5 Nov 2020 10:40:45 +0000 Subject: [PATCH 130/896] feat(lib): allow setting custom completion dots sequence (#9424) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #9424 Closes #9703 Co-authored-by: mortezadadgar Co-authored-by: Marc CornellĂ  --- lib/completion.zsh | 7 +++++-- templates/zshrc.zsh-template | 5 +++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/completion.zsh b/lib/completion.zsh index ebaab0856..2c5695487 100644 --- a/lib/completion.zsh +++ b/lib/completion.zsh @@ -58,9 +58,12 @@ zstyle ':completion:*:*:*:users' ignored-patterns \ # ... unless we really want to. zstyle '*' single-ignored show -if [[ $COMPLETION_WAITING_DOTS = true ]]; then +if [[ ${COMPLETION_WAITING_DOTS:-false} != false ]]; then expand-or-complete-with-dots() { - print -Pn "%F{red}…%f" + # use $COMPLETION_WAITING_DOTS either as toggle or as the sequence to show + [[ $COMPLETION_WAITING_DOTS = true ]] && COMPLETION_WAITING_DOTS="%F{red}…%f" + # turn off line wrapping and print prompt-expanded "dot" sequence + printf '\e[?7l%s\e[?7h' "${(%)COMPLETION_WAITING_DOTS}" zle expand-or-complete zle redisplay } diff --git a/templates/zshrc.zsh-template b/templates/zshrc.zsh-template index 65d5ea65b..4a998c2fc 100644 --- a/templates/zshrc.zsh-template +++ b/templates/zshrc.zsh-template @@ -45,8 +45,9 @@ ZSH_THEME="robbyrussell" # ENABLE_CORRECTION="true" # Uncomment the following line to display red dots whilst waiting for completion. -# Caution: this setting can cause issues with multiline prompts (zsh 5.7.1 and newer seem to work) -# See https://github.com/ohmyzsh/ohmyzsh/issues/5765 +# You can also set it to another string to have that shown instead of the default red dots. +# e.g. COMPLETION_WAITING_DOTS="%F{yellow}waiting...%f" +# Caution: this setting can cause issues with multiline prompts in zsh < 5.7.1 (see #5765) # COMPLETION_WAITING_DOTS="true" # Uncomment the following line if you want to disable marking untracked files From 5b3d2b2f0c02ef059fcbcbdb619b22318b8cc13a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 22 Sep 2021 11:58:23 +0200 Subject: [PATCH 131/896] Revert "feat(archlinux): add cleanup aliases to `yaourt` and `yay` (#10184)" This reverts commit eba3be243f634a80ae8d8134bf88657afda71fbb. --- plugins/archlinux/README.md | 4 ---- plugins/archlinux/archlinux.plugin.zsh | 4 ---- 2 files changed, 8 deletions(-) diff --git a/plugins/archlinux/README.md b/plugins/archlinux/README.md index d4706e220..d6b41ee40 100644 --- a/plugins/archlinux/README.md +++ b/plugins/archlinux/README.md @@ -143,8 +143,6 @@ upgrades were available. Use `pacman -Que` instead. | yaupd | `yaourt -Sy` | Update and refresh local package, ABS and AUR databases | | yaupg | `yaourt -Syua` | Sync with repositories before upgrading all packages (from AUR too) | | yasu | `yaourt -Syua --no-confirm` | Same as `yaupg`, but without confirmation | -| yaclun | `yaourt -Yc` | Remove unneeded installed packages | -| yaclf | `yaourt -Scc` | Remove cache directories | | upgrade[²](#f2) | `yaourt -Syu` | Sync with repositories before upgrading packages | #### Yay[Âą](#f1) @@ -167,8 +165,6 @@ upgrades were available. Use `pacman -Que` instead. | yaupd | `yay -Sy` | Update and refresh local package, ABS and AUR databases | | yaupg | `yay -Syu` | Sync with repositories before upgrading packages | | yasu | `yay -Syu --no-confirm` | Same as `yaupg`, but without confirmation | -| yaclun | `yay -Yc` | Remove unneeded installed packages | -| yaclf | `yay -Scc` | Remove cache directories | | upgrade[²](#f2) | `yay -Syu` | Sync with repositories before upgrading packages | --- diff --git a/plugins/archlinux/archlinux.plugin.zsh b/plugins/archlinux/archlinux.plugin.zsh index d34a4cd96..c94fb8f6c 100644 --- a/plugins/archlinux/archlinux.plugin.zsh +++ b/plugins/archlinux/archlinux.plugin.zsh @@ -170,8 +170,6 @@ if (( $+commands[yaourt] )); then alias yainsd='yaourt -S --asdeps' alias yamir='yaourt -Syy' alias yaupd="yaourt -Sy" - alias yaclun='yaourt -Yc' - alias yaclf='yaourt -Scc' alias upgrade='yaourt -Syu' fi @@ -192,8 +190,6 @@ if (( $+commands[yay] )); then alias yainsd='yay -S --asdeps' alias yamir='yay -Syy' alias yaupd="yay -Sy" - alias yaclun='yay -Yc' - alias yaclf='yay -Scc' alias upgrade='yay -Syu' fi From d87f29f564286c4a233e454d8208b83b97b1366d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Thu, 23 Sep 2021 12:33:37 +0200 Subject: [PATCH 132/896] refactor(vim-interaction): clean up code and open gvim instance if none open (#10209) Co-authored-by: Kevin Bader --- .../vim-interaction.plugin.zsh | 48 +++++++++++-------- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/plugins/vim-interaction/vim-interaction.plugin.zsh b/plugins/vim-interaction/vim-interaction.plugin.zsh index 53ec453e8..b73f9b4da 100644 --- a/plugins/vim-interaction/vim-interaction.plugin.zsh +++ b/plugins/vim-interaction/vim-interaction.plugin.zsh @@ -4,8 +4,7 @@ # Derek Wyatt (derek@{myfirstnamemylastname}.org # -function callvim -{ +function callvim { if [[ $# == 0 ]]; then cat <} == $after ]]; then - after="$after" - fi - if [[ ${before#:} != $before && ${before%} == $before ]]; then - before="$before" - fi - local files - if [[ $# -gt 0 ]]; then - # absolute path of files resolving symlinks (:A) and quoting special chars (:q) - files=':args! '"${@:A:q}" - fi + + # If before or after commands begin with : and don't end with , append it + [[ ${after} = :* && ${after} != *\ ]] && after+="" + [[ ${before} = :* && ${before} != *\ ]] && before+="" + # Open files passed (:A means abs path resolving symlinks, :q means quoting special chars) + [[ $# -gt 0 ]] && files=':args! '"${@:A:q}" + # Pass the built vim command to gvim cmd="$before$files$after" - gvim --servername "$name" --remote-send "$cmd" - if typeset -f postCallVim > /dev/null; then - postCallVim - fi + + # Run the gvim command + gvim --servername "$name" --remote-send "$cmd" || return $? + + # Run postCallVim if defined (maybe to bring focus to gvim, see README) + (( ! $+functions[postCallVim] )) || postCallVim } alias v=callvim From 57e8c959a02ca8c2aeda3980480a50a1f82f6953 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Thu, 23 Sep 2021 18:28:34 +0200 Subject: [PATCH 133/896] style(installer): use rainbow logo and polish success message (#10211) --- tools/install.sh | 155 ++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 125 insertions(+), 30 deletions(-) diff --git a/tools/install.sh b/tools/install.sh index 510f83ce8..7704107c8 100755 --- a/tools/install.sh +++ b/tools/install.sh @@ -56,22 +56,115 @@ command_exists() { command -v "$@" >/dev/null 2>&1 } +# The [ -t 1 ] check only works when the function is not called from +# a subshell (like in `$(...)` or `(...)`, so this hack redefines the +# function at the top level to always return false when stdout is not +# a tty. +if [ -t 1 ]; then + is_tty() { + true + } +else + is_tty() { + false + } +fi + +# This function uses the logic from supports-hyperlinks[1][2], which is +# made by Kat Marchán (@zkat) and licensed under the Apache License 2.0. +# [1] https://github.com/zkat/supports-hyperlinks +# [2] https://crates.io/crates/supports-hyperlinks +# +# Copyright (c) 2021 Kat Marchán +# +# 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. +supports_hyperlinks() { + # $FORCE_HYPERLINK must be set and be non-zero (this acts as a logic bypass) + if [ -n "$FORCE_HYPERLINK" ]; then + [ "$FORCE_HYPERLINK" != 0 ] + return $? + fi + + # If stdout is not a tty, it doesn't support hyperlinks + is_tty || return 1 + + # DomTerm terminal emulator (domterm.org) + if [ -n "$DOMTERM" ]; then + return 0 + fi + + # VTE-based terminals above v0.50 (Gnome Terminal, Guake, ROXTerm, etc) + if [ -n "$VTE_VERSION" ]; then + [ $VTE_VERSION -ge 5000 ] + return $? + fi + + # If $TERM_PROGRAM is set, these terminals support hyperlinks + case "$TERM_PROGRAM" in + Hyper|iTerm.app|terminology|WezTerm) return 0 ;; + esac + + # kitty supports hyperlinks + if [ "$TERM" = xterm-kitty ]; then + return 0 + fi + + # Windows Terminal or Konsole also support hyperlinks + if [ -n "$WT_SESSION" ] || [ -n "$KONSOLE_VERSION" ]; then + return 0 + fi + + return 1 +} + +fmt_link() { + # $1: text, $2: url, $3: fallback mode + if supports_hyperlinks; then + printf '\033]8;;%s\a%s\033]8;;\a\n' "$2" "$1" + return + fi + + case "$3" in + --text) printf '%s\n' "$1" ;; + --url|*) fmt_underline "$2" ;; + esac +} + +fmt_underline() { + is_tty && printf '\033[4m%s\033[24m\n' "$*" || printf '%s\n' "$*" +} + +# shellcheck disable=SC2016 # backtick in single-quote +fmt_code() { + is_tty && printf '`\033[2m%s\033[22m`\n' "$*" || printf '`%s`\n' "$*" +} + fmt_error() { printf '%sError: %s%s\n' "$BOLD$RED" "$*" "$RESET" >&2 } -fmt_underline() { - printf '\033[4m%s\033[24m\n' "$*" -} - -fmt_code() { - # shellcheck disable=SC2016 # backtick in single-quote - printf '`\033[38;5;247m%s%s`\n' "$*" "$RESET" -} - setup_color() { # Only use colors if connected to a terminal - if [ -t 1 ]; then + if is_tty; then + RAINBOW=" + $(printf '\033[38;5;196m') + $(printf '\033[38;5;202m') + $(printf '\033[38;5;226m') + $(printf '\033[38;5;082m') + $(printf '\033[38;5;021m') + $(printf '\033[38;5;093m') + $(printf '\033[38;5;163m') + " RED=$(printf '\033[31m') GREEN=$(printf '\033[32m') YELLOW=$(printf '\033[33m') @@ -79,6 +172,7 @@ setup_color() { BOLD=$(printf '\033[1m') RESET=$(printf '\033[m') else + RAINBOW="" RED="" GREEN="" YELLOW="" @@ -243,6 +337,26 @@ EOF echo } +# shellcheck disable=SC2183 # printf string has more %s than arguments ($RAINBOW expands to multiple arguments) +print_success() { + printf '%s %s__ %s %s %s %s %s__ %s\n' $RAINBOW $RESET + printf '%s ____ %s/ /_ %s ____ ___ %s__ __ %s ____ %s_____%s/ /_ %s\n' $RAINBOW $RESET + printf '%s / __ \%s/ __ \ %s / __ `__ \%s/ / / / %s /_ / %s/ ___/%s __ \ %s\n' $RAINBOW $RESET + printf '%s/ /_/ /%s / / / %s / / / / / /%s /_/ / %s / /_%s(__ )%s / / / %s\n' $RAINBOW $RESET + printf '%s\____/%s_/ /_/ %s /_/ /_/ /_/%s\__, / %s /___/%s____/%s_/ /_/ %s\n' $RAINBOW $RESET + printf '%s %s %s %s /____/ %s %s %s %s....is now installed!%s\n' $RAINBOW $GREEN $RESET + printf '\n' + printf '\n' + printf "%s %s %s\n" "Before you scream ${BOLD}${YELLOW}Oh My Zsh!${RESET} look over the" \ + "$(fmt_code "$(fmt_link ".zshrc" "file://$HOME/.zshrc" --text)")" \ + "file to select plugins, themes, and options." + printf '\n' + printf '%s\n' "• Follow us on Twitter: $(fmt_link @ohmyzsh https://twitter.com/ohmyzsh)" + printf '%s\n' "• Join our Discord community: $(fmt_link "Discord server" https://discord.gg/ohmyzsh)" + printf '%s\n' "• Get stickers, t-shirts, coffee mugs and more: $(fmt_link "Planet Argon Shop" https://shop.planetargon.com/collections/oh-my-zsh)" + printf '%s\n' $RESET +} + main() { # Run as unattended if stdin is not a tty if [ ! -t 0 ]; then @@ -293,26 +407,7 @@ EOF setup_zshrc setup_shell - printf %s "$GREEN" - cat <<'EOF' - __ __ - ____ / /_ ____ ___ __ __ ____ _____/ /_ - / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ -/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / -\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ - /____/ ....is now installed! - - -EOF - cat < Date: Fri, 24 Sep 2021 16:50:00 +0200 Subject: [PATCH 134/896] fix(init): fix `division by 0` error (#10213) Fixes #10213 --- oh-my-zsh.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index 83c8f8057..545d980f0 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -14,7 +14,7 @@ fi # Create cache and completions dir and add to $fpath mkdir -p "$ZSH_CACHE_DIR/completions" -(( ${fpath[(Ie)$ZSH_CACHE_DIR/completions]} )) || fpath=("$ZSH_CACHE_DIR/completions" $fpath) +(( ${fpath[(Ie)"$ZSH_CACHE_DIR/completions"]} )) || fpath=("$ZSH_CACHE_DIR/completions" $fpath) # Check for updates on initial load... if [ "$DISABLE_AUTO_UPDATE" != "true" ]; then From 93ad3a88214b95f571e03c21f7d9bd76f9110938 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Mon, 27 Sep 2021 11:46:42 +0200 Subject: [PATCH 135/896] docs(vi-mode): document `$KEYTIMEOUT` issue (#9588) Closes #9588 --- plugins/vi-mode/README.md | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/plugins/vi-mode/README.md b/plugins/vi-mode/README.md index b59d5f279..46bb6d070 100644 --- a/plugins/vi-mode/README.md +++ b/plugins/vi-mode/README.md @@ -64,7 +64,7 @@ NOTE: some of these key bindings are set by zsh by default when using a vi-mode - `vv` : Edit current command line in Vim -NOTE: this used to be bound to `v`. That is now the default (`visual-mode`) +NOTE: this used to be bound to `v`. That is now the default (`visual-mode`). ### Movement @@ -107,3 +107,21 @@ NOTE: this used to be bound to `v`. That is now the default (`visual-mode`) - `R` : Enter replace mode: Each character replaces existing one - `x` : Delete `count` characters under and after the cursor - `X` : Delete `count` characters before the cursor + +## Known issues + +### Low `$KEYTIMEOUT` + +A low `$KEYTIMEOUT` value (< 15) means that key bindings that need multiple characters, +like `vv`, will be very difficult to trigger. `$KEYTIMEOUT` controls the number of +milliseconds that must pass before a key press is read and the appropriate key binding +is triggered. For multi-character key bindings, the key presses need to happen before +the timeout is reached, so on low timeouts the key press happens too slow, and therefore +another key binding is triggered. + +We recommend either setting `$KEYTIMEOUT` to a higher value, or remapping the key bindings +that you want to trigger to a keyboard sequence. For example: + +```zsh +bindkey -M vicmd 'V' edit-command-line # this remaps `vv` to `V` (but overrides `visual-mode`) +``` From 33c86fe80b5d838b3d3dd454c35aa94f4a38b3f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 28 Sep 2021 11:29:42 +0200 Subject: [PATCH 136/896] fix(init): detect and abort on non-zsh shell execution of Oh My Zsh --- oh-my-zsh.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index 545d980f0..bf5902fc8 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -1,3 +1,11 @@ +# Protect against non-zsh execution of Oh My Zsh (use POSIX syntax here) +[ -n "$ZSH_VERSION" ] || { + # ANSI (\033[m): 0: reset, 1: bold, 4: underline, 22: no bold, 24: no underline, 31: red + printf "\033[1;31mERROR:\033[22m Oh My Zsh can't be loaded from: \033[1m${0#-}\033[22m. " >&2 + printf "You need to run \033[1;4mzsh\033[22;24m instead.\033[0m\n" >&2 + return 1 +} + # If ZSH is not defined, use the current script's directory. [[ -z "$ZSH" ]] && export ZSH="${${(%):-%x}:a:h}" From 4ae5bdebc36068a53fbc38a4e0d6d97e49f5b56c Mon Sep 17 00:00:00 2001 From: April King Date: Tue, 28 Sep 2021 04:40:31 -0500 Subject: [PATCH 137/896] fix(osx): only run Preview.app in `man-preview` if man page exists (#10222) --- plugins/osx/osx.plugin.zsh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh index 7842e9f73..5455d7c5f 100644 --- a/plugins/osx/osx.plugin.zsh +++ b/plugins/osx/osx.plugin.zsh @@ -219,7 +219,8 @@ function quick-look() { } function man-preview() { - man -t "$@" | open -f -a Preview + # Don't let Preview.app steal focus if the man page doesn't exist + man -w "$@" &>/dev/null && man -t "$@" | open -f -a Preview || man "$@" } compdef _man man-preview From a42db120856091257c7545473a20fbc3e295c633 Mon Sep 17 00:00:00 2001 From: nowshed-imran Date: Sat, 6 Mar 2021 16:50:12 +0600 Subject: [PATCH 138/896] refactor(archlinux)!: remove `yaourt` support (#9713) BREAKING CHANGE: `yaourt` is no longer maintained nor available as a package. Use `pacman` or one of the other maintained AUR helpers. Closes #9713 --- plugins/archlinux/README.md | 46 ++++++-------------------- plugins/archlinux/archlinux.plugin.zsh | 23 +------------ 2 files changed, 11 insertions(+), 58 deletions(-) diff --git a/plugins/archlinux/README.md b/plugins/archlinux/README.md index d6b41ee40..c8ec1de1e 100644 --- a/plugins/archlinux/README.md +++ b/plugins/archlinux/README.md @@ -32,7 +32,7 @@ plugins=(... archlinux) | pacfiles | `pacman -F` | Search package file names for matching strings | | pacls | `pacman -Ql` | List files in a package | | pacown | `pacman -Qo` | Show which package owns a file | -| upgrade[²](#f2) | `sudo pacman -Syu` | Sync with repositories before upgrading packages | +| upgrade[Âą](#f1) | `sudo pacman -Syu` | Sync with repositories before upgrading packages | | Function | Description | |----------------|-----------------------------------------------------------| @@ -73,7 +73,7 @@ upgrades were available. Use `pacman -Que` instead. | auupd | `sudo aura -Sy` | Update and refresh local package, ABS and AUR databases | | auupg | `sudo sh -c "aura -Syu && aura -Au"` | Sync with repositories before upgrading all packages (from AUR too) | | ausu | `sudo sh -c "aura -Syu --no-confirm && aura -Au --no-confirm"` | Same as `auupg`, but without confirmation | -| upgrade[²](#f2) | `sudo aura -Syu` | Sync with repositories before upgrading packages | +| upgrade[Âą](#f1) | `sudo aura -Syu` | Sync with repositories before upgrading packages | | Function | Description | |-----------------|---------------------------------------------------------------------| @@ -99,7 +99,7 @@ upgrades were available. Use `pacman -Que` instead. | paupd | `pacaur -Sy` | Update and refresh local package, ABS and AUR databases | | paupg | `pacaur -Syua` | Sync with repositories before upgrading all packages (from AUR too) | | pasu | `pacaur -Syua --no-confirm` | Same as `paupg`, but without confirmation | -| upgrade[²](#f2) | `pacaur -Syu` | Sync with repositories before upgrading packages | +| upgrade[Âą](#f1) | `pacaur -Syu` | Sync with repositories before upgrading packages | #### Trizen @@ -121,31 +121,9 @@ upgrades were available. Use `pacman -Que` instead. | trupd | `trizen -Sy` | Update and refresh local package, ABS and AUR databases | | trupg | `trizen -Syua` | Sync with repositories before upgrading all packages (from AUR too) | | trsu | `trizen -Syua --no-confirm` | Same as `trupg`, but without confirmation | -| upgrade[²](#f2) | `trizen -Syu` | Sync with repositories before upgrading packages | +| upgrade[Âą](#f1) | `trizen -Syu` | Sync with repositories before upgrading packages | -#### Yaourt[Âą](#f1) - -| Alias | Command | Description | -|---------|-----------------------------------|---------------------------------------------------------------------| -| yaconf | `yaourt -C` | Fix all configuration files with vimdiff | -| yain | `yaourt -S` | Install packages from the repositories | -| yains | `yaourt -U` | Install a package from a local file | -| yainsd | `yaourt -S --asdeps` | Install packages as dependencies of another package | -| yaloc | `yaourt -Qi` | Display information about a package in the local database | -| yalocs | `yaourt -Qs` | Search for packages in the local database | -| yalst | `yaourt -Qe` | List installed packages including from AUR (tagged as "local") | -| yamir | `yaourt -Syy` | Force refresh of all package lists after updating mirrorlist | -| yaorph | `yaourt -Qtd` | Remove orphans using yaourt | -| yare | `yaourt -R` | Remove packages, keeping its settings and dependencies | -| yarem | `yaourt -Rns` | Remove packages, including its settings and unneeded dependencies | -| yarep | `yaourt -Si` | Display information about a package in the repositories | -| yareps | `yaourt -Ss` | Search for packages in the repositories | -| yaupd | `yaourt -Sy` | Update and refresh local package, ABS and AUR databases | -| yaupg | `yaourt -Syua` | Sync with repositories before upgrading all packages (from AUR too) | -| yasu | `yaourt -Syua --no-confirm` | Same as `yaupg`, but without confirmation | -| upgrade[²](#f2) | `yaourt -Syu` | Sync with repositories before upgrading packages | - -#### Yay[Âą](#f1) +#### Yay | Alias | Command | Description | |---------|--------------------------------|-------------------------------------------------------------------| @@ -165,23 +143,19 @@ upgrades were available. Use `pacman -Que` instead. | yaupd | `yay -Sy` | Update and refresh local package, ABS and AUR databases | | yaupg | `yay -Syu` | Sync with repositories before upgrading packages | | yasu | `yay -Syu --no-confirm` | Same as `yaupg`, but without confirmation | -| upgrade[²](#f2) | `yay -Syu` | Sync with repositories before upgrading packages | +| upgrade[Âą](#f1) | `yay -Syu` | Sync with repositories before upgrading packages | --- Âą -Yay and Yaourt aliases overlap. If both are installed, yay will take precedence. - -² The `upgrade` alias is set for all package managers. Its value will depend on whether the package manager is installed, checked in the following order: 1. `yay` -2. `yaourt` -3. `trizen` -4. `pacaur` -5. `aura` -6. `pacman` +2. `trizen` +3. `pacaur` +4. `aura` +5. `pacman` ## Contributors diff --git a/plugins/archlinux/archlinux.plugin.zsh b/plugins/archlinux/archlinux.plugin.zsh index c94fb8f6c..0c5782d98 100644 --- a/plugins/archlinux/archlinux.plugin.zsh +++ b/plugins/archlinux/archlinux.plugin.zsh @@ -104,7 +104,7 @@ if (( $+commands[aura] )); then alias auras='aura -As --both' alias auupd="sudo aura -Sy" alias auupg='sudo sh -c "aura -Syu && aura -Au"' - alias ausu='sudo sh -c "aura -Syu --no-confirm && aura -Au --no-confirm"' + alias ausu='sudo sh -c "aura -Syu --no-confirm && aura -Au --no-confirm"' alias upgrade='sudo aura -Syu' # extra bonus specially for aura @@ -153,26 +153,6 @@ if (( $+commands[trizen] )); then alias upgrade='trizen -Syu' fi -if (( $+commands[yaourt] )); then - alias yaconf='yaourt -C' - alias yaupg='yaourt -Syua' - alias yasu='yaourt -Syua --noconfirm' - alias yain='yaourt -S' - alias yains='yaourt -U' - alias yare='yaourt -R' - alias yarem='yaourt -Rns' - alias yarep='yaourt -Si' - alias yareps='yaourt -Ss' - alias yaloc='yaourt -Qi' - alias yalocs='yaourt -Qs' - alias yalst='yaourt -Qe' - alias yaorph='yaourt -Qtd' - alias yainsd='yaourt -S --asdeps' - alias yamir='yaourt -Syy' - alias yaupd="yaourt -Sy" - alias upgrade='yaourt -Syu' -fi - if (( $+commands[yay] )); then alias yaconf='yay -Pg' alias yaupg='yay -Syu' @@ -192,4 +172,3 @@ if (( $+commands[yay] )); then alias yaupd="yay -Sy" alias upgrade='yay -Syu' fi - From b37114b4d5804f8125d3951efde6a1b9d39610d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Mon, 27 Sep 2021 18:08:12 +0200 Subject: [PATCH 139/896] refactor(emacs): remove dependency on `require_tool.sh` and clean up code style --- plugins/emacs/emacs.plugin.zsh | 90 +++++++++++++++++----------------- 1 file changed, 44 insertions(+), 46 deletions(-) diff --git a/plugins/emacs/emacs.plugin.zsh b/plugins/emacs/emacs.plugin.zsh index 0b602d12a..027c7550f 100644 --- a/plugins/emacs/emacs.plugin.zsh +++ b/plugins/emacs/emacs.plugin.zsh @@ -9,57 +9,55 @@ # - You can share opened buffered across opened frames. # - Configuration changes made at runtime are applied to all frames. +# Require emacs version to be minimum 24 +autoload -Uz is-at-least +is-at-least 24 "${${(Az)"$(emacsclient --version 2>/dev/null)"}[2]}" || return 0 -if "$ZSH/tools/require_tool.sh" emacsclient 24 2>/dev/null ; then - export EMACS_PLUGIN_LAUNCHER="$ZSH/plugins/emacs/emacsclient.sh" +# Path to custom emacsclient launcher +export EMACS_PLUGIN_LAUNCHER="${0:A:h}/emacsclient.sh" - # set EDITOR if not already defined. - export EDITOR="${EDITOR:-${EMACS_PLUGIN_LAUNCHER}}" +# set EDITOR if not already defined. +export EDITOR="${EDITOR:-${EMACS_PLUGIN_LAUNCHER}}" - alias emacs="$EMACS_PLUGIN_LAUNCHER --no-wait" - alias e=emacs - # open terminal emacsclient - alias te="$EMACS_PLUGIN_LAUNCHER -nw" +alias emacs="$EMACS_PLUGIN_LAUNCHER --no-wait" +alias e=emacs +# open terminal emacsclient +alias te="$EMACS_PLUGIN_LAUNCHER -nw" - # same than M-x eval but from outside Emacs. - alias eeval="$EMACS_PLUGIN_LAUNCHER --eval" - # create a new X frame - alias eframe='emacsclient --alternate-editor "" --create-frame' +# same than M-x eval but from outside Emacs. +alias eeval="$EMACS_PLUGIN_LAUNCHER --eval" +# create a new X frame +alias eframe='emacsclient --alternate-editor "" --create-frame' - # Emacs ANSI Term tracking - if [[ -n "$INSIDE_EMACS" ]]; then - chpwd_emacs() { print -P "\033AnSiTc %d"; } - print -P "\033AnSiTc %d" # Track current working directory - print -P "\033AnSiTu %n" # Track username +# Emacs ANSI Term tracking +if [[ -n "$INSIDE_EMACS" ]]; then + chpwd_emacs() { print -P "\033AnSiTc %d"; } + print -P "\033AnSiTc %d" # Track current working directory + print -P "\033AnSiTu %n" # Track username - # add chpwd hook - autoload -Uz add-zsh-hook - add-zsh-hook chpwd chpwd_emacs - fi - - # Write to standard output the path to the file - # opened in the current buffer. - function efile { - local cmd="(buffer-file-name (window-buffer))" - "$EMACS_PLUGIN_LAUNCHER" --eval "$cmd" | tr -d \" - } - - # Write to standard output the directory of the file - # opened in the the current buffer - function ecd { - local cmd="(let ((buf-name (buffer-file-name (window-buffer)))) - (if buf-name (file-name-directory buf-name)))" - - local dir="$($EMACS_PLUGIN_LAUNCHER --eval $cmd | tr -d \")" - if [ -n "$dir" ] ;then - echo "$dir" - else - echo "can not deduce current buffer filename." >/dev/stderr - return 1 - fi - } + # add chpwd hook + autoload -Uz add-zsh-hook + add-zsh-hook chpwd chpwd_emacs fi -## Local Variables: -## mode: sh -## End: +# Write to standard output the path to the file +# opened in the current buffer. +function efile { + local cmd="(buffer-file-name (window-buffer))" + local file="$("$EMACS_PLUGIN_LAUNCHER" --eval "$cmd" | tr -d \")" + + if [[ -z "$file" ]]; then + echo "Can't deduce current buffer filename." >&2 + return 1 + fi + + echo "$file" +} + +# Write to standard output the directory of the file +# opened in the the current buffer +function ecd { + local file + file="$(efile)" || return $? + echo "${file:h}" +} From 27dcca5967082474229d5efafb941e0d5229c760 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 28 Sep 2021 10:10:43 +0200 Subject: [PATCH 140/896] refactor(emacs): simplify emacsclient wrapper code --- plugins/emacs/emacsclient.sh | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/plugins/emacs/emacsclient.sh b/plugins/emacs/emacsclient.sh index 04a2c2afd..0702d7a33 100755 --- a/plugins/emacs/emacsclient.sh +++ b/plugins/emacs/emacsclient.sh @@ -1,29 +1,27 @@ #!/bin/sh -_emacsfun() -{ - # get list of emacs frames. - frameslist=`emacsclient --alternate-editor '' --eval '(frame-list)' 2>/dev/null | egrep -o '(frame)+'` +emacsfun() { + local frames="$(emacsclient --alternate-editor "" -n -e "(length (frame-list))" 2>/dev/null)" - if [ "$(echo "$frameslist" | sed -n '$=')" -ge 2 ] ;then - # prevent creating another X frame if there is at least one present. - emacsclient --alternate-editor "" "$@" - else - # Create one if there is no X window yet. - emacsclient --alternate-editor "" --create-frame "$@" - fi + # Only create another X frame if there isn't one present + if [ -z "$frames" -o "$frames" -lt 2 ]; then + emacsclient --alternate-editor "" --create-frame "$@" + return $? + fi + + emacsclient --alternate-editor "" "$@" } # adopted from https://github.com/davidshepherd7/emacs-read-stdin/blob/master/emacs-read-stdin.sh # If the second argument is - then write stdin to a tempfile and open the # tempfile. (first argument will be `--no-wait` passed in by the plugin.zsh) -if [ "$#" -ge "2" -a "$2" = "-" ] -then - tempfile="$(mktemp --tmpdir emacs-stdin-$USERNAME.XXXXXXX 2>/dev/null \ - || mktemp -t emacs-stdin-$USERNAME)" # support BSD mktemp - cat - > "$tempfile" - _emacsfun --no-wait $tempfile -else - _emacsfun "$@" +if [ $# -ge 2 -a "$2" = "-" ]; then + tempfile="$(mktemp --tmpdir emacs-stdin-$USERNAME.XXXXXXX 2>/dev/null \ + || mktemp -t emacs-stdin-$USERNAME)" # support BSD mktemp + cat - > "$tempfile" + emacsfun --no-wait "$tempfile" + return $? fi + +emacsfun "$@" From 2acae3797b713db2520bb27e76f25d3de6cee48e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 28 Sep 2021 12:30:29 +0200 Subject: [PATCH 141/896] fix(emacs): assess if there are open frames of the expected type This change looks at the frame type of the open frames ('framep) and looks if they're of the type requested based on the arguments passed to emacsclient (-nw/-t/--tty require tty frames, otherwise we need graphical frames). NOTE: this code considers anything different than t as graphical terminals, including MS-DOS types (pc). I don't have such a setup to test if this is correct. --- plugins/emacs/emacsclient.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/plugins/emacs/emacsclient.sh b/plugins/emacs/emacsclient.sh index 0702d7a33..53a3a428a 100755 --- a/plugins/emacs/emacsclient.sh +++ b/plugins/emacs/emacsclient.sh @@ -1,10 +1,20 @@ #!/bin/sh emacsfun() { - local frames="$(emacsclient --alternate-editor "" -n -e "(length (frame-list))" 2>/dev/null)" + local cmd frames + + # Build the Emacs Lisp command to check for suitable frames + # See https://www.gnu.org/software/emacs/manual/html_node/elisp/Frames.html#index-framep + case "$*" in + *-t*|*--tty*|*-nw*) cmd="(memq 't (mapcar 'framep (frame-list)))" ;; # if != nil, there are tty frames + *) cmd="(delete 't (mapcar 'framep (frame-list)))" ;; # if != nil, there are graphical terminals (x, w32, ns) + esac + + # Check if there are suitable frames + frames="$(emacsclient -a '' -n -e "$cmd" 2>/dev/null)" # Only create another X frame if there isn't one present - if [ -z "$frames" -o "$frames" -lt 2 ]; then + if [ -z "$frames" -o "$frames" = nil ]; then emacsclient --alternate-editor "" --create-frame "$@" return $? fi From de76f7cb491c7d566dd94f161b5dbc32e93af914 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 28 Sep 2021 12:34:44 +0200 Subject: [PATCH 142/896] fix(emacs): correctly pass arguments to emacsclient when $2 is stdin --- plugins/emacs/emacsclient.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/plugins/emacs/emacsclient.sh b/plugins/emacs/emacsclient.sh index 53a3a428a..25efe0d68 100755 --- a/plugins/emacs/emacsclient.sh +++ b/plugins/emacs/emacsclient.sh @@ -22,16 +22,17 @@ emacsfun() { emacsclient --alternate-editor "" "$@" } - -# adopted from https://github.com/davidshepherd7/emacs-read-stdin/blob/master/emacs-read-stdin.sh +# Adapted from https://github.com/davidshepherd7/emacs-read-stdin/blob/master/emacs-read-stdin.sh # If the second argument is - then write stdin to a tempfile and open the # tempfile. (first argument will be `--no-wait` passed in by the plugin.zsh) if [ $# -ge 2 -a "$2" = "-" ]; then + # Create a tempfile to hold stdin tempfile="$(mktemp --tmpdir emacs-stdin-$USERNAME.XXXXXXX 2>/dev/null \ || mktemp -t emacs-stdin-$USERNAME)" # support BSD mktemp + # Redirect stdin to the tempfile cat - > "$tempfile" - emacsfun --no-wait "$tempfile" - return $? + # Reset $2 to the tempfile so that "$@" works as expected + set -- "$1" "$tempfile" "${@:3}" fi emacsfun "$@" From 54e3e8ef54765bb5d4548864ff2d6cff75a33976 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 29 Sep 2021 17:19:25 +0200 Subject: [PATCH 143/896] fix(lib): fix automatic title abort inside Emacs (#10124) Closes #10124 Co-authored-by: Paul Schorfheide Co-authored-by: Alastair Rankine --- lib/termsupport.zsh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh index 33451ef1f..ef0d78895 100644 --- a/lib/termsupport.zsh +++ b/lib/termsupport.zsh @@ -10,7 +10,8 @@ function title { emulate -L zsh setopt prompt_subst - [[ "$INSIDE_EMACS" == *term* ]] && return + # Don't set the title if inside emacs, unless using vterm + [[ -n "$INSIDE_EMACS" && "$INSIDE_EMACS" != vterm ]] && return # if $2 is unset use $1 as default # if it is set and empty, leave it as is @@ -29,12 +30,9 @@ function title { print -Pn "\e]2;${2:q}\a" # set window name print -Pn "\e]1;${1:q}\a" # set tab name else - # Try to use terminfo to set the title - # If the feature is available set title - if [[ -n "$terminfo[fsl]" ]] && [[ -n "$terminfo[tsl]" ]]; then - echoti tsl - print -Pn "$1" - echoti fsl + # Try to use terminfo to set the title if the feature is available + if (( ${+terminfo[fsl]} && ${+terminfo[tsl]} )); then + print -Pn "${terminfo[tsl]}$1${terminfo[fsl]}" fi fi ;; @@ -105,10 +103,12 @@ function omz_termsupport_preexec { title '$CMD' '%100>...>$LINE%<<' } -autoload -U add-zsh-hook -add-zsh-hook precmd omz_termsupport_precmd -add-zsh-hook preexec omz_termsupport_preexec +autoload -Uz add-zsh-hook +if [[ -z "$INSIDE_EMACS" || "$INSIDE_EMACS" = vterm ]]; then + add-zsh-hook precmd omz_termsupport_precmd + add-zsh-hook preexec omz_termsupport_preexec +fi # Keep Apple Terminal.app's current working directory updated # Based on this answer: https://superuser.com/a/315029 From c7a55086e16c8f1895498a859a1ef2806fa1f612 Mon Sep 17 00:00:00 2001 From: Celestino Gomes Date: Wed, 29 Sep 2021 13:07:25 -0300 Subject: [PATCH 144/896] feat(lib): don't correct `su` command arguments (#10214) --- lib/correction.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/correction.zsh b/lib/correction.zsh index c635236b5..4259d3418 100644 --- a/lib/correction.zsh +++ b/lib/correction.zsh @@ -9,6 +9,7 @@ if [[ "$ENABLE_CORRECTION" == "true" ]]; then alias mv='nocorrect mv' alias mysql='nocorrect mysql' alias sudo='nocorrect sudo' + alias su='nocorrect su' setopt correct_all fi From 54783f66b8188297448bc725c578fdc7647e9fa0 Mon Sep 17 00:00:00 2001 From: Leon <82407168+sed-i@users.noreply.github.com> Date: Wed, 29 Sep 2021 12:09:02 -0400 Subject: [PATCH 145/896] feat(juju): add plugin for Juju (juju.is) (#10075) Co-authored-by: Jon Seager --- plugins/juju/README.md | 117 ++++++++++++++++++++++++++++++++ plugins/juju/juju.plugin.zsh | 127 +++++++++++++++++++++++++++++++++++ 2 files changed, 244 insertions(+) create mode 100644 plugins/juju/README.md create mode 100644 plugins/juju/juju.plugin.zsh diff --git a/plugins/juju/README.md b/plugins/juju/README.md new file mode 100644 index 000000000..49f8b0d47 --- /dev/null +++ b/plugins/juju/README.md @@ -0,0 +1,117 @@ +# juju plugin + +This plugin provides useful aliases and functions for [juju](https://juju.is/) (for TAB completion, +refer to the [official repo](https://github.com/juju/juju/blob/develop/etc/bash_completion.d/juju)). + +To use this plugin, add `juju` to the plugins array in your zshrc file. + +```zsh +plugins=(... juju) +``` + +## Aliases + +Naming convention: + +- `!` suffix: `--force --no-wait -y`. +- `ds` suffix: `--destroy-storage`. + +### General + +| Alias | Command | Description | +|--------|---------------------------------------------|--------------------------------------------------------| +| `jdl` | `juju debug-log --ms` | Display log, with millisecond resolution | +| `jdlr` | `juju debug-log --ms --replay` | Replay entire log | +| `jh` | `juju help` | Show help on a command or other topic | +| `jssl` | `juju juju show-status-log` | Output past statuses for the specified entity | +| `jstj` | `juju status --format=json` | Show status in json format (more detailed) | +| `jst` | `juju status --relations --storage --color` | Show status, including relations and storage, in color | + +### Bootstrap + +| Alias | Command | Description | +|-------|---------------------------|-------------------------------------------| +| `jb` | `juju bootstrap` | Initializing a Juju cloud environment | +| `jbm` | `juju bootstrap microk8s` | Initializing a MicroK8s cloud environment | + +### Controller + +| Alias | Command | Description | +|----------|---------------------------------------------------------------------------------------|-------------------------------------------------------------------| +| `jdc` | `juju destroy-controller --destroy-all-models` | Destroy a controller | +| `jdc!` | `juju destroy-controller --destroy-all-models --force --no-wait -y` | Destroy a controller | +| `jdcds` | `juju destroy-controller --destroy-all-models --destroy-storage` | Destroy a controller and associated storage | +| `jdcds!` | `juju destroy-controller --destroy-all-models --destroy-storage --force --no-wait -y` | Destroy a controller and associated storage | +| `jkc` | `juju kill-controller -y -t 0` | Forcibly terminate all associated resources for a Juju controller | +| `jsw` | `juju switch` | Select or identify the current controller and model | + +### Model + +| Alias | Command | Description | +|----------|-------------------------------------------------------------|-------------------------------------------------------| +| `jam` | `juju add-model` | Add a hosted model | +| `jdm` | `juju destroy-model` | Non-recoverable, complete removal of a model | +| `jdm!` | `juju destroy-model --force --no-wait -y` | Non-recoverable, complete removal of a model | +| `jdmds` | `juju destroy-model --destroy-storage` | Non-recoverable, complete removal of a model | +| `jdmds!` | `juju destroy-model --destroy-storage --force --no-wait -y` | Non-recoverable, complete removal of a model | +| `jmc` | `juju model-config` | Display or set configuration values on a model | +| `jm` | `juju models` | List models a user can access on a controller | +| `jshm` | `juju show-model` | Show information about the current or specified model | +| `jsw` | `juju switch` | Select or identify the current controller and model | + +### Application / unit + +| Alias | Command | Description | +|----------|---------------------------------------------------------------|---------------------------------------------------------------------------| +| `jc` | `juju config` | Get, set, or reset configuration for a deployed application | +| `jde` | `juju deploy --channel=edge` | Deploy a new application or bundle from the edge channel | +| `jd` | `juju deploy` | Deploy a new application or bundle | +| `jra` | `juju run-action` | Queue an action for execution | +| `jraw` | `juju run-action --wait` | Queue an action for execution and wait for results, with optional timeout | +| `jrm` | `juju remove-application` | Remove application | +| `jrm!` | `juju remove-application --force --no-wait` | Remove application forcefully | +| `jrmds` | `juju remove-application --destroy-storage` | Remove application and destroy attached storage | +| `jrmds!` | `juju remove-application --destroy-storage --force --no-wait` | Remove application forcefully, destroying attached storage | +| `jrp` | `juju refresh --path` | Upgrade charm from local charm file | +| `jsa` | `juju scale-application` | Set the desired number of application units | +| `jsh` | `juju ssh` | Initiate an SSH session or execute a command on a Juju target | +| `jshc` | `juju ssh --container` | Initiate an SSH session or execute a command on a given container | +| `jsu` | `juju show-unit` | Displays information about a unit | + +### Storage + +| Alias | Command | Description | +|---------|-------------------------------|-------------------------------------------------| +| `jrs` | `juju remove-storage` | Remove storage | +| `jrs!` | `juju remove-storage --force` | Remove storage even if it is currently attached | + +### Relation + +| Alias | Command | Description | +|-----------|--------------------------------|-------------------------------------------------------------------| +| `jrel` | `juju relate` | Relate two applications | +| `jrmrel` | `juju remove-relation` | Remove an existing relation between two applications. | +| `jrmrel!` | `juju remove-relation --force` | Remove an existing relation between two applications, forcefully. | + +### Cross-model relation (CMR) + +| Alias | Command | Description | +|----------|--------------------|----------------------------------------------------------------| +| `jex` | `juju expose` | Make an application publicly available over the network | +| `jof` | `juju offer` | Offer application endpoints for use in other models | +| `jcon` | `juju consume` | Add a remote offer to the model | +| `jrmsas` | `juju remove-saas` | Remove consumed applications (SAAS) from the model | +| `junex` | `juju unexpose` | Remove public availability over the network for an application | + +### Bundle + +| Alias | Command | Description | +|-------|----------------------|-------------------------------------------------------------| +| `jeb` | `juju export-bundle` | Export the current model configuration as a reusable bundle | + +## Functions + +- `jaddr [unit_num]`: display app or unit IP address. +- `jreld `: display app and unit relation data. +- `wjst [interval_secs] [args_for_watch]`: watch juju status, with optional interval + (default: 5s); you may pass additional arguments to `watch`. diff --git a/plugins/juju/juju.plugin.zsh b/plugins/juju/juju.plugin.zsh new file mode 100644 index 000000000..07f15b392 --- /dev/null +++ b/plugins/juju/juju.plugin.zsh @@ -0,0 +1,127 @@ +# ---------------------------------------------------------- # +# Aliases and functions for juju (https://juju.is) # +# ---------------------------------------------------------- # + +# Load TAB completions +# You need juju's bash completion script installed. By default bash-completion's +# location will be used (i.e. pkg-config --variable=completionsdir bash-completion). +completion_file="$(pkg-config --variable=completionsdir bash-completion 2>/dev/null)/juju" || \ + completion_file="/usr/share/bash-completion/completions/juju" +[[ -f "$completion_file" ]] && source "$completion_file" +unset completion_file + +# ---------------------------------------------------------- # +# Aliases (in alphabetic order) # +# # +# Generally, # +# - `!` means --force --no-wait -y # +# - `ds` suffix means --destroy-storage # +# ---------------------------------------------------------- # +alias jam="juju add-model --config logging-config=\"=WARNING; unit=DEBUG\"\ + --config update-status-hook-interval=\"60m\"" +alias jb='juju bootstrap' +alias jbm='juju bootstrap microk8s' +alias jc='juju config' +alias jdc='juju destroy-controller --destroy-all-models' +alias 'jdc!'='juju destroy-controller --destroy-all-models --force --no-wait -y' +alias jdcds='juju destroy-controller --destroy-all-models --destroy-storage' +alias 'jdcds!'='juju destroy-controller --destroy-all-models --destroy-storage --force --no-wait -y' +alias jdm='juju destroy-model' +alias 'jdm!'='juju destroy-model --force --no-wait -y' +alias jdmds='juju destroy-model --destroy-storage' +alias 'jdmds!'='juju destroy-model --destroy-storage --force --no-wait -y' +alias jde='juju deploy --channel=edge' +alias jd='juju deploy' +alias jdl='juju debug-log --ms' +alias jdlr='juju debug-log --ms --replay' +alias jcon='juju consume' +alias jeb='juju export-bundle' +alias jex='juju expose' +alias jh='juju help' +alias jkc='juju kill-controller -y -t 0' +alias jm='juju models' +alias jmc='juju model-config' +alias jof='juju offer' +alias jra='juju run-action' +alias jraw='juju run-action --wait' +alias jrel='juju relate' +alias jrm='juju remove-application' +alias 'jrm!'='juju remove-application --force --no-wait' +alias jrmds='juju remove-application --destroy-storage' +alias 'jrmds!'='juju remove-application --destroy-storage --force --no-wait' +alias jrmrel='juju remove-relation' +alias 'jrmrel!'='juju remove-relation --force' +alias jrmsas='juju remove-saas' +alias jrp='juju refresh --path' +alias jrs='juju remove-storage' +alias 'jrs!'='juju remove-storage --force' +alias jsa='juju scale-application' +alias jsh='juju ssh' +alias jshc='juju ssh --container' +alias jshm='juju show-model' +alias jssl='juju show-status-log' +alias jstj='juju status --format=json' +alias jst='juju status --relations --storage --color' +alias jsu='juju show-unit' +alias jsw='juju switch' + +# ---------------------------------------------------------- # +# Functions (in alphabetic order) # +# ---------------------------------------------------------- # + +# Get app or unit address +jaddr() { + # $1 = app name + # $2 = unit number (optional) + if (( ! ${+commands[jq]} )); then + echo "jq is required but could not be found." >&2 + return 1 + fi + + if [[ $# -eq 1 ]]; then + # Get app address + juju status "$1" --format=json \ + | jq -r ".applications.\"$1\".address" + elif [[ $# -eq 2 ]]; then + # Get unit address + juju status "$1/$2" --format=json \ + | jq -r ".applications.\"$1\".units.\"$1/$2\".address" + else + echo "Invalid number of arguments." + echo "Usage: jaddr []" + echo "Example: jaddr karma" + echo "Example: jaddr karma 0" + return 1 + fi +} + +# Display app and unit relation data +jreld() { + # $1 = relation name + # $2 = app name + # $3 = unit number + if [[ $# -ne 3 ]]; then + echo "Invalid number of arguments." + echo "Usage: jreld " + echo "Example: jreld karma-dashboard alertmanager 0" + return 1 + fi + + local relid="$(juju run "relation-ids $1" --unit $2/$3)" + if [[ -z "$relid" ]]; then + return 1 + fi + + echo "App data:" + juju run "relation-get -r $relid --app - $2" --unit $2/$3 + echo + echo "Unit data:" + juju run "relation-get -r $relid - $2" --unit $2/$3 +} + +# Watch juju status, with optional interval (default: 5 sec) +wjst() { + local interval="${1:-5}" + shift $(( $# > 0 )) + watch -n "$interval" --color juju status --relations --storage --color "$@" +} From 5f99eb5afd3c19683f178ddb57bb9345391d3548 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Thu, 30 Sep 2021 10:18:53 +0200 Subject: [PATCH 146/896] fix(cli): get branch and tags from OMZ folder in `omz changelog` completion --- lib/cli.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cli.zsh b/lib/cli.zsh index 2189e24ca..f40a4226e 100644 --- a/lib/cli.zsh +++ b/lib/cli.zsh @@ -35,7 +35,7 @@ function _omz { elif (( CURRENT == 3 )); then case "$words[2]" in changelog) local -a refs - refs=("${(@f)$(command git for-each-ref --format="%(refname:short):%(subject)" refs/heads refs/tags)}") + refs=("${(@f)$(command git -C "$ZSH" for-each-ref --format="%(refname:short):%(subject)" refs/heads refs/tags)}") _describe 'command' refs ;; plugin) subcmds=( 'disable:Disable plugin(s)' From 72b8f0b73b56b4a5c01eada3cb93b94be39fd984 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Thu, 30 Sep 2021 15:23:11 +0200 Subject: [PATCH 147/896] fix(half-life): fix prompt color bleeding and code clean up (#10085) Fixes #10085 Closes #10223 Co-authored-by: valdaarhun --- themes/half-life.zsh-theme | 103 ++++++++++++++++++------------------- 1 file changed, 50 insertions(+), 53 deletions(-) diff --git a/themes/half-life.zsh-theme b/themes/half-life.zsh-theme index c79027ed6..c4d785126 100644 --- a/themes/half-life.zsh-theme +++ b/themes/half-life.zsh-theme @@ -7,31 +7,22 @@ # git untracked files modification from Brian Carper: # https://briancarper.net/blog/570/git-info-in-your-zsh-prompt -function virtualenv_info { - [ $VIRTUAL_ENV ] && echo '('`basename $VIRTUAL_ENV`') ' -} -PR_GIT_UPDATE=1 - -setopt prompt_subst - -autoload -U add-zsh-hook -autoload -Uz vcs_info - #use extended color palette if available -if [[ $TERM = *256color* || $TERM = *rxvt* ]]; then - turquoise="%F{81}" - orange="%F{166}" - purple="%F{135}" - hotpink="%F{161}" - limegreen="%F{118}" +if [[ $TERM = (*256color|*rxvt*) ]]; then + turquoise="%{${(%):-"%F{81}"}%}" + orange="%{${(%):-"%F{166}"}%}" + purple="%{${(%):-"%F{135}"}%}" + hotpink="%{${(%):-"%F{161}"}%}" + limegreen="%{${(%):-"%F{118}"}%}" else - turquoise="$fg[cyan]" - orange="$fg[yellow]" - purple="$fg[magenta]" - hotpink="$fg[red]" - limegreen="$fg[green]" + turquoise="%{${(%):-"%F{cyan}"}%}" + orange="%{${(%):-"%F{yellow}"}%}" + purple="%{${(%):-"%F{magenta}"}%}" + hotpink="%{${(%):-"%F{red}"}%}" + limegreen="%{${(%):-"%F{green}"}%}" fi +autoload -Uz vcs_info # enable VCS systems you use zstyle ':vcs_info:*' enable git svn @@ -47,10 +38,10 @@ zstyle ':vcs_info:*:prompt:*' check-for-changes true # %R - repository path # %S - path in the repository PR_RST="%{${reset_color}%}" -FMT_BRANCH=" on %{$turquoise%}%b%u%c${PR_RST}" -FMT_ACTION=" performing a %{$limegreen%}%a${PR_RST}" -FMT_UNSTAGED="%{$orange%} â—Ź" -FMT_STAGED="%{$limegreen%} â—Ź" +FMT_BRANCH=" on ${turquoise}%b%u%c${PR_RST}" +FMT_ACTION=" performing a ${limegreen}%a${PR_RST}" +FMT_UNSTAGED="${orange} â—Ź" +FMT_STAGED="${limegreen} â—Ź" zstyle ':vcs_info:*:prompt:*' unstagedstr "${FMT_UNSTAGED}" zstyle ':vcs_info:*:prompt:*' stagedstr "${FMT_STAGED}" @@ -59,38 +50,44 @@ zstyle ':vcs_info:*:prompt:*' formats "${FMT_BRANCH}" zstyle ':vcs_info:*:prompt:*' nvcsformats "" -function steeef_preexec { - case "$2" in - *git*) - PR_GIT_UPDATE=1 - ;; - *svn*) - PR_GIT_UPDATE=1 - ;; - esac -} -add-zsh-hook preexec steeef_preexec - function steeef_chpwd { - PR_GIT_UPDATE=1 + PR_GIT_UPDATE=1 +} + +function steeef_preexec { + case "$2" in + *git*|*svn*) PR_GIT_UPDATE=1 ;; + esac } -add-zsh-hook chpwd steeef_chpwd function steeef_precmd { - if [[ -n "$PR_GIT_UPDATE" ]] ; then - # check for untracked files or updated submodules, since vcs_info doesn't - if [[ ! -z $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then - PR_GIT_UPDATE=1 - FMT_BRANCH="${PM_RST} on %{$turquoise%}%b%u%c%{$hotpink%} â—Ź${PR_RST}" - else - FMT_BRANCH="${PM_RST} on %{$turquoise%}%b%u%c${PR_RST}" - fi - zstyle ':vcs_info:*:prompt:*' formats "${FMT_BRANCH}" + (( PR_GIT_UPDATE )) || return - vcs_info 'prompt' - PR_GIT_UPDATE= - fi + # check for untracked files or updated submodules, since vcs_info doesn't + if [[ -n "$(git ls-files --other --exclude-standard 2>/dev/null)" ]]; then + PR_GIT_UPDATE=1 + FMT_BRANCH="${PM_RST} on ${turquoise}%b%u%c${hotpink} â—Ź${PR_RST}" + else + FMT_BRANCH="${PM_RST} on ${turquoise}%b%u%c${PR_RST}" + fi + zstyle ':vcs_info:*:prompt:*' formats "${FMT_BRANCH}" + + vcs_info 'prompt' + PR_GIT_UPDATE= } -add-zsh-hook precmd steeef_precmd -PROMPT=$'%{$purple%}%n%{$reset_color%} in %{$limegreen%}%~%{$reset_color%}$(ruby_prompt_info " with%{$fg[red]%} " v g "%{$reset_color%}")$vcs_info_msg_0_%{$orange%} λ%{$reset_color%} ' +# vcs_info running hooks +PR_GIT_UPDATE=1 + +autoload -U add-zsh-hook +add-zsh-hook chpwd steeef_chpwd +add-zsh-hook precmd steeef_precmd +add-zsh-hook preexec steeef_preexec + +# ruby prompt settings +ZSH_THEME_RUBY_PROMPT_PREFIX="with%F{red} " +ZSH_THEME_RUBY_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_RVM_PROMPT_OPTIONS="v g" + +setopt prompt_subst +PROMPT="${purple}%n%{$reset_color%} in ${limegreen}%~%{$reset_color%}\$(ruby_prompt_info)\$vcs_info_msg_0_${orange} λ%{$reset_color%} " From 3c209b00d69499db93fb6aac5c79a6179ff6b855 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Thu, 30 Sep 2021 15:41:25 +0200 Subject: [PATCH 148/896] feat(cli): show current theme in `omz theme list` Fixes #9540 --- lib/cli.zsh | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/lib/cli.zsh b/lib/cli.zsh index f40a4226e..cadc82e27 100644 --- a/lib/cli.zsh +++ b/lib/cli.zsh @@ -630,17 +630,23 @@ function _omz::theme::list { return fi + # Print theme in use + if [[ -n "$ZSH_THEME" ]]; then + print -Pn "%U%BCurrent theme%b%u: " + [[ $ZSH_THEME = random ]] && echo "$RANDOM_THEME (via random)" || echo "$ZSH_THEME" + echo + fi + + # Print custom themes if there are any if (( ${#custom_themes} )); then print -P "%U%BCustom themes%b%u:" print -l ${(q-)custom_themes} | column -x + echo fi - if (( ${#builtin_themes} )); then - (( ${#custom_themes} )) && echo # add a line of separation - - print -P "%U%BBuilt-in themes%b%u:" - print -l ${(q-)builtin_themes} | column -x - fi + # Print built-in themes + print -P "%U%BBuilt-in themes%b%u:" + print -l ${(q-)builtin_themes} | column -x } function _omz::theme::set { @@ -727,6 +733,10 @@ function _omz::theme::use { _omz::log error "%B$1%b theme not found" return 1 fi + + # Update theme settings + ZSH_THEME="$1" + [[ $1 = random ]] || unset RANDOM_THEME } function _omz::update { From c6c364317d1762aafc575951c08c2cccce76fffa Mon Sep 17 00:00:00 2001 From: Kaede Hoshikawa Date: Sun, 3 Oct 2021 16:18:33 +0900 Subject: [PATCH 149/896] fix(pyenv): fix pyenv-virtualenv detection under macOS. --- plugins/pyenv/pyenv.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/pyenv/pyenv.plugin.zsh b/plugins/pyenv/pyenv.plugin.zsh index d91b5daa7..39897ed16 100644 --- a/plugins/pyenv/pyenv.plugin.zsh +++ b/plugins/pyenv/pyenv.plugin.zsh @@ -78,7 +78,7 @@ if [[ $FOUND_PYENV -eq 1 ]]; then eval "$(pyenv init - --no-rehash zsh)" # If pyenv-virtualenv exists, load it - if [[ -d "$(pyenv root)/plugins/pyenv-virtualenv" && "$ZSH_PYENV_VIRTUALENV" != false ]]; then + if [[ "$(pyenv commands)" =~ "virtualenv-init" && "$ZSH_PYENV_VIRTUALENV" != false ]]; then eval "$(pyenv virtualenv-init - zsh)" fi From 7152a942802b01cb74d7c0b99f3106f8af17439d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Mon, 4 Oct 2021 10:34:13 +0200 Subject: [PATCH 150/896] feat(init): show error and process tree if OMZ is loaded from non-zsh shells (#10234) --- oh-my-zsh.sh | 38 +++++++++++++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index bf5902fc8..c389fc963 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -1,8 +1,40 @@ # Protect against non-zsh execution of Oh My Zsh (use POSIX syntax here) [ -n "$ZSH_VERSION" ] || { - # ANSI (\033[m): 0: reset, 1: bold, 4: underline, 22: no bold, 24: no underline, 31: red - printf "\033[1;31mERROR:\033[22m Oh My Zsh can't be loaded from: \033[1m${0#-}\033[22m. " >&2 - printf "You need to run \033[1;4mzsh\033[22;24m instead.\033[0m\n" >&2 + # ANSI formatting function (\033[m) + # 0: reset, 1: bold, 4: underline, 22: no bold, 24: no underline, 31: red, 33: yellow + f() { + [ $# -gt 0 ] || return + IFS=";" printf "\033[%sm" $* + } + # If stdout is not a terminal ignore all formatting + [ -t 1 ] || f() { :; } + + ptree() { + # Get process tree of the current process + pid=$$; pids="$pid" + while [ ${pid-0} -ne 1 ] && ppid=$(ps -e -o pid,ppid | awk "\$1 == $pid { print \$2 }"); do + pids="$pids $pid"; pid=$ppid + done + + # Show process tree + case "$(uname)" in + Linux) ps -o ppid,pid,command -f -p $pids 2>/dev/null ;; + Darwin|*) ps -o ppid,pid,command -p $pids 2>/dev/null ;; + esac + + # If ps command failed, try Busybox ps + [ $? -eq 0 ] || ps -o ppid,pid,comm | awk "NR == 1 || index(\"$pids\", \$2) != 0" + } + + { + shell=$(ps -o pid,comm | awk "\$1 == $$ { print \$2 }") + printf "$(f 1 31)Error:$(f 22) Oh My Zsh can't be loaded from: $(f 1)${shell}$(f 22). " + printf "You need to run $(f 1)zsh$(f 22) instead.$(f 0)\n" + printf "$(f 33)Here's the process tree:$(f 22)\n\n" + ptree + printf "$(f 0)\n" + } >&2 + return 1 } From adef0e6081789498156fa11455f3ab4f4d36525c Mon Sep 17 00:00:00 2001 From: Nikolas Garofil Date: Mon, 4 Oct 2021 10:43:13 +0200 Subject: [PATCH 151/896] feat(git): run `gitk` in the background in `gk` and `gke` aliases (#9657) --- plugins/git/README.md | 4 ++-- plugins/git/git.plugin.zsh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/git/README.md b/plugins/git/README.md index e53d93b0b..05ef25099 100644 --- a/plugins/git/README.md +++ b/plugins/git/README.md @@ -90,8 +90,8 @@ plugins=(... git) | gignore | git update-index --assume-unchanged | | gignored | git ls-files -v \| grep "^[[:lower:]]" | | git-svn-dcommit-push | git svn dcommit && git push github $(git_main_branch):svntrunk | -| gk | gitk --all --branches | -| gke | gitk --all $(git log -g --pretty=%h) | +| gk | gitk --all --branches &! | +| gke | gitk --all $(git log -g --pretty=%h) &! | | gl | git pull | | glg | git log --stat | | glgp | git log --stat -p | diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 76e0faed3..11dff99d9 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -201,8 +201,8 @@ alias gignore='git update-index --assume-unchanged' alias gignored='git ls-files -v | grep "^[[:lower:]]"' alias git-svn-dcommit-push='git svn dcommit && git push github $(git_main_branch):svntrunk' -alias gk='\gitk --all --branches' -alias gke='\gitk --all $(git log -g --pretty=%h)' +alias gk='\gitk --all --branches &!' +alias gke='\gitk --all $(git log -g --pretty=%h) &!' alias gl='git pull' alias glg='git log --stat' From 3c9743313cc916a6cede71e333eecef4b07ce3ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Thu, 30 Sep 2021 17:20:22 +0200 Subject: [PATCH 152/896] refactor(updater): change auto-update settings to use `zstyle` --- templates/zshrc.zsh-template | 10 ++++------ tools/check_for_upgrade.sh | 27 +++++++++++++++++++++------ 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/templates/zshrc.zsh-template b/templates/zshrc.zsh-template index 4a998c2fc..7cb87078c 100644 --- a/templates/zshrc.zsh-template +++ b/templates/zshrc.zsh-template @@ -23,14 +23,12 @@ ZSH_THEME="robbyrussell" # Case-sensitive completion must be off. _ and - will be interchangeable. # HYPHEN_INSENSITIVE="true" -# Uncomment the following line to disable bi-weekly auto-update checks. -# DISABLE_AUTO_UPDATE="true" - -# Uncomment the following line to automatically update without prompting. -# DISABLE_UPDATE_PROMPT="true" +# Uncomment the following lines to change the auto-update behavior +# zstyle ':omz:update' mode disabled # disable automatic updates +# zstyle ':omz:update' mode auto # update automatically without asking # Uncomment the following line to change how often to auto-update (in days). -# export UPDATE_ZSH_DAYS=13 +# zstyle ':omz:update' frequency 13 # Uncomment the following line if pasting URLs and other text is messed up. # DISABLE_MAGIC_FUNCTIONS="true" diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh index e87da3487..fa832ffac 100644 --- a/tools/check_for_upgrade.sh +++ b/tools/check_for_upgrade.sh @@ -3,17 +3,30 @@ if [[ -f ~/.zsh-update && ! -f "${ZSH_CACHE_DIR}/.zsh-update" ]]; then mv ~/.zsh-update "${ZSH_CACHE_DIR}/.zsh-update" fi +# Get user's update preferences +# +# Supported update modes: +# - prompt (default): the user is asked before updating when it's time to update +# - auto: the update is performed automatically when it's time +# - reminder: a reminder is shown to the user when it's time to update +# - disabled: automatic update is turned off +zstyle -s ':omz:update' mode update_mode || update_mode=prompt + +# Support old-style settings +[[ "$DISABLE_UPDATE_PROMPT" != true ]] || update_mode=auto +[[ "$DISABLE_AUTO_UPDATE" != true ]] || update_mode=disabled + # Cancel update if: # - the automatic update is disabled. # - the current user doesn't have write permissions nor owns the $ZSH directory. # - git is unavailable on the system. -if [[ "$DISABLE_AUTO_UPDATE" = true ]] \ +if [[ "$update_mode" = disabled ]] \ || [[ ! -w "$ZSH" || ! -O "$ZSH" ]] \ || ! command -v git &>/dev/null; then + unset update_mode return fi - function current_epoch() { zmodload zsh/datetime echo $(( EPOCHSECONDS / 60 / 60 / 24 )) @@ -56,7 +69,6 @@ function update_ohmyzsh() { # the shell actually exits what it's running. trap " ret=\$? - unset -f current_epoch update_last_updated_file update_ohmyzsh 2>/dev/null command rm -rf '$ZSH/log/update.lock' return \$ret " EXIT INT QUIT @@ -68,14 +80,14 @@ function update_ohmyzsh() { fi # Number of days before trying to update again - epoch_target=${UPDATE_ZSH_DAYS:-13} + zstyle -s ':omz:update' frequency epoch_target || epoch_target=${UPDATE_ZSH_DAYS:-13} # Test if enough time has passed until the next update if (( ( $(current_epoch) - $LAST_EPOCH ) < $epoch_target )); then return fi - # Ask for confirmation before updating unless disabled - if [[ "$DISABLE_UPDATE_PROMPT" = true ]]; then + # Ask for confirmation before updating unless in auto mode + if [[ "$update_mode" = auto ]]; then update_ohmyzsh else # input sink to swallow all characters typed before the prompt @@ -92,3 +104,6 @@ function update_ohmyzsh() { esac fi } + +unset update_mode +unset -f current_epoch update_last_updated_file update_ohmyzsh From 0120749a54d147405beebe6f8416da0e4443ebc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Thu, 30 Sep 2021 17:22:04 +0200 Subject: [PATCH 153/896] feat(updater): add mode to only remind you to update when it's time (#10187) Fixes #10187 Co-authored-by: NoPreserveRoot --- templates/zshrc.zsh-template | 1 + tools/check_for_upgrade.sh | 2 ++ 2 files changed, 3 insertions(+) diff --git a/templates/zshrc.zsh-template b/templates/zshrc.zsh-template index 7cb87078c..58642bc41 100644 --- a/templates/zshrc.zsh-template +++ b/templates/zshrc.zsh-template @@ -26,6 +26,7 @@ ZSH_THEME="robbyrussell" # Uncomment the following lines to change the auto-update behavior # zstyle ':omz:update' mode disabled # disable automatic updates # zstyle ':omz:update' mode auto # update automatically without asking +# zstyle ':omz:update' mode reminder # just remind me to update when it's time # Uncomment the following line to change how often to auto-update (in days). # zstyle ':omz:update' frequency 13 diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh index fa832ffac..e6a4a3d69 100644 --- a/tools/check_for_upgrade.sh +++ b/tools/check_for_upgrade.sh @@ -89,6 +89,8 @@ function update_ohmyzsh() { # Ask for confirmation before updating unless in auto mode if [[ "$update_mode" = auto ]]; then update_ohmyzsh + elif [[ "$update_mode" = reminder ]]; then + echo "[oh-my-zsh] It's time to update! You can do that by running \`omz update\`" else # input sink to swallow all characters typed before the prompt # and add a newline if there wasn't one after characters typed From 30d441713c47306fe63c1ce6833ff7a6120c9a47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Thu, 30 Sep 2021 17:56:02 +0200 Subject: [PATCH 154/896] feat(updater): check if there are updates before prompting (#8387) Fixes #8387 --- tools/check_for_upgrade.sh | 44 +++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh index e6a4a3d69..157b0cce2 100644 --- a/tools/check_for_upgrade.sh +++ b/tools/check_for_upgrade.sh @@ -32,6 +32,41 @@ function current_epoch() { echo $(( EPOCHSECONDS / 60 / 60 / 24 )) } +function is_update_available() { + local branch + branch=${"$(git -C "$ZSH" config --local oh-my-zsh.branch)":-master} + + local remote remote_url remote_repo + remote=${"$(git -C "$ZSH" config --local oh-my-zsh.remote)":-origin} + remote_url=$(git -C "$ZSH" config remote.$remote.url) + + local repo + case "$remote_url" in + https://github.com/*) repo=${${remote_url#https://github.com/}%.git} ;; + git@github.com:*) repo=${${remote_url#git@github.com:}%.git} ;; + *) + # If the remote is not using GitHub we can't check for updates + # Let's assume there are updates + return 0 ;; + esac + + # If the remote repo is not the official one, let's assume there are updates available + [[ "$repo" = ohmyzsh/ohmyzsh ]] || return 0 + local api_url="https://api.github.com/repos/${repo}/commits/${branch}" + + # Get local and remote HEADs and compare them. If we can't get either assume there are updates + local local_head remote_head + local_head=$(git -C "$ZSH" rev-parse $branch 2>/dev/null) || return 0 + + remote_head=$(curl -fsSL -H 'Accept: application/vnd.github.v3.sha' $api_url 2>/dev/null) \ + || remote_head=$(wget -O- --header='Accept: application/vnd.github.v3.sha' $api_url 2>/dev/null) \ + || remote_head=$(HTTP_ACCEPT='Accept: application/vnd.github.v3.sha' fetch -o - $api_url 2>/dev/null) \ + || return 0 + + # Compare local and remote HEADs + [[ "$local_head" != "$remote_head" ]] +} + function update_last_updated_file() { echo "LAST_EPOCH=$(current_epoch)" >! "${ZSH_CACHE_DIR}/.zsh-update" } @@ -69,6 +104,8 @@ function update_ohmyzsh() { # the shell actually exits what it's running. trap " ret=\$? + unset update_mode + unset -f current_epoch is_update_available update_last_updated_file update_ohmyzsh 2>/dev/null command rm -rf '$ZSH/log/update.lock' return \$ret " EXIT INT QUIT @@ -86,6 +123,11 @@ function update_ohmyzsh() { return fi + # Check if there are updates available before proceeding + if ! is_update_available; then + return + fi + # Ask for confirmation before updating unless in auto mode if [[ "$update_mode" = auto ]]; then update_ohmyzsh @@ -108,4 +150,4 @@ function update_ohmyzsh() { } unset update_mode -unset -f current_epoch update_last_updated_file update_ohmyzsh +unset -f current_epoch is_update_available update_last_updated_file update_ohmyzsh From c396efbee3217f1d5cc433cd788a67f747a579cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Mon, 4 Oct 2021 11:26:39 +0200 Subject: [PATCH 155/896] fix(docker-compose): support Compose V2 `docker compose` command (#10248) --- .../docker-compose/docker-compose.plugin.zsh | 46 ++++++++----------- 1 file changed, 20 insertions(+), 26 deletions(-) diff --git a/plugins/docker-compose/docker-compose.plugin.zsh b/plugins/docker-compose/docker-compose.plugin.zsh index 85e03d343..2eba20a09 100644 --- a/plugins/docker-compose/docker-compose.plugin.zsh +++ b/plugins/docker-compose/docker-compose.plugin.zsh @@ -1,28 +1,22 @@ -# Authors: -# https://github.com/tristola -# -# Docker-compose related zsh aliases +# support Compose v2 as docker CLI plugin +command docker compose &>/dev/null && dccmd='docker compose' || dccmd='docker-compose' -# Aliases ################################################################### +alias dco="$dccmd" +alias dcb="$dccmd build" +alias dce="$dccmd exec" +alias dcps="$dccmd ps" +alias dcrestart="$dccmd restart" +alias dcrm="$dccmd rm" +alias dcr="$dccmd run" +alias dcstop="$dccmd stop" +alias dcup="$dccmd up" +alias dcupb="$dccmd up --build" +alias dcupd="$dccmd up -d" +alias dcdn="$dccmd down" +alias dcl="$dccmd logs" +alias dclf="$dccmd logs -f" +alias dcpull="$dccmd pull" +alias dcstart="$dccmd start" +alias dck="$dccmd kill" -# Use dco as alias for docker-compose, since dc on *nix is 'dc - an arbitrary precision calculator' -# https://www.gnu.org/software/bc/manual/dc-1.05/html_mono/dc.html - -alias dco='docker-compose' - -alias dcb='docker-compose build' -alias dce='docker-compose exec' -alias dcps='docker-compose ps' -alias dcrestart='docker-compose restart' -alias dcrm='docker-compose rm' -alias dcr='docker-compose run' -alias dcstop='docker-compose stop' -alias dcup='docker-compose up' -alias dcupb='docker-compose up --build' -alias dcupd='docker-compose up -d' -alias dcdn='docker-compose down' -alias dcl='docker-compose logs' -alias dclf='docker-compose logs -f' -alias dcpull='docker-compose pull' -alias dcstart='docker-compose start' -alias dck='docker-compose kill' +unset dccmd From a3289c11f67ec84a6a56d3bde33c1ec191800470 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Mon, 4 Oct 2021 12:02:08 +0200 Subject: [PATCH 156/896] feat(docker-compose): update completion (4fa72a0, 2021-01-19) Source: https://github.com/docker/compose/blob/4fa72a0/contrib/completion/zsh/_docker-compose Closes #9494 Co-authored-by: "Bakhir A.D" --- plugins/docker-compose/_docker-compose | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/plugins/docker-compose/_docker-compose b/plugins/docker-compose/_docker-compose index 808b068a3..c6b733500 100644 --- a/plugins/docker-compose/_docker-compose +++ b/plugins/docker-compose/_docker-compose @@ -121,12 +121,6 @@ __docker-compose_subcommand() { '--parallel[Build images in parallel.]' \ '*:services:__docker-compose_services_from_build' && ret=0 ;; - (bundle) - _arguments \ - $opts_help \ - '--push-images[Automatically push images for any services which have a `build` option specified.]' \ - '(--output -o)'{--output,-o}'[Path to write the bundle file to. Defaults to ".dab".]:file:_files' && ret=0 - ;; (config) _arguments \ $opts_help \ @@ -290,7 +284,7 @@ __docker-compose_subcommand() { (up) _arguments \ $opts_help \ - '(--abort-on-container-exit)-d[Detached mode: Run containers in the background, print new container names. Incompatible with --abort-on-container-exit.]' \ + '(--abort-on-container-exit)-d[Detached mode: Run containers in the background, print new container names. Incompatible with --abort-on-container-exit and --attach-dependencies.]' \ $opts_no_color \ $opts_no_deps \ $opts_force_recreate \ @@ -298,6 +292,7 @@ __docker-compose_subcommand() { $opts_no_build \ "(--no-build)--build[Build images before starting containers.]" \ "(-d)--abort-on-container-exit[Stops all containers if any container was stopped. Incompatible with -d.]" \ + "(-d)--attach-dependencies[Attach to dependent containers. Incompatible with -d.]" \ '(-t --timeout)'{-t,--timeout}"[Use this timeout in seconds for container shutdown when attached or when containers are already running. (default: 10)]:seconds: " \ '--scale[SERVICE=NUM Scale SERVICE to NUM instances. Overrides the `scale` setting in the Compose file if present.]:service scale SERVICE=NUM: ' \ '--exit-code-from=[Return the exit code of the selected service container. Implies --abort-on-container-exit]:service:__docker-compose_services' \ @@ -341,11 +336,13 @@ _docker-compose() { '(- :)'{-h,--help}'[Get help]' \ '*'{-f,--file}"[${file_description}]:file:_files -g '*.yml'" \ '(-p --project-name)'{-p,--project-name}'[Specify an alternate project name (default: directory name)]:project name:' \ + '--env-file[Specify an alternate environment file (default: .env)]:env-file:_files' \ "--compatibility[If set, Compose will attempt to convert keys in v3 files to their non-Swarm equivalent]" \ '(- :)'{-v,--version}'[Print version and exit]' \ '--verbose[Show more output]' \ '--log-level=[Set log level]:level:(DEBUG INFO WARNING ERROR CRITICAL)' \ '--no-ansi[Do not print ANSI control characters]' \ + '--ansi=[Control when to print ANSI control characters]:when:(never always auto)' \ '(-H --host)'{-H,--host}'[Daemon socket to connect to]:host:' \ '--tls[Use TLS; implied by --tlsverify]' \ '--tlscacert=[Trust certs signed only by this CA]:ca path:' \ @@ -359,6 +356,7 @@ _docker-compose() { local -a relevant_compose_flags relevant_compose_repeatable_flags relevant_docker_flags compose_options docker_options relevant_compose_flags=( + "--env-file" "--file" "-f" "--host" "-H" "--project-name" "-p" From 5dbb30342e1b7c4a04c3464bb16ffeb33abde139 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Mon, 4 Oct 2021 12:45:59 +0200 Subject: [PATCH 157/896] feat(yarn): update completion from zsh-completions (73505e4) Fixes #10195 --- plugins/yarn/_yarn | 184 ++++++++++++++++++++++++++++++++++----------- 1 file changed, 140 insertions(+), 44 deletions(-) diff --git a/plugins/yarn/_yarn b/plugins/yarn/_yarn index 70e783b86..70ed55929 100644 --- a/plugins/yarn/_yarn +++ b/plugins/yarn/_yarn @@ -32,15 +32,21 @@ # ------- # # * Massimiliano Torromeo +# * Shohei YOSHIDA # # ------------------------------------------------------------------------------ +declare -g _yarn_run_cwd + _commands=( 'access' + 'audit:Checks for known security issues with the installed packages' 'autoclean:Clean and remove unnecessary files from package dependencies' 'cache:List or clean every cached package' - "check:Verify package dependencies agains yarn's lock file" + "check:Verify package dependencies against yarn's lock file" 'config:Manages the yarn configuration files' + 'create:Creates new projects from any create-* starter kits' + 'exec' 'generate-lock-entry:Generates a lock file entry' 'global:Install packages globally on your operating system' 'help:Show information about a command' @@ -50,25 +56,30 @@ _commands=( 'install:Install all the dependencies listed within package.json' 'licenses:List licenses for installed packages' 'link:Symlink a package folder during development' - 'list:List installed packages' 'login:Store registry username and email' 'logout:Clear registry username and email' + 'node:Runs Node with the same version that the one used by Yarn itself' 'outdated:Check for outdated package dependencies' 'owner:Manage package owners' 'pack:Create a compressed gzip archive of package dependencies' + 'policies:Defines project-wide policies for your project' 'publish:Publish a package to the npm registry' 'run:Run a defined package script' 'tag:Add, remove, or list tags on a package' 'team:Maintain team memberships' 'unlink:Unlink a previously created symlink for a package' + 'unplug:Temporarily copies a package outside of the global cache for debugging purposes' 'version:Update the package version' 'versions:Display version information of currently installed Yarn, Node.js, and its dependencies' 'why:Show information about why a package is installed' + 'workspace' + 'workspaces:Show information about your workspaces' ) _global_commands=( 'add:Installs a package and any packages that it depends on' 'bin:Displays the location of the yarn bin folder' + 'list:List installed packages' 'remove:Remove installed package from dependencies updating package.json' 'upgrade:Upgrades packages to their latest version based on the specified range' 'upgrade-interactive:Interactively upgrade packages' @@ -76,7 +87,12 @@ _global_commands=( _yarn_commands_scripts() { local -a scripts - scripts=($(yarn run --json 2>/dev/null | sed -E '/Commands available|possibleCommands/!d;s/.*Commands available from binary scripts: ([^"]+)".*/\1/;s/.*"items":\[([^]]+).*/\1/;s/[" ]//g' | tr , '\n' | sed -e 's/:/\\:/g')) + if [[ -n $opt_args[--cwd] ]]; then + scripts=($(cd $opt_args[--cwd] && yarn run --json 2>/dev/null | sed -E '/Commands available|possibleCommands/!d;s/.*Commands available from binary scripts: ([^"]+)".*/\1/;s/.*"items":\[([^]]+).*/\1/;s/[" ]//g' | tr , '\n' | sed -e 's/:/\\:/g')) + else + scripts=($(yarn run --json 2>/dev/null | sed -E '/Commands available|possibleCommands/!d;s/.*Commands available from binary scripts: ([^"]+)".*/\1/;s/.*"items":\[([^]]+).*/\1/;s/[" ]//g' | tr , '\n' | sed -e 's/:/\\:/g')) + fi + _describe 'command or script' _commands -- _global_commands -- scripts } @@ -85,7 +101,11 @@ _yarn_scripts() { local -a scriptNames scriptCommands local i runJSON - runJSON=$(yarn run --json 2>/dev/null) + if [[ -n $_yarn_run_cwd ]]; then + runJSON=$(cd $_yarn_run_cwd && yarn run --json 2>/dev/null) + else + runJSON=$(yarn run --json 2>/dev/null) + fi # Some sed utilities (e.g. Mac OS / BSD) don't interpret `\n` in a replacement # pattern as a newline. See https://superuser.com/q/307165 binaries=($(sed -E '/Commands available/!d;s/.*Commands available from binary scripts: ([^"]+)".*/\1/;s/.*"items":\[([^]]+).*/\1/;s/[" ]//g;s/:/\\:/g;s/,/\'$'\n/g' <<< "$runJSON")) @@ -96,7 +116,7 @@ _yarn_scripts() { scripts+=("${scriptNames[$i]}:${scriptCommands[$i]}") done - commands=($scripts $binaries) + commands=('env' $scripts $binaries) _describe 'command' commands } @@ -110,6 +130,17 @@ _yarn_commands() { _describe 'command' _commands -- _global_commands } +_yarn_add_files() { + if compset -P "(file|link):"; then + _files + fi +} + +_yarn_workspaces() { + local -a workspaces=(${(@f)$(yarn workspaces info |sed -n -e 's/^ "\([^"]*\)": {/\1/p')}) + _describe 'workspace' workspaces +} + _yarn() { local context state state_descr line typeset -A opt_args @@ -118,37 +149,51 @@ _yarn() { '(-h --help)'{-h,--help}'[output usage information]' \ '(-V --version)'{-V,--version}'[output the version number]' \ '--verbose[output verbose messages on internal operations]' \ - '--offline[trigger an error if any required dependencies are not available in local cache]' \ - '--prefer-offline[use network only if dependencies are not available in local cache]' \ - '--strict-semver' \ - '--json' \ - "--ignore-scripts[don't run lifecycle scripts]" \ - '--har[save HAR output of network traffic]' \ - '--ignore-platform[ignore platform checks]' \ - '--ignore-engines[ignore engines check]' \ - '--ignore-optional[ignore optional dependencies]' \ - '--force[install and build packages even if they were built before, overwrite lockfile]' \ - '--skip-integrity-check[run install without checking if node_modules is installed]' \ - '--check-files[install will verify file tree of packages for consistency]' \ - "--no-bin-links[don't generate bin links when setting up packages]" \ - '--flat[only allow one version of a package]' \ - '(--prod --production)'{--prod,--production} \ - "--no-lockfile[don't read or generate a lockfile]" \ - "--pure-lockfile[don't generate a lockfile]" \ - "--frozen-lockfile[don't generate a lockfile and fail if an update is needed]" \ - '--link-duplicates[create hardlinks to the repeated modules in node_modules]' \ - '--global-folder=[modules folder]:folder:_files -/' \ - '--modules-folder=[rather than installing modules into the node_modules folder relative to the cwd, output them here]:folder:_files -/' \ '--cache-folder=[specify a custom folder to store the yarn cache]:folder:_files -/' \ + '--check-files[install will verify file tree of packages for consistency]' \ + '--cwd=[working directory to use]:path:_files -/' \ + "(--enable-pnp --pnp)--disable-pnp[disable the Plug'n'Play installation]" \ + '(--no-emoji)--emoji=[enable emoji in output(default: false)]:enabled:(true false)' \ + '(--emoji)--no-emoji[disable emoji in output]' \ + '(--disable-pnp)'{--enable-pnp,--pnp}"[enable the Plug'n'Play installation]" \ + '--flat[only allow one version of a package]' \ + '--focus[Focus on a single workspace by installing remote copies of its sibiling workspaces]' \ + '--force[install and build packages even if they were built before, overwrite lockfile]' \ + "--frozen-lockfile[don't generate a lockfile and fail if an update is needed]" \ + '--global-folder=[modules folder]:folder:_files -/' \ + '--har[save HAR output of network traffic]' \ + '--https-proxy=[HTTPS proxy]:host:_hosts' \ + '--ignore-engines[ignore engines check]' \ + "--ignore-scripts[don't run lifecycle scripts]" \ + '--ignore-optional[ignore optional dependencies]' \ + '--ignore-platform[ignore platform checks]' \ + '--json[format Yarn log messages as lines of JSON]' \ + '--link-duplicates[create hardlinks to the repeated modules in node_modules]' \ + '--link-folder=[specify a custom folder to store global links]' \ + '--modules-folder=[rather than installing modules into the node_modules folder relative to the cwd, output them here]:folder:_files -/' \ '--mutex=[use a mutex to ensure only one yarn instance is executing]:type[\:specifier]' \ - '--no-emoji[disable emoji in output]' \ - '(-s --silent)'{-s,--silent}'[skip Yarn console logs, other types of logs (script output) will be printed]' \ - '--proxy=:host:_hosts' \ - '--https-proxy=:host:_hosts' \ - '--no-progress[disable progress bar]' \ '--network-concurrency=[maximum number of concurrent network requests]:number' \ '--network-timeout=[TCP timeout for network requests]:milliseconds' \ + "--no-bin-links[don't generate bin links when setting up packages]" \ + '--no-default-rc[prevent Yarn from automatically detecting yarnrc and npmrc files]' \ + "--no-lockfile[don't read or generate a lockfile]" \ '--non-interactive[do not show interactive prompts]' \ + '--no-node-version-check[do not warn when using a potentially unsupported Node version]' \ + '--no-progress[disable progress bar]' \ + '--offline[trigger an error if any required dependencies are not available in local cache]' \ + '--otp=[one-time password for two factor authentication]:otpcode' \ + '--prefer-offline[use network only if dependencies are not available in local cache]' \ + '--preferred-cache-folder=[specify a custom folder to store the yarn cache if possible]:folder:_files -/' \ + '(--prod --production)'{--prod,--production}'[install only production dependencies]' \ + '--proxy=[HTTP proxy]:host:_hosts' \ + "--pure-lockfile[don't generate a lockfile]" \ + '--registry=[override configuration registry]:url:_urls' \ + '(-s --silent)'{-s,--silent}'[skip Yarn console logs, other types of logs (script output) will be printed]' \ + '--scripts-prepend-node-path=[prepend the node executable dir to the PATH in scripts]:bool:(true false)' \ + '--skip-integrity-check[run install without checking if node_modules is installed]' \ + "--strict-semver[don't compare semver loosely]" \ + '--update-checksum[update package checksums from current repository]' \ + '--use-yarnrc=[specifies a yarnrc that Yarn should use]:yarnrc:_files' \ '1: :_yarn_commands_scripts' \ '*:: :->command_args' @@ -173,18 +218,29 @@ _yarn() { '(-O --optional)'{-O,--optional}'[install packages in optionalDependencies]' \ '(-E --exact)'{-E,--exact}'[install packages as exact versions]' \ '(-T --tilde)'{-T,--tilde}'[install the most recent release of the packages that have the same minor version]' \ - '*:package-name:' + '(--ignore-workspace-root-check -W)'{--ignore-workspace-root-check,-W}'[allows a package to be installed at the workspaces root]' \ + '--audit[checks for known security issues with the installed packages]' \ + '*:package-name:_yarn_add_files' + ;; + + audit) + _arguments \ + '--verbose[output verbose message]' \ + '--json[format Yarn log messages as lines of JSON]' \ + '--level=[only print advisories with severity greater than or equal to]:level:(info low moderate high critical)' \ + '--groups=[only audit dependencies from listed groups]:groups:->groups_args' ;; cache) _arguments \ - '1: :(ls dir clean)' + '1: :(list dir clean)' \ + '*:: :->cache_args' ;; check) _arguments \ - '--integrity' \ - '--verify-tree' + '--integrity[Verifies that versions and hashed values of the package contents in package.json]' \ + '--verify-tree[Recursively verifies that the dependencies in package.json are present in node_modules]' ;; config) @@ -223,12 +279,13 @@ _yarn() { list) _arguments \ - '--depth[Limit the depth of the shown dependencies]:depth' + '--depth=[Limit the depth of the shown dependencies]:depth' \ + '--pattern=[filter the list of dependencies by the pattern]' ;; owner) _arguments \ - '1: :(ls add rm)' \ + '1: :(list add rm)' \ '*:: :->owner_args' ;; @@ -247,12 +304,22 @@ _yarn() { '1: :_files' ;; + policies) + _arguments \ + '1: :(set-version)' + ;; + remove|upgrade) _arguments \ '*:package:' ;; run) + if [[ -n $opt_args[--cwd] ]]; then + _yarn_run_cwd=$opt_args[--cwd] + else + _yarn_run_cwd='' + fi _arguments \ '1: :_yarn_scripts' \ '*:: :_default' @@ -260,26 +327,33 @@ _yarn() { tag) _arguments \ - '1: :(ls add rm)' \ + '1: :(lists add rm)' \ '*:: :->tag_args' ;; team) _arguments \ - '1: :(create destroy add rm ls)' \ + '1: :(create destroy add rm list)' \ '*:: :->team_args' ;; upgrade-interactive) _arguments \ - '--latest:use the version tagged latest in the registry:' + '--latest[use the version tagged latest in the registry]' ;; version) _arguments \ - '--new-version:version:' \ - '--message:message:' \ - '--no-git-tag-version' + '--new-version[create a new version using an interactive session to prompt you]:version:' \ + '--major[creates a new version by incrementing the major version]' \ + '--minor[creates a new version by incrementing the minor version]' \ + '--patch[creates a new version by incrementing the patch version]' \ + '--premajor[creates a new prerelease version by incrementing the major version]' \ + '--preminor[creates a new prerelease version by incrementing the minor version]' \ + '--prepatch[creates a new prerelease version by incrementing the patch version]' \ + '--prerelease[increments the prerelease version number keeping the main version]' \ + '--no-git-tag-version[creates a new version without creating a git tag]' \ + '--no-commit-hooks[bypasses running commit hooks when committing the new version]' ;; why) @@ -287,7 +361,19 @@ _yarn() { '1:query:_files' ;; - *) + workspace) + _arguments \ + '1:workspace:_yarn_workspaces' \ + '*:: :_yarn_global_commands' + ;; + + workspaces) + _arguments \ + '--json[format Yarn log messages as lines of JSON]' \ + '1:commands:(info run)' + ;; + + *) _default ;; esac @@ -295,6 +381,12 @@ _yarn() { esac case $state in + cache_args) + if [[ $words[1] == "list" ]]; then + _arguments \ + '--pattern=[print out every cached package that matches the pattern]:pattern:' + fi + ;; config_args) case $words[1] in get|delete) @@ -310,6 +402,10 @@ _yarn() { ;; esac ;; + groups_args) + local dependency_groups=(devDependencies dependencies optionalDependencies peerDependencies bundledDependencies) + _values -s ',' 'groups' $dependency_groups + ;; owner_args) case $words[1] in From d304635b8c70c6d9400d1246f1446eb76c64406c Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Mon, 4 Oct 2021 13:07:55 +0200 Subject: [PATCH 158/896] feat(yarn): add `ylnf` alias to fix linting problems (#9219) --- plugins/yarn/README.md | 1 + plugins/yarn/yarn.plugin.zsh | 1 + 2 files changed, 2 insertions(+) diff --git a/plugins/yarn/README.md b/plugins/yarn/README.md index fd748b742..9a0d1708d 100644 --- a/plugins/yarn/README.md +++ b/plugins/yarn/README.md @@ -28,6 +28,7 @@ plugins=(... yarn) | yi | `yarn init` | Interactively creates or updates a package.json file | | yin | `yarn install` | Install dependencies defined in `package.json` | | yln | `yarn lint` | Run the lint script defined in `package.json` | +| ylnf | `yarn lint --fix` | Run the lint script defined in `package.json`to automatically fix problems | | yls | `yarn list` | List installed packages | | yout | `yarn outdated` | Check for outdated package dependencies | | yp | `yarn pack` | Create a compressed gzip archive of package dependencies | diff --git a/plugins/yarn/yarn.plugin.zsh b/plugins/yarn/yarn.plugin.zsh index 4a5192c61..a240cb88e 100644 --- a/plugins/yarn/yarn.plugin.zsh +++ b/plugins/yarn/yarn.plugin.zsh @@ -13,6 +13,7 @@ alias yh="yarn help" alias yi="yarn init" alias yin="yarn install" alias yln="yarn lint" +alias ylnf="yarn lint --fix" alias yls="yarn list" alias yout="yarn outdated" alias yp="yarn pack" From 717ece07efea5e74e6d18bd647387607a6f5fc49 Mon Sep 17 00:00:00 2001 From: TheTechRobo <52163910+TheTechRobo@users.noreply.github.com> Date: Mon, 4 Oct 2021 09:55:18 -0400 Subject: [PATCH 159/896] feat(mercurial): add `hg log` aliases (#9979) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: MichaĹ‚ Kielan --- plugins/mercurial/README.md | 3 ++- plugins/mercurial/mercurial.plugin.zsh | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/mercurial/README.md b/plugins/mercurial/README.md index 80ea2de31..756964896 100644 --- a/plugins/mercurial/README.md +++ b/plugins/mercurial/README.md @@ -30,7 +30,8 @@ plugins=(... mercurial) | `hgl` | `hg pull -u` | | `hglr` | `hg pull --rebase` | | `hgo` | `hg outgoing` | - +| `hglg` | `hg log --stat -v` | +| `hglgp`| `hg log --stat -p -v` | ## Prompt usage - Switch to a theme which uses `hg_prompt_info` diff --git a/plugins/mercurial/mercurial.plugin.zsh b/plugins/mercurial/mercurial.plugin.zsh index f4efc2b4a..e098664c0 100644 --- a/plugins/mercurial/mercurial.plugin.zsh +++ b/plugins/mercurial/mercurial.plugin.zsh @@ -17,6 +17,8 @@ alias hgi='hg incoming' alias hgl='hg pull -u' alias hglr='hg pull --rebase' alias hgo='hg outgoing' +alias hglg='hg log --stat -v' +alias hglgp='hg log --stat -p -v' function in_hg() { if $(hg branch > /dev/null 2>&1); then From 56ab66b19429e5609e4331a987368ce2c844c7be Mon Sep 17 00:00:00 2001 From: Dani Torramilans Date: Mon, 4 Oct 2021 15:57:03 +0200 Subject: [PATCH 160/896] docs(python): update README to include new `py` alias (#9995) --- plugins/python/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/python/README.md b/plugins/python/README.md index 0180218a2..b95ffe679 100644 --- a/plugins/python/README.md +++ b/plugins/python/README.md @@ -11,6 +11,7 @@ plugins=(... python) | Command | Description | |------------------|---------------------------------------------------------------------------------| +| `py` | Runs `python` | | `ipython` | Runs the appropriate `ipython` version according to the activated virtualenv | | `pyfind` | Finds .py files recursively in the current directory | | `pyclean [dirs]` | Deletes byte-code and cache files from a list of directories or the current one | From be4a952972de03d501fbff79435ae41594f06bac Mon Sep 17 00:00:00 2001 From: Monson Shao Date: Fri, 3 Jul 2020 12:16:58 +0800 Subject: [PATCH 161/896] feat(cli)!: add `omz reload` command and deprecate `zsh_reload` plugin (#9078) BREAKING CHANGE: the `zsh_reload` plugin is deprecated. Instead of using its `src` function, use `omz reload` or `exec zsh` to reload zsh after making changes to your `.zshrc` file. Closes #9078 --- lib/cli.zsh | 12 ++++++++++++ plugins/zsh_reload/README.md | 22 +-------------------- plugins/zsh_reload/zsh_reload.plugin.zsh | 25 +++++------------------- 3 files changed, 18 insertions(+), 41 deletions(-) diff --git a/lib/cli.zsh b/lib/cli.zsh index cadc82e27..773891fce 100644 --- a/lib/cli.zsh +++ b/lib/cli.zsh @@ -26,6 +26,7 @@ function _omz { 'help:Usage information' 'plugin:Manage plugins' 'pr:Manage Oh My Zsh Pull Requests' + 'reload:Reload the current zsh session' 'theme:Manage themes' 'update:Update Oh My Zsh' ) @@ -159,6 +160,7 @@ Available commands: changelog Print the changelog plugin Manage plugins pr Manage Oh My Zsh Pull Requests + reload Reload the current zsh session theme Manage themes update Update Oh My Zsh @@ -598,6 +600,16 @@ function _omz::pr::test { ) } +function _omz::reload { + # Delete current completion cache + command rm -f $_comp_dumpfile $ZSH_COMPDUMP + + # Old zsh versions don't have ZSH_ARGZERO + local zsh="${ZSH_ARGZERO:-${functrace[-1]%:*}}" + # Check whether to run a login shell + [[ "$zsh" = -* || -o login ]] && exec -l "${zsh#-}" || exec "$zsh" +} + function _omz::theme { (( $# > 0 && $+functions[_omz::theme::$1] )) || { cat >&2 < Date: Mon, 4 Oct 2021 17:14:34 +0200 Subject: [PATCH 162/896] fix(per-directory-history): fix use of global history on shell start (#9008) Updated from upstream: https://github.com/jimhester/per-directory-history/blob/d2e291d/per-directory-history.zsh Fixes #9007 Closese #9008 Co-authored-by: Sebastian Marsching --- .../per-directory-history.zsh | 70 ++++++++++++------- 1 file changed, 44 insertions(+), 26 deletions(-) diff --git a/plugins/per-directory-history/per-directory-history.zsh b/plugins/per-directory-history/per-directory-history.zsh index 41de2f91d..7cd673cdb 100644 --- a/plugins/per-directory-history/per-directory-history.zsh +++ b/plugins/per-directory-history/per-directory-history.zsh @@ -32,7 +32,7 @@ # # Copyright (c) 2014 Jim Hester # -# This software is provided 'as-is', without any express or implied warranty. +# This software is provided 'as-is', without any express or implied warranty. # In no event will the authors be held liable for any damages arising from the # use of this software. # @@ -57,6 +57,7 @@ #------------------------------------------------------------------------------- [[ -z $HISTORY_BASE ]] && HISTORY_BASE="$HOME/.directory_history" +[[ -z $HISTORY_START_WITH_GLOBAL ]] && HISTORY_START_WITH_GLOBAL=false [[ -z $PER_DIRECTORY_HISTORY_TOGGLE ]] && PER_DIRECTORY_HISTORY_TOGGLE='^G' #------------------------------------------------------------------------------- @@ -66,9 +67,11 @@ function per-directory-history-toggle-history() { if [[ $_per_directory_history_is_global == true ]]; then _per-directory-history-set-directory-history + _per_directory_history_is_global=false print -n "\nusing local history" else _per-directory-history-set-global-history + _per_directory_history_is_global=true print -n "\nusing global history" fi zle .push-line @@ -114,43 +117,58 @@ function _per-directory-history-addhistory() { true else print -Sr -- "${1%%$'\n'}" + # instantly write history if set options require it. + if [[ -o share_history ]] || \ + [[ -o inc_append_history ]] || \ + [[ -o inc_append_history_time ]]; then + fc -AI $HISTFILE + fc -AI $_per_directory_history_directory + fi fc -p $_per_directory_history_directory fi } +function _per-directory-history-precmd() { + if [[ $_per_directory_history_initialized == false ]]; then + _per_directory_history_initialized=true + + if [[ $HISTORY_START_WITH_GLOBAL == true ]]; then + _per-directory-history-set-global-history + _per_directory_history_is_global=true + else + _per-directory-history-set-directory-history + _per_directory_history_is_global=false + fi + fi +} function _per-directory-history-set-directory-history() { - if [[ $_per_directory_history_is_global == true ]]; then - fc -AI $HISTFILE - local original_histsize=$HISTSIZE - HISTSIZE=0 - HISTSIZE=$original_histsize - if [[ -e "$_per_directory_history_directory" ]]; then - fc -R "$_per_directory_history_directory" - fi + fc -AI $HISTFILE + local original_histsize=$HISTSIZE + HISTSIZE=0 + HISTSIZE=$original_histsize + if [[ -e "$_per_directory_history_directory" ]]; then + fc -R "$_per_directory_history_directory" fi - _per_directory_history_is_global=false -} -function _per-directory-history-set-global-history() { - if [[ $_per_directory_history_is_global == false ]]; then - fc -AI $_per_directory_history_directory - local original_histsize=$HISTSIZE - HISTSIZE=0 - HISTSIZE=$original_histsize - if [[ -e "$HISTFILE" ]]; then - fc -R "$HISTFILE" - fi - fi - _per_directory_history_is_global=true } +function _per-directory-history-set-global-history() { + fc -AI $_per_directory_history_directory + local original_histsize=$HISTSIZE + HISTSIZE=0 + HISTSIZE=$original_histsize + if [[ -e "$HISTFILE" ]]; then + fc -R "$HISTFILE" + fi +} + +mkdir -p ${_per_directory_history_directory:h} #add functions to the exec list for chpwd and zshaddhistory autoload -U add-zsh-hook add-zsh-hook chpwd _per-directory-history-change-directory add-zsh-hook zshaddhistory _per-directory-history-addhistory +add-zsh-hook precmd _per-directory-history-precmd -#start in directory mode -mkdir -p ${_per_directory_history_directory:h} -_per_directory_history_is_global=true -_per-directory-history-set-directory-history +# set initialized flag to false +_per_directory_history_initialized=false From 714399a7c33963384ef7f21ce21f6d134416f9aa Mon Sep 17 00:00:00 2001 From: fanuch Date: Sun, 6 Oct 2019 13:19:14 +1100 Subject: [PATCH 163/896] feat(git): add `gccd` alias to clone and cd into git repository (#8220) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #8216 Closes #8220 Co-authored-by: Nelson EstevĂŁo --- plugins/git/README.md | 1 + plugins/git/git.plugin.zsh | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/plugins/git/README.md b/plugins/git/README.md index 05ef25099..b68dc552e 100644 --- a/plugins/git/README.md +++ b/plugins/git/README.md @@ -47,6 +47,7 @@ plugins=(... git) | gcb | git checkout -b | | gcf | git config --list | | gcl | git clone --recurse-submodules | +| gccd | git clone --recurse-submodules "$@" && cd "$(basename $_ .git)" | | gclean | git clean -id | | gpristine | git reset --hard && git clean -dffx | | gcm | git checkout $(git_main_branch) | diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 11dff99d9..f2431fde5 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -97,6 +97,13 @@ alias gcas='git commit -a -s' alias gcasm='git commit -a -s -m' alias gcb='git checkout -b' alias gcf='git config --list' + +function gccd() { + command git clone --recurse-submodules "$@" + [[ -d "$_" ]] && cd "$_" || cd "${${_:h}%.git}" +} +compdef _git gccd=git-clone + alias gcl='git clone --recurse-submodules' alias gclean='git clean -id' alias gpristine='git reset --hard && git clean -dffx' From a54148a43e14f1ba8d4f602ce7d452111e70ad4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Mon, 4 Oct 2021 17:51:22 +0200 Subject: [PATCH 164/896] fix(init): rename function `f` due to clash with `f` alias (#10260) Fixes #10260 --- oh-my-zsh.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index c389fc963..b388b341d 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -2,14 +2,14 @@ [ -n "$ZSH_VERSION" ] || { # ANSI formatting function (\033[m) # 0: reset, 1: bold, 4: underline, 22: no bold, 24: no underline, 31: red, 33: yellow - f() { + omz_f() { [ $# -gt 0 ] || return IFS=";" printf "\033[%sm" $* } # If stdout is not a terminal ignore all formatting - [ -t 1 ] || f() { :; } + [ -t 1 ] || omz_f() { :; } - ptree() { + omz_ptree() { # Get process tree of the current process pid=$$; pids="$pid" while [ ${pid-0} -ne 1 ] && ppid=$(ps -e -o pid,ppid | awk "\$1 == $pid { print \$2 }"); do @@ -28,11 +28,11 @@ { shell=$(ps -o pid,comm | awk "\$1 == $$ { print \$2 }") - printf "$(f 1 31)Error:$(f 22) Oh My Zsh can't be loaded from: $(f 1)${shell}$(f 22). " - printf "You need to run $(f 1)zsh$(f 22) instead.$(f 0)\n" - printf "$(f 33)Here's the process tree:$(f 22)\n\n" - ptree - printf "$(f 0)\n" + printf "$(omz_f 1 31)Error:$(omz_f 22) Oh My Zsh can't be loaded from: $(omz_f 1)${shell}$(omz_f 22). " + printf "You need to run $(omz_f 1)zsh$(omz_f 22) instead.$(omz_f 0)\n" + printf "$(omz_f 33)Here's the process tree:$(omz_f 22)\n\n" + omz_ptree + printf "$(omz_f 0)\n" } >&2 return 1 From b621eee21f269498d072ca60823ecde9777821bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 5 Oct 2021 11:58:39 +0200 Subject: [PATCH 165/896] fix(cli): fix zsh array syntax for szh 5.0.2 --- lib/cli.zsh | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/cli.zsh b/lib/cli.zsh index 773891fce..4b14360c1 100644 --- a/lib/cli.zsh +++ b/lib/cli.zsh @@ -91,7 +91,8 @@ function _omz { # NOTE: $(( CURRENT - 1 )) is the last plugin argument completely passed, i.e. that which # has a space after them. This is to avoid removing plugins partially passed, which makes # the completion not add a space after the completed plugin. - local -a args=(${words[4,$(( CURRENT - 1))]}) + local -a args + args=(${words[4,$(( CURRENT - 1))]}) valid_plugins=(${valid_plugins:|args}) _describe 'plugin' valid_plugins ;; @@ -214,7 +215,7 @@ function _omz::plugin::disable { fi # Check that plugin is in $plugins - local -a dis_plugins=() + local -a dis_plugins for plugin in "$@"; do if [[ ${plugins[(Ie)$plugin]} -eq 0 ]]; then _omz::log warn "plugin '$plugin' is not enabled." @@ -303,7 +304,7 @@ function _omz::plugin::enable { fi # Check that plugin is not in $plugins - local -a add_plugins=() + local -a add_plugins for plugin in "$@"; do if [[ ${plugins[(Ie)$plugin]} -ne 0 ]]; then _omz::log warn "plugin '$plugin' is already enabled." @@ -424,10 +425,8 @@ function _omz::plugin::load { return 1 fi - local plugins=("$@") local plugin base has_completion=0 - - for plugin in $plugins; do + for plugin in "$@"; do if [[ -d "$ZSH_CUSTOM/plugins/$plugin" ]]; then base="$ZSH_CUSTOM/plugins/$plugin" elif [[ -d "$ZSH/plugins/$plugin" ]]; then From f793baf370bdfcbe3004f7746f3c945feefb56c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 5 Oct 2021 11:59:09 +0200 Subject: [PATCH 166/896] fix(jsontools): fix broken conditional in zsh 5.0.2 (#10262) Fixes #10262 --- plugins/jsontools/jsontools.plugin.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/jsontools/jsontools.plugin.zsh b/plugins/jsontools/jsontools.plugin.zsh index ed45cfa8e..857ca0ec9 100644 --- a/plugins/jsontools/jsontools.plugin.zsh +++ b/plugins/jsontools/jsontools.plugin.zsh @@ -7,7 +7,7 @@ if [[ -n "$JSONTOOLS_METHOD" ]]; then fi # If method undefined, find the first one that is installed -if [[ ! -v JSONTOOLS_METHOD ]]; then +if [[ -z "$JSONTOOLS_METHOD" ]]; then for JSONTOOLS_METHOD in node python ruby; do # If method found, break out of loop (( $+commands[$JSONTOOLS_METHOD] )) && break @@ -16,7 +16,7 @@ if [[ ! -v JSONTOOLS_METHOD ]]; then done # If no methods were found, exit the plugin - [[ -v JSONTOOLS_METHOD ]] || return 1 + [[ -n "$JSONTOOLS_METHOD" ]] || return 1 fi # Define json tools for each method From 49bc55f966d91b2a407c883cf1d0f21d0cdd9f4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 5 Oct 2021 13:23:05 +0200 Subject: [PATCH 167/896] fix(docker-compose): fix for slow `docker compose` call on remote Docker contexts (#10264) Fixes #10264 Co-authored-by: Frederick Zhang --- plugins/docker-compose/docker-compose.plugin.zsh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/docker-compose/docker-compose.plugin.zsh b/plugins/docker-compose/docker-compose.plugin.zsh index 2eba20a09..13985fc82 100644 --- a/plugins/docker-compose/docker-compose.plugin.zsh +++ b/plugins/docker-compose/docker-compose.plugin.zsh @@ -1,5 +1,7 @@ # support Compose v2 as docker CLI plugin -command docker compose &>/dev/null && dccmd='docker compose' || dccmd='docker-compose' +DOCKER_CONTEXT=default command docker compose &>/dev/null \ + && dccmd='docker compose' \ + || dccmd='docker-compose' alias dco="$dccmd" alias dcb="$dccmd build" From e5b9b80008a2fd71b441ef39fe620ed47dad82e5 Mon Sep 17 00:00:00 2001 From: Dapeng Gao <31944689+dpgao@users.noreply.github.com> Date: Tue, 5 Oct 2021 19:54:53 +0800 Subject: [PATCH 168/896] fix(gpg-agent): correctly overwrite `$SSH_AUTH_SOCK` and other improvements (#7059) --- plugins/gpg-agent/README.md | 2 +- plugins/gpg-agent/gpg-agent.plugin.zsh | 25 +++++++++++++------------ 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/plugins/gpg-agent/README.md b/plugins/gpg-agent/README.md index 9c1e6d2cc..8eeb94f92 100644 --- a/plugins/gpg-agent/README.md +++ b/plugins/gpg-agent/README.md @@ -2,7 +2,7 @@ Enables [GPG's gpg-agent](https://www.gnupg.org/documentation/manuals/gnupg/) if it is not running. -To use it, add gpg-agent to the plugins array of your zshrc file: +To use it, add `gpg-agent` to the plugins array of your zshrc file: ```zsh plugins=(... gpg-agent) diff --git a/plugins/gpg-agent/gpg-agent.plugin.zsh b/plugins/gpg-agent/gpg-agent.plugin.zsh index 3e24c2527..0adc8de5d 100644 --- a/plugins/gpg-agent/gpg-agent.plugin.zsh +++ b/plugins/gpg-agent/gpg-agent.plugin.zsh @@ -1,16 +1,17 @@ -# Enable gpg-agent if it is not running- -# --use-standard-socket will work from version 2 upwards - -AGENT_SOCK=$(gpgconf --list-dirs | grep agent-socket | cut -d : -f 2) - -if [[ ! -S $AGENT_SOCK ]]; then - gpg-agent --daemon --use-standard-socket &>/dev/null -fi export GPG_TTY=$TTY -# Set SSH to use gpg-agent if it's enabled -GNUPGCONFIG="${GNUPGHOME:-"$HOME/.gnupg"}/gpg-agent.conf" -if [[ -r $GNUPGCONFIG ]] && command grep -q enable-ssh-support "$GNUPGCONFIG"; then - export SSH_AUTH_SOCK="$AGENT_SOCK.ssh" +# Fix for passphrase prompt on the correct tty +# See https://www.gnupg.org/documentation/manuals/gnupg/Agent-Options.html#option-_002d_002denable_002dssh_002dsupport +function _gpg-agent_update-tty_preexec { + gpg-connect-agent updatestartuptty /bye &>/dev/null +} +autoload -U add-zsh-hook +add-zsh-hook preexec _gpg-agent_update-tty_preexec + +# If enable-ssh-support is set, fix ssh agent integration +if [[ $(gpgconf --list-options gpg-agent | awk -F: '$1=="enable-ssh-support" {print $10}') = 1 ]]; then unset SSH_AGENT_PID + if [[ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]]; then + export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)" + fi fi From 53c9661b003b91e8af356c3ecbb95a025ffcd412 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 5 Oct 2021 16:45:49 +0200 Subject: [PATCH 169/896] refactor(chucknorris): refresh plugin code --- plugins/chucknorris/README.md | 4 +-- plugins/chucknorris/chucknorris.plugin.zsh | 38 ++++++++++------------ 2 files changed, 18 insertions(+), 24 deletions(-) diff --git a/plugins/chucknorris/README.md b/plugins/chucknorris/README.md index 35f989180..b51875de9 100644 --- a/plugins/chucknorris/README.md +++ b/plugins/chucknorris/README.md @@ -1,8 +1,6 @@ # chucknorris -Chuck Norris fortunes plugin for oh-my-zsh. Perfectly suitable as MOTD. - -**Maintainers**: [apjanke](https://github.com/apjanke) [maff](https://github.com/maff) +Chuck Norris fortunes plugin for Oh My Zsh. Perfectly suitable as MOTD. To use it add `chucknorris` to the plugins array in you zshrc file. diff --git a/plugins/chucknorris/chucknorris.plugin.zsh b/plugins/chucknorris/chucknorris.plugin.zsh index 1dbb04ef0..b90abe320 100644 --- a/plugins/chucknorris/chucknorris.plugin.zsh +++ b/plugins/chucknorris/chucknorris.plugin.zsh @@ -1,28 +1,24 @@ -# chucknorris: Chuck Norris fortunes - -# Automatically generate or update Chuck's compiled fortune data file -# $0 must be used outside a local function. This variable name is unlikly to collide. -CHUCKNORRIS_PLUGIN_DIR=${0:h} - () { -local DIR=$CHUCKNORRIS_PLUGIN_DIR/fortunes -if [[ ! -f $DIR/chucknorris.dat ]] || [[ $DIR/chucknorris.dat -ot $DIR/chucknorris ]]; then - # For some reason, Cygwin puts strfile in /usr/sbin, which is not on the path by default - local strfile=strfile - if ! which strfile &>/dev/null && [[ -f /usr/sbin/strfile ]]; then - strfile=/usr/sbin/strfile + # %x: name of file containing code being executed + local fortunes_dir="${${(%):-%x}:h}/fortunes" + + # Aliases + alias chuck="fortune -a $fortunes_dir" + alias chuck_cow="chuck | cowthink" + + # Automatically generate or update Chuck's compiled fortune data file + if [[ "$fortunes_dir/chucknorris" -ot "$fortunes_dir/chucknorris.dat" ]]; then + return fi - if which $strfile &> /dev/null; then - $strfile $DIR/chucknorris $DIR/chucknorris.dat >/dev/null - else + + # For some reason, Cygwin puts strfile in /usr/sbin, which is not on the path by default + local strfile="${commands[strfile]:-/usr/sbin/strfile}" + if [[ ! -x "$strfile" ]]; then echo "[oh-my-zsh] chucknorris depends on strfile, which is not installed" >&2 echo "[oh-my-zsh] strfile is often provided as part of the 'fortune' package" >&2 + return fi -fi -# Aliases -alias chuck="fortune -a $DIR" -alias chuck_cow="chuck | cowthink" + # Generate the compiled fortune data file + $strfile "$fortunes_dir/chucknorris" "$fortunes_dir/chucknorris.dat" >/dev/null } - -unset CHUCKNORRIS_PLUGIN_DIR From 9e41cffbf8515ba64ab2cf21b49dc78949707553 Mon Sep 17 00:00:00 2001 From: Ryan McAllen Date: Tue, 5 Oct 2021 10:47:28 -0400 Subject: [PATCH 170/896] chore(chucknorris): add a few more Chuck Norris quotes (#10210) --- plugins/chucknorris/fortunes/chucknorris | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/plugins/chucknorris/fortunes/chucknorris b/plugins/chucknorris/fortunes/chucknorris index 0ddb6c03b..6ba5bb9b5 100644 --- a/plugins/chucknorris/fortunes/chucknorris +++ b/plugins/chucknorris/fortunes/chucknorris @@ -558,3 +558,11 @@ You know Chuck Norris' pet lizard, right? Last I heard, he was in the movie "God % http://chucknorrisfacts.com/ is built in Drupal because Chuck Norris knows a good CMS when he sees one. % +Chuck Norris made the first Giraffe by uppercutting a horse. +% +Chuck Norris can hear sign language. +% +Chuck Norris make onions cry. +% +Chuck Norris doesn't shake hands, he makes them tremble. +% From 63b7e5767d551b1d839888a7216f2bed01e8eb1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 5 Oct 2021 16:56:00 +0200 Subject: [PATCH 171/896] fix(changelog): don't parse commits of ignored types --- tools/changelog.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/changelog.sh b/tools/changelog.sh index 7329a9526..71caa2b6c 100755 --- a/tools/changelog.sh +++ b/tools/changelog.sh @@ -120,7 +120,7 @@ function parse-commit { fi # Parse commit with hash $1 - local hash="$1" subject body warning rhash + local hash="$1" subject body type warning rhash subject="$(command git show -s --format=%s $hash)" body="$(command git show -s --format=%b $hash)" @@ -132,8 +132,12 @@ function parse-commit { # commit body # [BREAKING CHANGE: warning] + # if commit type is not going to be displayed, do nothing else + type="$(commit:type "$subject")" + (( ${MAIN_TYPES[(Ie)$type]} || ${OTHER_TYPES[(Ie)$type]} )) || return + # commits holds the commit type - commits[$hash]="$(commit:type "$subject")" + commits[$hash]="$type" # scopes holds the commit scope scopes[$hash]="$(commit:scope "$subject")" # subjects holds the commit subject From bf7c1b160d164f080a276e6ed6b21ef8008079ee Mon Sep 17 00:00:00 2001 From: Carlo Sala Date: Wed, 6 Oct 2021 10:13:38 +0200 Subject: [PATCH 172/896] fix(git)!: rename `gdu` alias to `gdup` (#10263) BREAKING CHANGE: the `gdu` alias has been renamed to `gdup` to avoid a conflict with `go disk usage` (https://github.com/dundee/gdu). --- plugins/git/README.md | 2 +- plugins/git/git.plugin.zsh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/git/README.md b/plugins/git/README.md index b68dc552e..12e3676e8 100644 --- a/plugins/git/README.md +++ b/plugins/git/README.md @@ -67,7 +67,7 @@ plugins=(... git) | gds | git diff --staged | | gdt | git diff-tree --no-commit-id --name-only -r | | gdnolock | git diff $@ ":(exclude)package-lock.json" ":(exclude)*.lock" | -| gdu | git diff @{u} | +| gdup | git diff @{upstream} | | 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 f2431fde5..5c5db9972 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -126,7 +126,7 @@ alias gdcw='git diff --cached --word-diff' alias gdct='git describe --tags $(git rev-list --tags --max-count=1)' alias gds='git diff --staged' alias gdt='git diff-tree --no-commit-id --name-only -r' -alias gdu='git diff @{u}' +alias gdup='git diff @{upstream}' alias gdw='git diff --word-diff' function gdnolock() { From 7418814677a1b64d584d84be03fbfe38c7760e61 Mon Sep 17 00:00:00 2001 From: Ryan Zegray Date: Wed, 6 Oct 2021 04:14:22 -0400 Subject: [PATCH 173/896] feat(z): update z to latest version (#10267) --- plugins/z/z.sh | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/plugins/z/z.sh b/plugins/z/z.sh index 13008a60e..67f504e27 100644 --- a/plugins/z/z.sh +++ b/plugins/z/z.sh @@ -42,6 +42,8 @@ _z() { [ -z "$_Z_OWNER" -a -f "$datafile" -a ! -O "$datafile" ] && return _z_dirs () { + [ -f "$datafile" ] || return + local line while read line; do # only count directories @@ -54,14 +56,16 @@ _z() { if [ "$1" = "--add" ]; then shift - # $HOME isn't worth matching - [ "$*" = "$HOME" ] && return + # $HOME and / aren't worth matching + [ "$*" = "$HOME" -o "$*" = '/' ] && return # don't track excluded directory trees - local exclude - for exclude in "${_Z_EXCLUDE_DIRS[@]}"; do - case "$*" in "$exclude*") return;; esac - done + if [ ${#_Z_EXCLUDE_DIRS[@]} -gt 0 ]; then + local exclude + for exclude in "${_Z_EXCLUDE_DIRS[@]}"; do + case "$*" in "$exclude"*) return;; esac + done + fi # maintain the data file local tempfile="$datafile.$RANDOM" From 69a45a9c98291dc485ee9c46c9bf79ec8533217b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 6 Oct 2021 10:04:30 +0200 Subject: [PATCH 174/896] chore: zshrc update settings rewording --- templates/zshrc.zsh-template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/zshrc.zsh-template b/templates/zshrc.zsh-template index 58642bc41..7e1c7997c 100644 --- a/templates/zshrc.zsh-template +++ b/templates/zshrc.zsh-template @@ -23,7 +23,7 @@ ZSH_THEME="robbyrussell" # Case-sensitive completion must be off. _ and - will be interchangeable. # HYPHEN_INSENSITIVE="true" -# Uncomment the following lines to change the auto-update behavior +# Uncomment one of the following lines to change the auto-update behavior # zstyle ':omz:update' mode disabled # disable automatic updates # zstyle ':omz:update' mode auto # update automatically without asking # zstyle ':omz:update' mode reminder # just remind me to update when it's time From 29b5c182bec4cec7704fb8bac9ee0ab971dfb89a Mon Sep 17 00:00:00 2001 From: HoshinoArika Date: Wed, 6 Oct 2021 17:01:20 +0800 Subject: [PATCH 175/896] feat(sublime): add support for Sublime Text 4 on Windows (#10063) --- plugins/sublime/sublime.plugin.zsh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/sublime/sublime.plugin.zsh b/plugins/sublime/sublime.plugin.zsh index 618dd8ee8..dadf37574 100644 --- a/plugins/sublime/sublime.plugin.zsh +++ b/plugins/sublime/sublime.plugin.zsh @@ -17,6 +17,7 @@ alias stn=create_project if [[ "$OSTYPE" == linux* ]]; then if [[ "$(uname -r)" = *icrosoft* ]]; then _sublime_paths=( + "$(wslpath -u 'C:\Program Files\Sublime Text\sublime_text.exe' 2>/dev/null)" "$(wslpath -u 'C:\Program Files\Sublime Text 3\subl.exe' 2>/dev/null)" "$(wslpath -u 'C:\Program Files\Sublime Text 2\subl.exe' 2>/dev/null)" ) @@ -52,6 +53,7 @@ alias stn=create_project ) elif [[ "$OSTYPE" = msys ]]; then _sublime_paths=( + "/c/Program Files/Sublime Text/sublime_text.exe" "/c/Program Files/Sublime Text 2/subl.exe" "/c/Program Files/Sublime Text 3/subl.exe" ) From f0bbef1a070b7b00a36010c44af3c88807c73e6f Mon Sep 17 00:00:00 2001 From: Cxarli <10348289+Cxarli@users.noreply.github.com> Date: Sat, 31 Oct 2020 16:01:18 +0100 Subject: [PATCH 176/896] feat(yarn): add global bin directory to `$PATH` (#9410) Fixes #9177 Closes #9410 --- plugins/yarn/yarn.plugin.zsh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/plugins/yarn/yarn.plugin.zsh b/plugins/yarn/yarn.plugin.zsh index a240cb88e..a4f595c61 100644 --- a/plugins/yarn/yarn.plugin.zsh +++ b/plugins/yarn/yarn.plugin.zsh @@ -1,3 +1,10 @@ +# Add yarn bin directory to $PATH if it exists and not in $PATH already +bindir=$(yarn global bin 2>/dev/null) \ + && [[ -d "$bindir" ]] \ + && (( ! ${path[(Ie)$bindir]} )) \ + && path+=("$bindir") +unset bindir + alias y="yarn" alias ya="yarn add" alias yad="yarn add --dev" From 607d2f1eda6f7a8a8036a6608e99c512db75c602 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Thu, 7 Oct 2021 13:35:07 +0200 Subject: [PATCH 177/896] Revert "fix(changelog): don't parse commits of ignored types" This reverts commit 63b7e5767d551b1d839888a7216f2bed01e8eb1f. --- tools/changelog.sh | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/tools/changelog.sh b/tools/changelog.sh index 71caa2b6c..7329a9526 100755 --- a/tools/changelog.sh +++ b/tools/changelog.sh @@ -120,7 +120,7 @@ function parse-commit { fi # Parse commit with hash $1 - local hash="$1" subject body type warning rhash + local hash="$1" subject body warning rhash subject="$(command git show -s --format=%s $hash)" body="$(command git show -s --format=%b $hash)" @@ -132,12 +132,8 @@ function parse-commit { # commit body # [BREAKING CHANGE: warning] - # if commit type is not going to be displayed, do nothing else - type="$(commit:type "$subject")" - (( ${MAIN_TYPES[(Ie)$type]} || ${OTHER_TYPES[(Ie)$type]} )) || return - # commits holds the commit type - commits[$hash]="$type" + commits[$hash]="$(commit:type "$subject")" # scopes holds the commit scope scopes[$hash]="$(commit:scope "$subject")" # subjects holds the commit subject From dc83d0b7204cf66315471e980729490813b7d915 Mon Sep 17 00:00:00 2001 From: Ryan Voots Date: Thu, 7 Oct 2021 15:16:30 -0400 Subject: [PATCH 178/896] fix(battery): support `acpitool` and multiple batteries under Linux (#9609) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Marc CornellĂ  --- plugins/battery/battery.plugin.zsh | 54 ++++++++++++++++++------------ 1 file changed, 32 insertions(+), 22 deletions(-) diff --git a/plugins/battery/battery.plugin.zsh b/plugins/battery/battery.plugin.zsh index a525fd7da..24bff8ae6 100644 --- a/plugins/battery/battery.plugin.zsh +++ b/plugins/battery/battery.plugin.zsh @@ -12,15 +12,12 @@ ########################################### if [[ "$OSTYPE" = darwin* ]]; then - function battery_is_charging() { ioreg -rc AppleSmartBattery | command grep -q '^.*"ExternalConnected"\ =\ Yes' } - function battery_pct() { pmset -g batt | grep -Eo "\d+%" | cut -d% -f1 } - function battery_pct_remaining() { if battery_is_charging; then echo "External Power" @@ -28,7 +25,6 @@ if [[ "$OSTYPE" = darwin* ]]; then battery_pct fi } - function battery_time_remaining() { local smart_battery_status="$(ioreg -rc "AppleSmartBattery")" if [[ $(echo $smart_battery_status | command grep -c '^.*"ExternalConnected"\ =\ No') -eq 1 ]]; then @@ -42,7 +38,6 @@ if [[ "$OSTYPE" = darwin* ]]; then echo "âž" fi } - function battery_pct_prompt () { local battery_pct color if ioreg -rc AppleSmartBattery | command grep -q '^.*"ExternalConnected"\ =\ No'; then @@ -61,17 +56,14 @@ if [[ "$OSTYPE" = darwin* ]]; then } elif [[ "$OSTYPE" = freebsd* ]]; then - function battery_is_charging() { [[ $(sysctl -n hw.acpi.battery.state) -eq 2 ]] } - function battery_pct() { if (( $+commands[sysctl] )); then sysctl -n hw.acpi.battery.life fi } - function battery_pct_remaining() { if ! battery_is_charging; then battery_pct @@ -79,7 +71,6 @@ elif [[ "$OSTYPE" = freebsd* ]]; then echo "External Power" fi } - function battery_time_remaining() { local remaining_time remaining_time=$(sysctl -n hw.acpi.battery.time) @@ -89,7 +80,6 @@ elif [[ "$OSTYPE" = freebsd* ]]; then printf %02d:%02d $hour $minute fi } - function battery_pct_prompt() { local battery_pct color battery_pct=$(battery_pct_remaining) @@ -106,19 +96,42 @@ elif [[ "$OSTYPE" = freebsd* ]]; then echo "%{$fg[$color]%}${battery_pct}%%%{$reset_color%}" fi } - elif [[ "$OSTYPE" = linux* ]]; then - function battery_is_charging() { - ! acpi 2>/dev/null | command grep -v "rate information unavailable" | command grep -q '^Battery.*Discharging' - } - - function battery_pct() { - if (( $+commands[acpi] )); then - acpi 2>/dev/null | command grep -v "rate information unavailable" | command grep -E '^Battery.*(Full|(Disc|C)harging)' | cut -f2 -d ',' | tr -cd '[:digit:]' + if (( $+commands[acpitool] )); then + ! acpitool 2>/dev/null | command grep -qE '^\s+Battery.*Discharging' + elif (( $+commands[acpi] )); then + ! acpi 2>/dev/null | command grep -v "rate information unavailable" | command grep -q '^Battery.*Discharging' + fi + } + function battery_pct() { + if (( $+commands[acpitool] )); then + # Sample output: + # Battery #1 : Unknown, 99.55% + # Battery #2 : Discharging, 49.58%, 01:12:05 + # All batteries : 62.60%, 02:03:03 + acpitool 2>/dev/null | command awk -F, ' + /^\s+All batteries/ { + gsub(/[^0-9.]/, "", $1) + pct=$1 + exit + } + !pct && /^\s+Battery/ { + gsub(/[^0-9.]/, "", $2) + pct=$2 + } + END { print pct } + ' + elif (( $+commands[acpi] )); then + # Sample output: + # Battery 0: Discharging, 0%, rate information unavailable + # Battery 1: Full, 100% + acpi 2>/dev/null | command awk -F, ' + /rate information unavailable/ { next } + /^Battery.*: /{ gsub(/[^0-9]/, "", $2); print $2; exit } + ' fi } - function battery_pct_remaining() { if ! battery_is_charging; then battery_pct @@ -126,13 +139,11 @@ elif [[ "$OSTYPE" = linux* ]]; then echo "External Power" fi } - function battery_time_remaining() { if ! battery_is_charging; then acpi 2>/dev/null | command grep -v "rate information unavailable" | cut -f3 -d ',' fi } - function battery_pct_prompt() { local battery_pct color battery_pct=$(battery_pct_remaining) @@ -149,7 +160,6 @@ elif [[ "$OSTYPE" = linux* ]]; then echo "%{$fg[$color]%}${battery_pct}%%%{$reset_color%}" fi } - else # Empty functions so we don't cause errors in prompts function battery_is_charging { false } From f26a1ecdf01185218004dd6d15ce02541e6a2b26 Mon Sep 17 00:00:00 2001 From: Avneet Singh <4151485+kalsi-avneet@users.noreply.github.com> Date: Sun, 21 Mar 2021 00:06:33 +0530 Subject: [PATCH 179/896] feat(battery): add support for Android via Termux (#9752) --- plugins/battery/README.md | 19 ++++++++----- plugins/battery/battery.plugin.zsh | 43 ++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 6 deletions(-) diff --git a/plugins/battery/README.md b/plugins/battery/README.md index c2554a36d..18e5bd882 100644 --- a/plugins/battery/README.md +++ b/plugins/battery/README.md @@ -8,15 +8,22 @@ To use, add `battery` to the list of plugins in your `.zshrc` file: Then, add the `battery_pct_prompt` function to your custom theme. For example: -``` +```zsh RPROMPT='$(battery_pct_prompt) ...' ``` ## Requirements -On Linux, you must have the `acpi` tool installed on your operating system. +- On Linux, you must have the `acpi` or `acpitool` commands installed on your operating system. + On Debian/Ubuntu, you can do that with `sudo apt install acpi` or `sudo apt install acpitool`. -Here's an example of how to install with apt: -``` -sudo apt-get install acpi -``` +- On Android (via [Termux](https://play.google.com/store/apps/details?id=com.termux)), you must have: + + 1. The `Termux:API` addon app installed: + [Google Play](https://play.google.com/store/apps/details?id=com.termux.api) | [F-Droid](https://f-droid.org/packages/com.termux.api/) + + 2. The `termux-api` package installed within termux: + + ```sh + pkg install termux-api + ``` diff --git a/plugins/battery/battery.plugin.zsh b/plugins/battery/battery.plugin.zsh index 24bff8ae6..8e6afe65e 100644 --- a/plugins/battery/battery.plugin.zsh +++ b/plugins/battery/battery.plugin.zsh @@ -10,6 +10,9 @@ # Author: J (927589452) # # Modified to add support for FreeBSD # ########################################### +# Author: Avneet Singh (kalsi-avneet) # +# Modified to add support for Android # +########################################### if [[ "$OSTYPE" = darwin* ]]; then function battery_is_charging() { @@ -160,6 +163,46 @@ elif [[ "$OSTYPE" = linux* ]]; then echo "%{$fg[$color]%}${battery_pct}%%%{$reset_color%}" fi } +elif [[ "$OSTYPE" = linux-android ]] && (( ${+commands[termux-battery-status]} )); then + function battery_is_charging() { + termux-battery-status 2>/dev/null | command awk '/status/ { exit ($0 ~ /DISCHARGING/) }' + } + function battery_pct() { + # Sample output: + # { + # "health": "GOOD", + # "percentage": 93, + # "plugged": "UNPLUGGED", + # "status": "DISCHARGING", + # "temperature": 29.0, + # "current": 361816 + # } + termux-battery-status 2>/dev/null | command awk '/percentage/ { gsub(/[,]/,""); print $2}' + } + function battery_pct_remaining() { + if ! battery_is_charging; then + battery_pct + else + echo "External Power" + fi + } + function battery_time_remaining() { } # Not available on android + function battery_pct_prompt() { + local battery_pct color + battery_pct=$(battery_pct_remaining) + if battery_is_charging; then + echo "âž" + else + if [[ $battery_pct -gt 50 ]]; then + color='green' + elif [[ $battery_pct -gt 20 ]]; then + color='yellow' + else + color='red' + fi + echo "%{$fg[$color]%}${battery_pct}%%%{$reset_color%}" + fi + } else # Empty functions so we don't cause errors in prompts function battery_is_charging { false } From 9aeb967581061ca12c1679d3fdce8a5b516a9796 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Fri, 8 Oct 2021 12:34:04 +0200 Subject: [PATCH 180/896] fix(battery): fix system check so Termux uses the correct method --- plugins/battery/battery.plugin.zsh | 80 +++++++++++++++--------------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/plugins/battery/battery.plugin.zsh b/plugins/battery/battery.plugin.zsh index 8e6afe65e..0e96b00aa 100644 --- a/plugins/battery/battery.plugin.zsh +++ b/plugins/battery/battery.plugin.zsh @@ -99,6 +99,46 @@ elif [[ "$OSTYPE" = freebsd* ]]; then echo "%{$fg[$color]%}${battery_pct}%%%{$reset_color%}" fi } +elif [[ "$OSTYPE" = linux-android ]] && (( ${+commands[termux-battery-status]} )); then + function battery_is_charging() { + termux-battery-status 2>/dev/null | command awk '/status/ { exit ($0 ~ /DISCHARGING/) }' + } + function battery_pct() { + # Sample output: + # { + # "health": "GOOD", + # "percentage": 93, + # "plugged": "UNPLUGGED", + # "status": "DISCHARGING", + # "temperature": 29.0, + # "current": 361816 + # } + termux-battery-status 2>/dev/null | command awk '/percentage/ { gsub(/[,]/,""); print $2}' + } + function battery_pct_remaining() { + if ! battery_is_charging; then + battery_pct + else + echo "External Power" + fi + } + function battery_time_remaining() { } # Not available on android + function battery_pct_prompt() { + local battery_pct color + battery_pct=$(battery_pct_remaining) + if battery_is_charging; then + echo "âž" + else + if [[ $battery_pct -gt 50 ]]; then + color='green' + elif [[ $battery_pct -gt 20 ]]; then + color='yellow' + else + color='red' + fi + echo "%{$fg[$color]%}${battery_pct}%%%{$reset_color%}" + fi + } elif [[ "$OSTYPE" = linux* ]]; then function battery_is_charging() { if (( $+commands[acpitool] )); then @@ -163,46 +203,6 @@ elif [[ "$OSTYPE" = linux* ]]; then echo "%{$fg[$color]%}${battery_pct}%%%{$reset_color%}" fi } -elif [[ "$OSTYPE" = linux-android ]] && (( ${+commands[termux-battery-status]} )); then - function battery_is_charging() { - termux-battery-status 2>/dev/null | command awk '/status/ { exit ($0 ~ /DISCHARGING/) }' - } - function battery_pct() { - # Sample output: - # { - # "health": "GOOD", - # "percentage": 93, - # "plugged": "UNPLUGGED", - # "status": "DISCHARGING", - # "temperature": 29.0, - # "current": 361816 - # } - termux-battery-status 2>/dev/null | command awk '/percentage/ { gsub(/[,]/,""); print $2}' - } - function battery_pct_remaining() { - if ! battery_is_charging; then - battery_pct - else - echo "External Power" - fi - } - function battery_time_remaining() { } # Not available on android - function battery_pct_prompt() { - local battery_pct color - battery_pct=$(battery_pct_remaining) - if battery_is_charging; then - echo "âž" - else - if [[ $battery_pct -gt 50 ]]; then - color='green' - elif [[ $battery_pct -gt 20 ]]; then - color='yellow' - else - color='red' - fi - echo "%{$fg[$color]%}${battery_pct}%%%{$reset_color%}" - fi - } else # Empty functions so we don't cause errors in prompts function battery_is_charging { false } From 5fb204fa7469a89f31ffb8ee8a9b3c36bea926a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Fri, 8 Oct 2021 15:42:43 +0200 Subject: [PATCH 181/896] fix(battery): force battery percentage as integer --- plugins/battery/battery.plugin.zsh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plugins/battery/battery.plugin.zsh b/plugins/battery/battery.plugin.zsh index 0e96b00aa..db5eeb93a 100644 --- a/plugins/battery/battery.plugin.zsh +++ b/plugins/battery/battery.plugin.zsh @@ -153,7 +153,7 @@ elif [[ "$OSTYPE" = linux* ]]; then # Battery #1 : Unknown, 99.55% # Battery #2 : Discharging, 49.58%, 01:12:05 # All batteries : 62.60%, 02:03:03 - acpitool 2>/dev/null | command awk -F, ' + local -i pct=$(acpitool 2>/dev/null | command awk -F, ' /^\s+All batteries/ { gsub(/[^0-9.]/, "", $1) pct=$1 @@ -164,7 +164,8 @@ elif [[ "$OSTYPE" = linux* ]]; then pct=$2 } END { print pct } - ' + ') + echo $pct elif (( $+commands[acpi] )); then # Sample output: # Battery 0: Discharging, 0%, rate information unavailable @@ -227,7 +228,7 @@ function battery_level_gauge() { local charging_color=${BATTERY_CHARGING_COLOR:-$color_yellow} local charging_symbol=${BATTERY_CHARGING_SYMBOL:-'⚡'} - local battery_remaining_percentage=$(battery_pct) + local -i battery_remaining_percentage=$(battery_pct) local filled empty gauge_color if [[ $battery_remaining_percentage =~ [0-9]+ ]]; then From 1c9a64ece6dce901aac114deaa71b298a32fbfb4 Mon Sep 17 00:00:00 2001 From: Michael Fryar Date: Fri, 8 Oct 2021 08:24:00 -0700 Subject: [PATCH 182/896] feat(git): add `gswm` and `gswd` aliases (#9897) Co-authored-by: Nathaniel Young --- plugins/git/README.md | 2 ++ plugins/git/git.plugin.zsh | 2 ++ 2 files changed, 4 insertions(+) diff --git a/plugins/git/README.md b/plugins/git/README.md index 12e3676e8..113080874 100644 --- a/plugins/git/README.md +++ b/plugins/git/README.md @@ -169,6 +169,8 @@ plugins=(... git) | gsu | git submodule update | | gsw | git switch | | gswc | git switch -c | +| gswm | git switch $(git_main_branch) | +| gswd | git switch $(git_develop_branch) | | gts | git tag -s | | gtv | git tag \| sort -V | | gtl | gtl(){ git tag --sort=-v:refname -n -l ${1}* }; noglob gtl | diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 5c5db9972..dbcc7bddb 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -295,6 +295,8 @@ alias gstall='git stash --all' alias gsu='git submodule update' alias gsw='git switch' alias gswc='git switch -c' +alias gswm='git switch $(git_main_branch)' +alias gswd='git switch $(git_develop_branch)' alias gts='git tag -s' alias gtv='git tag | sort -V' From 07cdd7a53931a17a2c24f834c5e1ea0f62609c42 Mon Sep 17 00:00:00 2001 From: Pooya Vahidi <56851682+pooyavahidi@users.noreply.github.com> Date: Sat, 9 Oct 2021 21:02:49 +1100 Subject: [PATCH 183/896] fix(lib): fix status exit code check in `git_prompt_status` (#10275) --- lib/git.zsh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/git.zsh b/lib/git.zsh index c9363274c..9a615e77b 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -206,7 +206,8 @@ function git_prompt_status() { STASHED UNMERGED AHEAD BEHIND DIVERGED ) - local status_text="$(__git_prompt_git status --porcelain -b 2> /dev/null)" + local status_text + status_text="$(__git_prompt_git status --porcelain -b 2> /dev/null)" # Don't continue on a catastrophic failure if [[ $? -eq 128 ]]; then From 6ac1ff69053525d94b8bc6c5243d2bb67fb61930 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luka=20Marku=C5=A1i=C4=87?= Date: Sat, 9 Oct 2021 13:42:17 +0200 Subject: [PATCH 184/896] fix(git): fix directory parse from URL in `gccd` (#10276) --- plugins/git/git.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index dbcc7bddb..5a3c98287 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -100,7 +100,7 @@ alias gcf='git config --list' function gccd() { command git clone --recurse-submodules "$@" - [[ -d "$_" ]] && cd "$_" || cd "${${_:h}%.git}" + [[ -d "$_" ]] && cd "$_" || cd "${${_:t}%.git}" } compdef _git gccd=git-clone From f82aa819310752ad754c4ebfd1ae499285ee556e Mon Sep 17 00:00:00 2001 From: michael-yuji Date: Mon, 11 Oct 2021 01:15:24 +0800 Subject: [PATCH 185/896] fix(lib): fix `diff --color` argument check for BSD systems (#10269) --- lib/theme-and-appearance.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/theme-and-appearance.zsh b/lib/theme-and-appearance.zsh index 0b71de372..00947f72d 100644 --- a/lib/theme-and-appearance.zsh +++ b/lib/theme-and-appearance.zsh @@ -40,7 +40,7 @@ if [[ "$DISABLE_LS_COLORS" != "true" ]]; then fi # enable diff color if possible. -if command diff --color . . &>/dev/null; then +if command diff --color /dev/null /dev/null &>/dev/null; then alias diff='diff --color' fi From 9bd0ac9b005189edceb0ac53f361fcc020f8e6b6 Mon Sep 17 00:00:00 2001 From: Arthur Maltson Date: Mon, 11 Oct 2021 05:40:17 -0400 Subject: [PATCH 186/896] feat(mvn): support using `mvnw` in multi-module projects (#9413) --- plugins/mvn/mvn.plugin.zsh | 531 +++++++++++++++++++------------------ 1 file changed, 269 insertions(+), 262 deletions(-) diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh index 27d63a6f9..e32729aa6 100644 --- a/plugins/mvn/mvn.plugin.zsh +++ b/plugins/mvn/mvn.plugin.zsh @@ -1,39 +1,46 @@ -# Calls ./mvnw if found, otherwise execute the original mvn +# Calls mvnw if found in the current project, otherwise execute the original mvn mvn-or-mvnw() { - if [ -x ./mvnw ]; then - echo "executing mvnw instead of mvn" - ./mvnw "$@" - else - command mvn "$@" - fi + local dir="$PWD" + while [[ ! -x "$dir/mvnw" && "$dir" != / ]]; do + dir="${dir:h}" + done + + if [[ -x "$dir/mvnw" ]]; then + echo "Running \`$dir/mvnw\`..." >&2 + "$dir/mvnw" "$@" + return $? + fi + + command mvn "$@" } # Wrapper function for Maven's mvn command. Based on https://gist.github.com/1027800 mvn-color() { - local BOLD=$(echoti bold) - local TEXT_RED=$(echoti setaf 1) - local TEXT_GREEN=$(echoti setaf 2) - local TEXT_YELLOW=$(echoti setaf 3) - local TEXT_BLUE=$(echoti setaf 4) - local TEXT_WHITE=$(echoti setaf 7) - local RESET_FORMATTING=$(echoti sgr0) - ( - # Filter mvn output using sed. Before filtering set the locale to C, so invalid characters won't break some sed implementations - unset LANG - LC_CTYPE=C mvn "$@" | sed \ - -e "s/\(\[INFO\]\)\(.*\)/${TEXT_BLUE}${BOLD}\1${RESET_FORMATTING}\2/g" \ - -e "s/\(\[DEBUG\]\)\(.*\)/${TEXT_WHITE}${BOLD}\1${RESET_FORMATTING}\2/g" \ - -e "s/\(\[INFO\]\ BUILD SUCCESSFUL\)/${BOLD}${TEXT_GREEN}\1${RESET_FORMATTING}/g" \ - -e "s/\(\[WARNING\]\)\(.*\)/${BOLD}${TEXT_YELLOW}\1${RESET_FORMATTING}\2/g" \ - -e "s/\(\[ERROR\]\)\(.*\)/${BOLD}${TEXT_RED}\1${RESET_FORMATTING}\2/g" \ - -e "s/Tests run: \([^,]*\), Failures: \([^,]*\), Errors: \([^,]*\), Skipped: \([^,]*\)/${BOLD}${TEXT_GREEN}Tests run: \1${RESET_FORMATTING}, Failures: ${BOLD}${TEXT_RED}\2${RESET_FORMATTING}, Errors: ${BOLD}${TEXT_RED}\3${RESET_FORMATTING}, Skipped: ${BOLD}${TEXT_YELLOW}\4${RESET_FORMATTING}/g" + local BOLD=$(echoti bold) + local TEXT_RED=$(echoti setaf 1) + local TEXT_GREEN=$(echoti setaf 2) + local TEXT_YELLOW=$(echoti setaf 3) + local TEXT_BLUE=$(echoti setaf 4) + local TEXT_WHITE=$(echoti setaf 7) + local RESET_FORMATTING=$(echoti sgr0) - # Make sure formatting is reset - echo -ne "${RESET_FORMATTING}" - ) + ( + # Filter mvn output using sed. Before filtering set the locale to C, so invalid characters won't break some sed implementations + unset LANG + LC_CTYPE=C mvn "$@" | sed \ + -e "s/\(\[INFO\]\)\(.*\)/${TEXT_BLUE}${BOLD}\1${RESET_FORMATTING}\2/g" \ + -e "s/\(\[DEBUG\]\)\(.*\)/${TEXT_WHITE}${BOLD}\1${RESET_FORMATTING}\2/g" \ + -e "s/\(\[INFO\]\ BUILD SUCCESSFUL\)/${BOLD}${TEXT_GREEN}\1${RESET_FORMATTING}/g" \ + -e "s/\(\[WARNING\]\)\(.*\)/${BOLD}${TEXT_YELLOW}\1${RESET_FORMATTING}\2/g" \ + -e "s/\(\[ERROR\]\)\(.*\)/${BOLD}${TEXT_RED}\1${RESET_FORMATTING}\2/g" \ + -e "s/Tests run: \([^,]*\), Failures: \([^,]*\), Errors: \([^,]*\), Skipped: \([^,]*\)/${BOLD}${TEXT_GREEN}Tests run: \1${RESET_FORMATTING}, Failures: ${BOLD}${TEXT_RED}\2${RESET_FORMATTING}, Errors: ${BOLD}${TEXT_RED}\3${RESET_FORMATTING}, Skipped: ${BOLD}${TEXT_YELLOW}\4${RESET_FORMATTING}/g" + + # Make sure formatting is reset + echo -ne "${RESET_FORMATTING}" + ) } -# either use orignal mvn or the mvn wrapper +# either use original mvn or the mvn wrapper alias mvn="mvn-or-mvnw" # Run mvn against the pom found in a project's root directory (assumes a git repo) @@ -72,262 +79,262 @@ alias mvn-updates='mvn versions:display-dependency-updates' function listMavenCompletions { - local file new_file - local -a profiles POM_FILES modules + local file new_file + local -a profiles POM_FILES modules - # Root POM - POM_FILES=(~/.m2/settings.xml) + # Root POM + POM_FILES=(~/.m2/settings.xml) - # POM in the current directory - if [[ -f pom.xml ]]; then - local file=pom.xml - POM_FILES+=("${file:A}") - fi + # POM in the current directory + if [[ -f pom.xml ]]; then + local file=pom.xml + POM_FILES+=("${file:A}") + fi - # Look for POM files in parent directories - while [[ -n "$file" ]] && grep -q "" "$file"; do - # look for a new relativePath for parent pom.xml - new_file=$(grep -e ".*" "$file" | sed -e 's/.*\(.*\)<\/relativePath>.*/\1/') + # Look for POM files in parent directories + while [[ -n "$file" ]] && grep -q "" "$file"; do + # look for a new relativePath for parent pom.xml + new_file=$(grep -e ".*" "$file" | sed -e 's/.*\(.*\)<\/relativePath>.*/\1/') - # if is present but not defined, assume ../pom.xml - if [[ -z "$new_file" ]]; then - new_file="../pom.xml" - fi + # if is present but not defined, assume ../pom.xml + if [[ -z "$new_file" ]]; then + new_file="../pom.xml" + fi - # if file doesn't exist break - file="${file:h}/${new_file}" - if ! [[ -e "$file" ]]; then - break - fi + # if file doesn't exist break + file="${file:h}/${new_file}" + if ! [[ -e "$file" ]]; then + break + fi - POM_FILES+=("${file:A}") - done + POM_FILES+=("${file:A}") + done - # Get profiles from found files - for file in $POM_FILES; do - [[ -e $file ]] || continue - profiles+=($(sed 's///' "$file" | sed '//d' | grep -e "" -A 1 | grep -e ".*" | sed 's?.*\(.*\)<\/id>.*?-P\1?')) - done + # Get profiles from found files + for file in $POM_FILES; do + [[ -e $file ]] || continue + profiles+=($(sed 's///' "$file" | sed '//d' | grep -e "" -A 1 | grep -e ".*" | sed 's?.*\(.*\)<\/id>.*?-P\1?')) + done - # List modules - modules=($(find **/pom.xml -type f | grep -v '/target/classes/META-INF/' | grep '/pom.xml' |sed 's|\(.*\)/pom\.xml|\1|')) + # List modules + modules=($(find **/pom.xml -type f | grep -v '/target/classes/META-INF/' | grep '/pom.xml' |sed 's|\(.*\)/pom\.xml|\1|')) - reply=( - # common lifecycle - clean initialize process-resources compile process-test-resources test-compile test package verify install deploy site + reply=( + # common lifecycle + clean initialize process-resources compile process-test-resources test-compile test package verify install deploy site - # integration testing - pre-integration-test integration-test + # integration testing + pre-integration-test integration-test - # common plugins - deploy failsafe install site surefire checkstyle javadoc jxr pmd ant antrun archetype assembly dependency enforcer gpg help release repository source eclipse idea jetty cargo jboss tomcat tomcat6 tomcat7 exec versions war ear ejb android scm buildnumber nexus repository sonar license hibernate3 liquibase flyway gwt + # common plugins + deploy failsafe install site surefire checkstyle javadoc jxr pmd ant antrun archetype assembly dependency enforcer gpg help release repository source eclipse idea jetty cargo jboss tomcat tomcat6 tomcat7 exec versions war ear ejb android scm buildnumber nexus repository sonar license hibernate3 liquibase flyway gwt - # deploy - deploy:deploy-file - # failsafe - failsafe:integration-test failsafe:verify - # install - install:install-file install:help - # site - site:site site:deploy site:run site:stage site:stage-deploy site:attach-descriptor site:jar site:effective-site - # surefire - surefire:test + # deploy + deploy:deploy-file + # failsafe + failsafe:integration-test failsafe:verify + # install + install:install-file install:help + # site + site:site site:deploy site:run site:stage site:stage-deploy site:attach-descriptor site:jar site:effective-site + # surefire + surefire:test - # checkstyle - checkstyle:checkstyle checkstyle:check checkstyle:checkstyle-aggregate - # javadoc - javadoc:javadoc javadoc:test-javadoc javadoc:javadoc-no-fork javadoc:test-javadoc-no-fork javadoc:aggregate javadoc:test-aggregate javadoc:jar javadoc:test-jar javadoc:aggregate-jar javadoc:test-aggregate-jar javadoc:fix javadoc:test-fix javadoc:resource-bundle javadoc:test-resource-bundle - # jxr - jxr:jxr jxr:aggregate jxr:test-jxr jxr:test-aggregate - # pmd - pmd:pmd pmd:cpd pmd:check pmd:cpd-check + # checkstyle + checkstyle:checkstyle checkstyle:check checkstyle:checkstyle-aggregate + # javadoc + javadoc:javadoc javadoc:test-javadoc javadoc:javadoc-no-fork javadoc:test-javadoc-no-fork javadoc:aggregate javadoc:test-aggregate javadoc:jar javadoc:test-jar javadoc:aggregate-jar javadoc:test-aggregate-jar javadoc:fix javadoc:test-fix javadoc:resource-bundle javadoc:test-resource-bundle + # jxr + jxr:jxr jxr:aggregate jxr:test-jxr jxr:test-aggregate + # pmd + pmd:pmd pmd:cpd pmd:check pmd:cpd-check - # ant - ant:ant ant:clean - # antrun - antrun:run - # archetype - archetype:generate archetype:create-from-project archetype:crawl - # assembly - assembly:single assembly:assembly - # dependency - dependency:analyze dependency:analyze-dep-mgt dependency:analyze-only dependency:analyze-report dependency:analyze-duplicate dependency:build-classpath dependency:copy dependency:copy-dependencies dependency:display-ancestors dependency:get dependency:go-offline dependency:list dependency:list-repositories dependency:properties dependency:purge-local-repository dependency:resolve dependency:resolve-plugins dependency:sources dependency:tree dependency:unpack dependency:unpack-dependencies - # enforcer - enforcer:enforce enforcer:display-info - # gpg - gpg:sign gpg:sign-and-deploy-file - # help - help:active-profiles help:all-profiles help:describe help:effective-pom help:effective-settings help:evaluate help:expressions help:system - # release - release:clean release:prepare release:prepare-with-pom release:rollback release:perform release:stage release:branch release:update-versions - # jgitflow - jgitflow:feature-start jgitflow:feature-finish jgitflow:release-start jgitflow:release-finish jgitflow:hotfix-start jgitflow:hotfix-finish jgitflow:build-number - # repository - repository:bundle-create repository:bundle-pack - # source - source:aggregate source:jar source:jar-no-fork source:test-jar source:test-jar-no-fork + # ant + ant:ant ant:clean + # antrun + antrun:run + # archetype + archetype:generate archetype:create-from-project archetype:crawl + # assembly + assembly:single assembly:assembly + # dependency + dependency:analyze dependency:analyze-dep-mgt dependency:analyze-only dependency:analyze-report dependency:analyze-duplicate dependency:build-classpath dependency:copy dependency:copy-dependencies dependency:display-ancestors dependency:get dependency:go-offline dependency:list dependency:list-repositories dependency:properties dependency:purge-local-repository dependency:resolve dependency:resolve-plugins dependency:sources dependency:tree dependency:unpack dependency:unpack-dependencies + # enforcer + enforcer:enforce enforcer:display-info + # gpg + gpg:sign gpg:sign-and-deploy-file + # help + help:active-profiles help:all-profiles help:describe help:effective-pom help:effective-settings help:evaluate help:expressions help:system + # release + release:clean release:prepare release:prepare-with-pom release:rollback release:perform release:stage release:branch release:update-versions + # jgitflow + jgitflow:feature-start jgitflow:feature-finish jgitflow:release-start jgitflow:release-finish jgitflow:hotfix-start jgitflow:hotfix-finish jgitflow:build-number + # repository + repository:bundle-create repository:bundle-pack + # source + source:aggregate source:jar source:jar-no-fork source:test-jar source:test-jar-no-fork - # eclipse - eclipse:clean eclipse:eclipse - # idea - idea:clean idea:idea + # eclipse + eclipse:clean eclipse:eclipse + # idea + idea:clean idea:idea - # jetty - jetty:run jetty:run-exploded - # cargo - cargo:start cargo:run cargo:stop cargo:deploy cargo:undeploy cargo:help - # jboss - jboss:start jboss:stop jboss:deploy jboss:undeploy jboss:redeploy - # tomcat - tomcat:start tomcat:stop tomcat:deploy tomcat:undeploy tomcat:redeploy - # tomcat6 - tomcat6:run tomcat6:run-war tomcat6:run-war-only tomcat6:stop tomcat6:deploy tomcat6:undeploy - # tomcat7 - tomcat7:run tomcat7:run-war tomcat7:run-war-only tomcat7:deploy - # tomee - tomee:run tomee:run-war tomee:run-war-only tomee:stop tomee:deploy tomee:undeploy - # spring-boot - spring-boot:run spring-boot:repackage - # quarkus - quarkus:dev quarkus:list-extensions quarkus:add-extension quarkus:add-extensions quarkus:generate-config quarkus:help - # exec - exec:exec exec:java - # versions - versions:display-dependency-updates versions:display-plugin-updates versions:display-property-updates versions:update-parent versions:update-properties versions:update-child-modules versions:lock-snapshots versions:unlock-snapshots versions:resolve-ranges versions:set versions:use-releases versions:use-next-releases versions:use-latest-releases versions:use-next-snapshots versions:use-latest-snapshots versions:use-next-versions versions:use-latest-versions versions:commit versions:revert - # scm - scm:add scm:bootstrap scm:branch scm:changelog scm:check-local-modification scm:checkin scm:checkout scm:diff scm:edit scm:export scm:list scm:remove scm:status scm:tag scm:unedit scm:update scm:update-subprojects scm:validate - # buildnumber - buildnumber:create buildnumber:create-timestamp buildnumber:help buildnumber:hgchangeset + # jetty + jetty:run jetty:run-exploded + # cargo + cargo:start cargo:run cargo:stop cargo:deploy cargo:undeploy cargo:help + # jboss + jboss:start jboss:stop jboss:deploy jboss:undeploy jboss:redeploy + # tomcat + tomcat:start tomcat:stop tomcat:deploy tomcat:undeploy tomcat:redeploy + # tomcat6 + tomcat6:run tomcat6:run-war tomcat6:run-war-only tomcat6:stop tomcat6:deploy tomcat6:undeploy + # tomcat7 + tomcat7:run tomcat7:run-war tomcat7:run-war-only tomcat7:deploy + # tomee + tomee:run tomee:run-war tomee:run-war-only tomee:stop tomee:deploy tomee:undeploy + # spring-boot + spring-boot:run spring-boot:repackage + # quarkus + quarkus:dev quarkus:list-extensions quarkus:add-extension quarkus:add-extensions quarkus:generate-config quarkus:help + # exec + exec:exec exec:java + # versions + versions:display-dependency-updates versions:display-plugin-updates versions:display-property-updates versions:update-parent versions:update-properties versions:update-child-modules versions:lock-snapshots versions:unlock-snapshots versions:resolve-ranges versions:set versions:use-releases versions:use-next-releases versions:use-latest-releases versions:use-next-snapshots versions:use-latest-snapshots versions:use-next-versions versions:use-latest-versions versions:commit versions:revert + # scm + scm:add scm:bootstrap scm:branch scm:changelog scm:check-local-modification scm:checkin scm:checkout scm:diff scm:edit scm:export scm:list scm:remove scm:status scm:tag scm:unedit scm:update scm:update-subprojects scm:validate + # buildnumber + buildnumber:create buildnumber:create-timestamp buildnumber:help buildnumber:hgchangeset - # war - war:war war:exploded war:inplace war:manifest - # ear - ear:ear ear:generate-application-xml - # ejb - ejb:ejb - # android - android:apk android:apklib android:deploy android:deploy-dependencies android:dex android:emulator-start android:emulator-stop android:emulator-stop-all android:generate-sources android:help android:instrument android:manifest-update android:pull android:push android:redeploy android:run android:undeploy android:unpack android:version-update android:zipalign android:devices - # nexus - nexus:staging-list nexus:staging-close nexus:staging-drop nexus:staging-release nexus:staging-build-promotion nexus:staging-profiles-list nexus:settings-download - # repository - repository:bundle-create repository:bundle-pack repository:help + # war + war:war war:exploded war:inplace war:manifest + # ear + ear:ear ear:generate-application-xml + # ejb + ejb:ejb + # android + android:apk android:apklib android:deploy android:deploy-dependencies android:dex android:emulator-start android:emulator-stop android:emulator-stop-all android:generate-sources android:help android:instrument android:manifest-update android:pull android:push android:redeploy android:run android:undeploy android:unpack android:version-update android:zipalign android:devices + # nexus + nexus:staging-list nexus:staging-close nexus:staging-drop nexus:staging-release nexus:staging-build-promotion nexus:staging-profiles-list nexus:settings-download + # repository + repository:bundle-create repository:bundle-pack repository:help - # sonar - sonar:sonar - # license - license:format license:check - # hibernate3 - hibernate3:hbm2ddl hibernate3:help - # liquibase - liquibase:changelogSync liquibase:changelogSyncSQL liquibase:clearCheckSums liquibase:dbDoc liquibase:diff liquibase:dropAll liquibase:help liquibase:migrate liquibase:listLocks liquibase:migrateSQL liquibase:releaseLocks liquibase:rollback liquibase:rollbackSQL liquibase:status liquibase:tag liquibase:update liquibase:updateSQL liquibase:updateTestingRollback - # flyway - flyway:clean flyway:history flyway:init flyway:migrate flyway:status flyway:validate - # gwt - gwt:browser gwt:clean gwt:compile gwt:compile-report gwt:css gwt:debug gwt:eclipse gwt:eclipseTest gwt:generateAsync gwt:help gwt:i18n gwt:mergewebxml gwt:resources gwt:run gwt:sdkInstall gwt:source-jar gwt:soyc gwt:test - # asciidoctor - asciidoctor:process-asciidoc asciidoctor:auto-refresh asciidoctor:http asciidoctor:zip - # compiler - compiler:compile compiler:testCompile - # resources - resources:resources resources:testResources resources:copy-resources - # verifier - verifier:verify - # jar - jar:jar jar:test-jar - # rar - rar:rar - # acr - acr:acr - # shade - shade:shade - # changelog - changelog:changelog changelog:dev-activity changelog:file-activity - # changes - changes:announcement-mail changes:announcement-generate changes:changes-check changes:changes-validate changes:changes-report changes:jira-report changes:trac-report changes:github-report - # doap - doap:generate - # docck - docck:check - # jdeps - jdeps:jdkinternals jdeps:test-jdkinternals - # linkcheck - linkcheck:linkcheck - # project-info-reports - project-info-reports:cim project-info-reports:dependencies project-info-reports:dependency-convergence project-info-reports:dependency-info project-info-reports:dependency-management project-info-reports:distribution-management project-info-reports:help project-info-reports:index project-info-reports:issue-tracking project-info-reports:license project-info-reports:mailing-list project-info-reports:modules project-info-reports:plugin-management project-info-reports:plugins project-info-reports:project-team project-info-reports:scm project-info-reports:summary - # surefire-report - surefire-report:failsafe-report-only surefire-report:report surefire-report:report-only - # invoker - invoker:install invoker:integration-test invoker:verify invoker:run - # jarsigner - jarsigner:sign jarsigner:verify - # patch - patch:apply - # pdf - pdf:pdf - # plugin - plugin:descriptor plugin:report plugin:updateRegistry plugin:addPluginArtifactMetadata plugin:helpmojo - # remote-resources - remote-resources:bundle remote-resources:process - # scm-publish - scm-publish:help scm-publish:publish-scm scm-publish:scmpublish - # stage - stage:copy - # toolchain - toolchain:toolchain - #liberty - liberty:clean-server liberty:compile-jsp liberty:configure-arquillian liberty:create-server liberty:debug liberty:debug-server liberty:deploy liberty:dev liberty:display-url liberty:dump-server liberty:install-apps liberty:install-feature liberty:install-server liberty:java-dump-server liberty:package-server liberty:run liberty:run-server liberty:server-status liberty:start liberty:start-server liberty:status liberty:stop liberty:stop-server liberty:test-start-server liberty:test-stop-server liberty:undeploy liberty:uninstall-feature + # sonar + sonar:sonar + # license + license:format license:check + # hibernate3 + hibernate3:hbm2ddl hibernate3:help + # liquibase + liquibase:changelogSync liquibase:changelogSyncSQL liquibase:clearCheckSums liquibase:dbDoc liquibase:diff liquibase:dropAll liquibase:help liquibase:migrate liquibase:listLocks liquibase:migrateSQL liquibase:releaseLocks liquibase:rollback liquibase:rollbackSQL liquibase:status liquibase:tag liquibase:update liquibase:updateSQL liquibase:updateTestingRollback + # flyway + flyway:clean flyway:history flyway:init flyway:migrate flyway:status flyway:validate + # gwt + gwt:browser gwt:clean gwt:compile gwt:compile-report gwt:css gwt:debug gwt:eclipse gwt:eclipseTest gwt:generateAsync gwt:help gwt:i18n gwt:mergewebxml gwt:resources gwt:run gwt:sdkInstall gwt:source-jar gwt:soyc gwt:test + # asciidoctor + asciidoctor:process-asciidoc asciidoctor:auto-refresh asciidoctor:http asciidoctor:zip + # compiler + compiler:compile compiler:testCompile + # resources + resources:resources resources:testResources resources:copy-resources + # verifier + verifier:verify + # jar + jar:jar jar:test-jar + # rar + rar:rar + # acr + acr:acr + # shade + shade:shade + # changelog + changelog:changelog changelog:dev-activity changelog:file-activity + # changes + changes:announcement-mail changes:announcement-generate changes:changes-check changes:changes-validate changes:changes-report changes:jira-report changes:trac-report changes:github-report + # doap + doap:generate + # docck + docck:check + # jdeps + jdeps:jdkinternals jdeps:test-jdkinternals + # linkcheck + linkcheck:linkcheck + # project-info-reports + project-info-reports:cim project-info-reports:dependencies project-info-reports:dependency-convergence project-info-reports:dependency-info project-info-reports:dependency-management project-info-reports:distribution-management project-info-reports:help project-info-reports:index project-info-reports:issue-tracking project-info-reports:license project-info-reports:mailing-list project-info-reports:modules project-info-reports:plugin-management project-info-reports:plugins project-info-reports:project-team project-info-reports:scm project-info-reports:summary + # surefire-report + surefire-report:failsafe-report-only surefire-report:report surefire-report:report-only + # invoker + invoker:install invoker:integration-test invoker:verify invoker:run + # jarsigner + jarsigner:sign jarsigner:verify + # patch + patch:apply + # pdf + pdf:pdf + # plugin + plugin:descriptor plugin:report plugin:updateRegistry plugin:addPluginArtifactMetadata plugin:helpmojo + # remote-resources + remote-resources:bundle remote-resources:process + # scm-publish + scm-publish:help scm-publish:publish-scm scm-publish:scmpublish + # stage + stage:copy + # toolchain + toolchain:toolchain + #liberty + liberty:clean-server liberty:compile-jsp liberty:configure-arquillian liberty:create-server liberty:debug liberty:debug-server liberty:deploy liberty:dev liberty:display-url liberty:dump-server liberty:install-apps liberty:install-feature liberty:install-server liberty:java-dump-server liberty:package-server liberty:run liberty:run-server liberty:server-status liberty:start liberty:start-server liberty:status liberty:stop liberty:stop-server liberty:test-start-server liberty:test-stop-server liberty:undeploy liberty:uninstall-feature - # options - "-Dmaven.test.skip=true" -DskipTests -DskipITs -Dmaven.surefire.debug -DenableCiProfile "-Dpmd.skip=true" "-Dcheckstyle.skip=true" "-Dtycho.mode=maven" "-Dmaven.test.failure.ignore=true" "-DgroupId=" "-DartifactId=" "-Dversion=" "-Dpackaging=jar" "-Dfile=" + # options + "-Dmaven.test.skip=true" -DskipTests -DskipITs -Dmaven.surefire.debug -DenableCiProfile "-Dpmd.skip=true" "-Dcheckstyle.skip=true" "-Dtycho.mode=maven" "-Dmaven.test.failure.ignore=true" "-DgroupId=" "-DartifactId=" "-Dversion=" "-Dpackaging=jar" "-Dfile=" - # arguments - -am --also-make - -amd --also-make-dependents-am - -B --batch-mode - -b --builder - -C --strict-checksums - -c --lax-checksums - -cpu --check-plugin-updates - -D --define - -e --errors - -emp --encrypt-master-password - -ep --encrypt-password - -f --file - -fae --fail-at-end - -ff --fail-fast - -fn --fail-never - -gs --global-settings - -gt --global-toolchains - -h --help - -l --log-file - -llr --legacy-local-repository - -N --non-recursive - -npr --no-plugin-registry - -npu --no-plugin-updates - -nsu --no-snapshot-updates - -o --offline - -P --activate-profiles - -pl --projects - -q --quiet - -rf --resume-from - -s --settings - -t --toolchains - -T --threads - -U --update-snapshots - -up --update-plugins - -v --version - -V --show-version - -X --debug + # arguments + -am --also-make + -amd --also-make-dependents-am + -B --batch-mode + -b --builder + -C --strict-checksums + -c --lax-checksums + -cpu --check-plugin-updates + -D --define + -e --errors + -emp --encrypt-master-password + -ep --encrypt-password + -f --file + -fae --fail-at-end + -ff --fail-fast + -fn --fail-never + -gs --global-settings + -gt --global-toolchains + -h --help + -l --log-file + -llr --legacy-local-repository + -N --non-recursive + -npr --no-plugin-registry + -npu --no-plugin-updates + -nsu --no-snapshot-updates + -o --offline + -P --activate-profiles + -pl --projects + -q --quiet + -rf --resume-from + -s --settings + -t --toolchains + -T --threads + -U --update-snapshots + -up --update-plugins + -v --version + -V --show-version + -X --debug - cli:execute cli:execute-phase - archetype:generate generate-sources - cobertura:cobertura - -Dtest=$(if [ -d ./src/test/java ] ; then find ./src/test/java -type f -name '*.java' | grep -v svn | sed 's?.*/\([^/]*\)\..*?-Dtest=\1?' ; fi) - -Dit.test=$(if [ -d ./src/test/java ] ; then find ./src/test/java -type f -name '*.java' | grep -v svn | sed 's?.*/\([^/]*\)\..*?-Dit.test=\1?' ; fi) + cli:execute cli:execute-phase + archetype:generate generate-sources + cobertura:cobertura + -Dtest=$(if [ -d ./src/test/java ] ; then find ./src/test/java -type f -name '*.java' | grep -v svn | sed 's?.*/\([^/]*\)\..*?-Dtest=\1?' ; fi) + -Dit.test=$(if [ -d ./src/test/java ] ; then find ./src/test/java -type f -name '*.java' | grep -v svn | sed 's?.*/\([^/]*\)\..*?-Dit.test=\1?' ; fi) - $profiles - $modules - ) + $profiles + $modules + ) } compctl -K listMavenCompletions mvn mvnw From a0ac789f2abf475346505cd372a3843b3b93d91e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Mon, 11 Oct 2021 12:15:47 +0200 Subject: [PATCH 187/896] feat(ssh-agent): allow lazy-loading SSH identities (#6309) Fixes #7477 --- plugins/ssh-agent/README.md | 18 +++++++++++++++++- plugins/ssh-agent/ssh-agent.plugin.zsh | 5 ++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/plugins/ssh-agent/README.md b/plugins/ssh-agent/README.md index d1a504b1e..1d6914ec6 100644 --- a/plugins/ssh-agent/README.md +++ b/plugins/ssh-agent/README.md @@ -21,7 +21,23 @@ zstyle :omz:plugins:ssh-agent agent-forwarding on ---- -To **load multiple identities** use the `identities` style, For example: +To **NOT load any identities on start** use the `lazy` setting. This is particularly +useful when combined with the `AddKeysToAgent` setting (available since OpenSSH 7.2), +since it allows to enter the password only on first use. _NOTE: you can know your +OpenSSH version with `ssh -V`._ + +```zsh +zstyle :omz:plugins:ssh-agent lazy yes +``` + +You can enable `AddKeysToAgent` by passing `-o AddKeysToAgent=yes` to the `ssh` command, +or by adding `AddKeysToAgent yes` to your `~/.ssh/config` file [1]. +See the [OpenSSH 7.2 Release Notes](http://www.openssh.com/txt/release-7.2). + +---- + +To **load multiple identities** use the `identities` style (**this has no effect +if the `lazy` setting is enabled**). For example: ```zsh zstyle :omz:plugins:ssh-agent identities id_rsa id_rsa2 id_github diff --git a/plugins/ssh-agent/ssh-agent.plugin.zsh b/plugins/ssh-agent/ssh-agent.plugin.zsh index 2d7d8a2a0..4bd2dedcc 100644 --- a/plugins/ssh-agent/ssh-agent.plugin.zsh +++ b/plugins/ssh-agent/ssh-agent.plugin.zsh @@ -96,7 +96,10 @@ else _start_agent fi -_add_identities +# Don't add identities if lazy-loading is enabled +if ! zstyle -b :omz:plugins:ssh-agent lazy; then + _add_identities +fi unset agent_forwarding ssh_env_cache unfunction _start_agent _add_identities From beeda72826f7288d3edf6cec4114bbda9bbae347 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Mon, 11 Oct 2021 15:21:42 +0200 Subject: [PATCH 188/896] fix(ssh-agent): fix for bad `zstyle` command argument Fixes #10282 --- plugins/ssh-agent/ssh-agent.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/ssh-agent/ssh-agent.plugin.zsh b/plugins/ssh-agent/ssh-agent.plugin.zsh index 4bd2dedcc..c006f1413 100644 --- a/plugins/ssh-agent/ssh-agent.plugin.zsh +++ b/plugins/ssh-agent/ssh-agent.plugin.zsh @@ -97,7 +97,7 @@ else fi # Don't add identities if lazy-loading is enabled -if ! zstyle -b :omz:plugins:ssh-agent lazy; then +if ! zstyle -t :omz:plugins:ssh-agent lazy; then _add_identities fi From dbf555438e48fe447736200bd6f6d969a51a8086 Mon Sep 17 00:00:00 2001 From: Igor Gavelyuk Date: Wed, 13 Oct 2021 11:00:46 +0300 Subject: [PATCH 189/896] feat(obraun): display time with leading zeros (#10289) --- themes/obraun.zsh-theme | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/themes/obraun.zsh-theme b/themes/obraun.zsh-theme index cc2769e4b..c64362b04 100644 --- a/themes/obraun.zsh-theme +++ b/themes/obraun.zsh-theme @@ -2,10 +2,9 @@ if [ "$USERNAME" = "root" ]; then CARETCOLOR="red"; else CARETCOLOR="blue"; fi local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" -PROMPT='%{$fg[green]%}[%*]%{$reset_color%} %{$fg_no_bold[cyan]%}%n %{${fg_bold[blue]}%}::%{$reset_color%} %{$fg[yellow]%}%m%{$reset_color%} %{$fg_no_bold[magenta]%} âžś %{$reset_color%} %{${fg[green]}%}%3~ $(git_prompt_info)%{${fg_bold[$CARETCOLOR]}%}»%{${reset_color}%} ' +PROMPT='%{$fg[green]%}[%D{%H:%M:%S}]%{$reset_color%} %{$fg_no_bold[cyan]%}%n %{${fg_bold[blue]}%}::%{$reset_color%} %{$fg[yellow]%}%m%{$reset_color%} %{$fg_no_bold[magenta]%} âžś %{$reset_color%} %{${fg[green]}%}%3~ $(git_prompt_info)%{${fg_bold[$CARETCOLOR]}%}»%{${reset_color}%} ' RPS1="${return_code}" ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[red]%}‹" ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}" - From 19f9b6f1ade7788b07480be685cf3fcb117cad84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 13 Oct 2021 11:58:56 +0200 Subject: [PATCH 190/896] feat(updater): add support for terminal hyperlinks --- tools/upgrade.sh | 101 +++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 93 insertions(+), 8 deletions(-) diff --git a/tools/upgrade.sh b/tools/upgrade.sh index 1424d1433..7642858fe 100755 --- a/tools/upgrade.sh +++ b/tools/upgrade.sh @@ -15,11 +15,98 @@ cd "$ZSH" # Use colors, but only if connected to a terminal # and that terminal supports them. +# The [ -t 1 ] check only works when the function is not called from +# a subshell (like in `$(...)` or `(...)`, so this hack redefines the +# function at the top level to always return false when stdout is not +# a tty. +if [ -t 1 ]; then + is_tty() { + true + } +else + is_tty() { + false + } +fi + +# This function uses the logic from supports-hyperlinks[1][2], which is +# made by Kat Marchán (@zkat) and licensed under the Apache License 2.0. +# [1] https://github.com/zkat/supports-hyperlinks +# [2] https://crates.io/crates/supports-hyperlinks +# +# Copyright (c) 2021 Kat Marchán +# +# 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. +supports_hyperlinks() { + # $FORCE_HYPERLINK must be set and be non-zero (this acts as a logic bypass) + if [ -n "$FORCE_HYPERLINK" ]; then + [ "$FORCE_HYPERLINK" != 0 ] + return $? + fi + + # If stdout is not a tty, it doesn't support hyperlinks + is_tty || return 1 + + # DomTerm terminal emulator (domterm.org) + if [ -n "$DOMTERM" ]; then + return 0 + fi + + # VTE-based terminals above v0.50 (Gnome Terminal, Guake, ROXTerm, etc) + if [ -n "$VTE_VERSION" ]; then + [ $VTE_VERSION -ge 5000 ] + return $? + fi + + # If $TERM_PROGRAM is set, these terminals support hyperlinks + case "$TERM_PROGRAM" in + Hyper|iTerm.app|terminology|WezTerm) return 0 ;; + esac + + # kitty supports hyperlinks + if [ "$TERM" = xterm-kitty ]; then + return 0 + fi + + # Windows Terminal or Konsole also support hyperlinks + if [ -n "$WT_SESSION" ] || [ -n "$KONSOLE_VERSION" ]; then + return 0 + fi + + return 1 +} + +fmt_link() { + # $1: text, $2: url, $3: fallback mode + if supports_hyperlinks; then + printf '\033]8;;%s\a%s\033]8;;\a\n' "$2" "$1" + return + fi + + case "$3" in + --text) printf '%s\n' "$1" ;; + --url|*) fmt_underline "$2" ;; + esac +} + +fmt_underline() { + is_tty && printf '\033[4m%s\033[24m\n' "$*" || printf '%s\n' "$*" +} + setopt typeset_silent typeset -a RAINBOW -typeset RED GREEN YELLOW BLUE BOLD DIM UNDER RESET -if [ -t 1 ]; then +if is_tty; then RAINBOW=( "$(printf '\033[38;5;196m')" "$(printf '\033[38;5;202m')" @@ -35,8 +122,6 @@ if [ -t 1 ]; then YELLOW=$(printf '\033[33m') BLUE=$(printf '\033[34m') BOLD=$(printf '\033[1m') - DIM=$(printf '\033[2m') - UNDER=$(printf '\033[4m') RESET=$(printf '\033[0m') fi @@ -104,10 +189,10 @@ if git pull --rebase --stat $remote $branch; then printf '%s\____/%s_/ /_/ %s /_/ /_/ /_/%s\__, / %s /___/%s____/%s_/ /_/ %s\n' $RAINBOW $RESET printf '%s %s %s %s /____/ %s %s %s %s\n' $RAINBOW $RESET printf '\n' - printf "${BLUE}%s${RESET}\n" "$message" - printf "${BLUE}${BOLD}%s ${UNDER}%s${RESET}\n" "To keep up with the latest news and updates, follow us on Twitter:" "https://twitter.com/ohmyzsh" - printf "${BLUE}${BOLD}%s ${UNDER}%s${RESET}\n" "Want to get involved in the community? Join our Discord:" "https://discord.gg/ohmyzsh" - printf "${BLUE}${BOLD}%s ${UNDER}%s${RESET}\n" "Get your Oh My Zsh swag at:" "https://shop.planetargon.com/collections/oh-my-zsh" + printf "${BLUE}%s${RESET}\n\n" "$message" + printf "${BLUE}${BOLD}%s %s${RESET}\n" "To keep up with the latest news and updates, follow us on Twitter:" "$(fmt_link @ohmyzsh https://twitter.com/ohmyzsh)" + printf "${BLUE}${BOLD}%s %s${RESET}\n" "Want to get involved in the community? Join our Discord:" "$(fmt_link "Discord server" https://discord.gg/ohmyzsh)" + printf "${BLUE}${BOLD}%s %s${RESET}\n" "Get your Oh My Zsh swag at:" "$(fmt_link "Planet Argon Shop" https://shop.planetargon.com/collections/oh-my-zsh)" else ret=$? printf "${RED}%s${RESET}\n" 'There was an error updating. Try again later?' From 75fe22b40552305ef7636b7604ba99534d4f7808 Mon Sep 17 00:00:00 2001 From: Eric <192110+scribe@users.noreply.github.com> Date: Mon, 18 Oct 2021 11:58:25 -0600 Subject: [PATCH 191/896] docs(README): document new `zstyle` update settings (#10304) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Marc CornellĂ  --- README.md | 65 +++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 41 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 3ebea91e0..907248beb 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ It's a good idea to inspect the install script from projects you don't yet know. that by downloading the install script first, looking through it so everything looks normal, then running it: -```shell +```sh wget https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh sh install.sh ``` @@ -57,13 +57,13 @@ Oh My Zsh comes with a shitload of plugins for you to take advantage of. You can Once you spot a plugin (or several) that you'd like to use with Oh My Zsh, you'll need to enable them in the `.zshrc` file. You'll find the zshrc file in your `$HOME` directory. Open it with your favorite text editor and you'll see a spot to list all the plugins you want to load. -```shell +```sh vi ~/.zshrc ``` For example, this might begin to look like this: -```shell +```sh plugins=( git bundler @@ -91,13 +91,13 @@ _Robby's theme is the default one. It's not the fanciest one. It's not the simpl Once you find a theme that you'd like to use, you will need to edit the `~/.zshrc` file. You'll see an environment variable (all caps) in there that looks like: -```shell +```sh ZSH_THEME="robbyrussell" ``` To use a different theme, simply change the value to match the name of your desired theme. For example: -```shell +```sh ZSH_THEME="agnoster" # (this is one of the fancy ones) # see https://github.com/ohmyzsh/ohmyzsh/wiki/Themes#agnoster ``` @@ -112,13 +112,13 @@ In case you did not find a suitable theme for your needs, please have a look at If you're feeling feisty, you can let the computer select one randomly for you each time you open a new terminal window. -```shell +```sh ZSH_THEME="random" # (...please let it be pie... please be some pie..) ``` And if you want to pick random theme from a list of your favorite themes: -```shell +```sh ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" @@ -127,7 +127,7 @@ ZSH_THEME_RANDOM_CANDIDATES=( If you only know which themes you don't like, you can add them similarly to an ignored list: -```shell +```sh ZSH_THEME_RANDOM_IGNORED=(pygmalion tjkirch_mod) ``` @@ -152,7 +152,7 @@ If you'd like to change the install directory with the `ZSH` environment variabl `export ZSH=/your/path` before installing, or by setting it before the end of the install pipeline like this: -```shell +```sh ZSH="$HOME/.dotfiles/oh-my-zsh" sh install.sh ``` @@ -162,7 +162,7 @@ If you're running the Oh My Zsh install script as part of an automated install, flag `--unattended` to the `install.sh` script. This will have the effect of not trying to change the default shell, and also won't run `zsh` when the installation has finished. -```shell +```sh sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended ``` @@ -185,7 +185,7 @@ The install script also accepts these variables to allow installation of a diffe For example: -```shell +```sh REPO=apjanke/oh-my-zsh BRANCH=edge sh install.sh ``` @@ -193,13 +193,13 @@ REPO=apjanke/oh-my-zsh BRANCH=edge sh install.sh ##### 1. Clone the repository -```shell +```sh git clone https://github.com/ohmyzsh/ohmyzsh.git ~/.oh-my-zsh ``` ##### 2. *Optionally*, backup your existing `~/.zshrc` file -```shell +```sh cp ~/.zshrc ~/.zshrc.orig ``` @@ -207,13 +207,13 @@ cp ~/.zshrc ~/.zshrc.orig You can create a new zsh config file by copying the template that we have included for you. -```shell +```sh cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc ``` ##### 4. Change your default shell -```shell +```sh chsh -s $(which zsh) ``` @@ -242,23 +242,40 @@ If you would like to override the functionality of a plugin distributed with Oh ## Getting Updates -By default, you will be prompted to check for upgrades every few weeks. If you would like `oh-my-zsh` to automatically upgrade itself without prompting you, set the following in your `~/.zshrc`: +By default, you will be prompted to check for updates every 2 weeks. You can choose other update modes by adding a line to your `~/.zshrc` file, **before Oh My Zsh is loaded**: -```shell -DISABLE_UPDATE_PROMPT=true -``` +1. Automatic update without confirmation prompt: -To disable automatic upgrades, set the following in your `~/.zshrc`: + ```sh + zstyle ':omz:update' mode auto + ``` -```shell -DISABLE_AUTO_UPDATE=true +2. Just offer a reminder every few days, if there are updates available: + + ```sh + zstyle ':omz:update' mode reminder + ``` + +3. To disable automatic updates entirely: + + ```sh + zstyle ':omz:update' mode disabled + ``` + +NOTE: you can control how often Oh My Zsh checks for updates with the following setting: + +```sh +# This will check for updates every 7 days +zstyle ':omz:update' frequency 7 +# This will check for updates every time you open the terminal (not recommended) +zstyle ':omz:update' frequency 0 ``` ### Manual Updates -If you'd like to upgrade at any point in time (maybe someone just released a new plugin and you don't want to wait a week?) you just need to run: +If you'd like to update at any point in time (maybe someone just released a new plugin and you don't want to wait a week?) you just need to run: -```shell +```sh omz update ``` From f83bb65d47e5c0a238f4950294eeaeaa12738ce4 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Tue, 19 Oct 2021 10:50:41 -0700 Subject: [PATCH 192/896] Swapping gh with ghlp as 'gh' is reserved for the Github CLI. #9005 --- plugins/ruby/README.md | 3 ++- plugins/ruby/ruby.plugin.zsh | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/ruby/README.md b/plugins/ruby/README.md index a2de11991..d2beeb4b3 100644 --- a/plugins/ruby/README.md +++ b/plugins/ruby/README.md @@ -25,7 +25,8 @@ plugins=(... ruby) | gcb | `gem cert --build` | Build private key and self-signed certificate | | gclup | `gem cleanup -n` | Do not uninstall gem | | ggi | `gem generate_index` | Generate index file for gem server | -| gh | `gem help` | Provide additional help | +| ghlp | `gem help` | Provide additional help | | gl | `gem lock` | Generate a lockdown list of gems | | go | `gem open` | Open gem source in default editor | | goe | `gem open -e` | Open gem sources in preferred editor | + diff --git a/plugins/ruby/ruby.plugin.zsh b/plugins/ruby/ruby.plugin.zsh index 88e769d39..a7583497c 100644 --- a/plugins/ruby/ruby.plugin.zsh +++ b/plugins/ruby/ruby.plugin.zsh @@ -19,7 +19,7 @@ alias gcr="gem cert --remove" alias gcb="gem cert --build" alias gclup="gem cleanup -n" alias ggi="gem generate_index" -alias gh="gem help" +alias ghlp="gem help" alias gl="gem lock" alias go="gem open" alias goe="gem open -e" From 4b1f6d638f0783e05a9d2601ee0e1fd902416491 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 19 Oct 2021 20:07:40 +0200 Subject: [PATCH 193/896] feat(ruby): add multiple `gem` aliases (#9005) Mostly empty commit to fix the changelog for merge at 6f4c7f64 --- plugins/ruby/README.md | 1 - plugins/ruby/ruby.plugin.zsh | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/plugins/ruby/README.md b/plugins/ruby/README.md index d2beeb4b3..76afc79f6 100644 --- a/plugins/ruby/README.md +++ b/plugins/ruby/README.md @@ -29,4 +29,3 @@ plugins=(... ruby) | gl | `gem lock` | Generate a lockdown list of gems | | go | `gem open` | Open gem source in default editor | | goe | `gem open -e` | Open gem sources in preferred editor | - diff --git a/plugins/ruby/ruby.plugin.zsh b/plugins/ruby/ruby.plugin.zsh index a7583497c..c235b6b69 100644 --- a/plugins/ruby/ruby.plugin.zsh +++ b/plugins/ruby/ruby.plugin.zsh @@ -1,5 +1,4 @@ -# TODO: Make this compatible with rvm. -# Run sudo gem on the system ruby, not the active ruby. +# Run sudo gem on the system ruby, not the active ruby alias sgem='sudo gem' # Find ruby file From 8c1495a18e5ba496837bf3978300519edadffaff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 20 Oct 2021 17:09:38 +0200 Subject: [PATCH 194/896] fix(ruby)!: rename aliases that start with `g` to `ge` BREAKING CHANGE: all `gem` aliases that started with `g` now start with `ge` to fix conflicting names with the `git` plugin. Also, the `ghlp` alias is now renamed `geh`. Have a look at the plugin README for more information. Fixes #10320 --- plugins/ruby/README.md | 38 ++++++++++++++++++------------------ plugins/ruby/ruby.plugin.zsh | 28 +++++++++++++------------- 2 files changed, 33 insertions(+), 33 deletions(-) diff --git a/plugins/ruby/README.md b/plugins/ruby/README.md index 76afc79f6..59594ade7 100644 --- a/plugins/ruby/README.md +++ b/plugins/ruby/README.md @@ -10,22 +10,22 @@ plugins=(... ruby) ## Aliases -| Alias | Command | Description | -|-------|----------------------------------------|------------------------------------------------------| -| rb | `ruby` | The Ruby command | -| sgem | `sudo gem` | Run sudo gem on the system ruby, not the active ruby | -| rfind | `find . -name "*.rb" \| xargs grep -n` | Find ruby file | -| gin | `gem install` | Install a gem into the local repository | -| gun | `gem uninstall` | Uninstall gems from the local repository | -| gli | `gem list` | Display gems installed locally | -| gi | `gem info` | Show information for the given gem | -| giall | `gem info --all` | Display all gem versions | -| gca | `gem cert --add` | Add a trusted certificate | -| gcr | `gem cert --remove` | Remove a trusted certificate | -| gcb | `gem cert --build` | Build private key and self-signed certificate | -| gclup | `gem cleanup -n` | Do not uninstall gem | -| ggi | `gem generate_index` | Generate index file for gem server | -| ghlp | `gem help` | Provide additional help | -| gl | `gem lock` | Generate a lockdown list of gems | -| go | `gem open` | Open gem source in default editor | -| goe | `gem open -e` | Open gem sources in preferred editor | +| Alias | Command | Description | +|--------|----------------------------------------|------------------------------------------------------| +| rb | `ruby` | The Ruby command | +| sgem | `sudo gem` | Run sudo gem on the system ruby, not the active ruby | +| rfind | `find . -name "*.rb" \| xargs grep -n` | Find ruby file | +| gein | `gem install` | Install a gem into the local repository | +| geun | `gem uninstall` | Uninstall gems from the local repository | +| geli | `gem list` | Display gems installed locally | +| gei | `gem info` | Show information for the given gem | +| geiall | `gem info --all` | Display all gem versions | +| geca | `gem cert --add` | Add a trusted certificate | +| gecr | `gem cert --remove` | Remove a trusted certificate | +| gecb | `gem cert --build` | Build private key and self-signed certificate | +| geclup | `gem cleanup -n` | Do not uninstall gem | +| gegi | `gem generate_index` | Generate index file for gem server | +| geh | `gem help` | Provide additional help | +| gel | `gem lock` | Generate a lockdown list of gems | +| geo | `gem open` | Open gem source in default editor | +| geoe | `gem open -e` | Open gem sources in preferred editor | diff --git a/plugins/ruby/ruby.plugin.zsh b/plugins/ruby/ruby.plugin.zsh index c235b6b69..890fcb179 100644 --- a/plugins/ruby/ruby.plugin.zsh +++ b/plugins/ruby/ruby.plugin.zsh @@ -8,17 +8,17 @@ alias rfind='find . -name "*.rb" | xargs grep -n' alias rb="ruby" # Gem Command Shorthands -alias gin="gem install" -alias gun="gem uninstall" -alias gli="gem list" -alias gi="gem info" -alias giall="gem info --all" -alias gca="gem cert --add" -alias gcr="gem cert --remove" -alias gcb="gem cert --build" -alias gclup="gem cleanup -n" -alias ggi="gem generate_index" -alias ghlp="gem help" -alias gl="gem lock" -alias go="gem open" -alias goe="gem open -e" +alias gein="gem install" +alias geun="gem uninstall" +alias geli="gem list" +alias gei="gem info" +alias geiall="gem info --all" +alias geca="gem cert --add" +alias gecr="gem cert --remove" +alias gecb="gem cert --build" +alias geclup="gem cleanup -n" +alias gegi="gem generate_index" +alias geh="gem help" +alias gel="gem lock" +alias geo="gem open" +alias geoe="gem open -e" From 46f8765f4c871ef9b4e7f8bc448e45f4be15ff58 Mon Sep 17 00:00:00 2001 From: Rob Vadai Date: Wed, 20 Oct 2021 21:58:28 +0100 Subject: [PATCH 195/896] feat(osx): add `freespace` command to clean purgeable disk space (#8762) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Marc CornellĂ  --- plugins/osx/README.md | 43 +++++++++++++++++++------------------- plugins/osx/osx.plugin.zsh | 23 ++++++++++++++++++++ 2 files changed, 45 insertions(+), 21 deletions(-) diff --git a/plugins/osx/README.md b/plugins/osx/README.md index ecc9327d0..50458f60e 100644 --- a/plugins/osx/README.md +++ b/plugins/osx/README.md @@ -12,27 +12,28 @@ Original author: [Sorin Ionescu](https://github.com/sorin-ionescu) ## Commands -| Command | Description | -| :-------------- | :---------------------------------------------------- | -| `tab` | Open the current directory in a new tab | -| `split_tab` | Split the current terminal tab horizontally | -| `vsplit_tab` | Split the current terminal tab vertically | -| `ofd` | Open the current directory in a Finder window | -| `pfd` | Return the path of the frontmost Finder window | -| `pfs` | Return the current Finder selection | -| `cdf` | `cd` to the current Finder directory | -| `pushdf` | `pushd` to the current Finder directory | -| `pxd` | Return the current Xcode project directory | -| `cdx` | `cd` to the current Xcode project directory | -| `quick-look` | Quick-Look a specified file | -| `man-preview` | Open a specified man page in Preview app | -| `showfiles` | Show hidden files in Finder | -| `hidefiles` | Hide the hidden files in Finder | -| `itunes` | _DEPRECATED_. Use `music` from macOS Catalina on | -| `music` | Control Apple Music. Use `music -h` for usage details | -| `spotify` | Control Spotify and search by artist, album, track… | -| `rmdsstore` | Remove .DS\_Store files recursively in a directory | -| `btrestart` | Restart the Bluetooth daemon | +| Command | Description | +| :------------ | :------------------------------------------------------- | +| `tab` | Open the current directory in a new tab | +| `split_tab` | Split the current terminal tab horizontally | +| `vsplit_tab` | Split the current terminal tab vertically | +| `ofd` | Open the current directory in a Finder window | +| `pfd` | Return the path of the frontmost Finder window | +| `pfs` | Return the current Finder selection | +| `cdf` | `cd` to the current Finder directory | +| `pushdf` | `pushd` to the current Finder directory | +| `pxd` | Return the current Xcode project directory | +| `cdx` | `cd` to the current Xcode project directory | +| `quick-look` | Quick-Look a specified file | +| `man-preview` | Open a specified man page in Preview app | +| `showfiles` | Show hidden files in Finder | +| `hidefiles` | Hide the hidden files in Finder | +| `itunes` | _DEPRECATED_. Use `music` from macOS Catalina on | +| `music` | Control Apple Music. Use `music -h` for usage details | +| `spotify` | Control Spotify and search by artist, album, track… | +| `rmdsstore` | Remove .DS\_Store files recursively in a directory | +| `btrestart` | Restart the Bluetooth daemon | +| `freespace` | Erases purgeable disk space with 0s on the selected disk | ## Acknowledgements diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh index 5455d7c5f..16f16ddb6 100644 --- a/plugins/osx/osx.plugin.zsh +++ b/plugins/osx/osx.plugin.zsh @@ -233,6 +233,29 @@ function rmdsstore() { find "${@:-.}" -type f -name .DS_Store -delete } +# Erases purgeable disk space with 0s on the selected disk +function freespace(){ + if [[ -z "$1" ]]; then + echo "Usage: $0 " + echo "Example: $0 /dev/disk1s1" + echo + echo "Possible disks:" + df -h | awk 'NR == 1 || /^\/dev\/disk/' + return 1 + fi + + echo "Cleaning purgeable files from disk: $1 ...." + diskutil secureErase freespace 0 $1 +} + +_freespace() { + local -a disks + disks=("${(@f)"$(df | awk '/^\/dev\/disk/{ printf $1 ":"; for (i=9; i<=NF; i++) printf $i FS; print "" }')"}") + _describe disks disks +} + +compdef _freespace freespace + # Music / iTunes control function source "${0:h:A}/music" From f1dd97bb2a9df55fae9b1ca26c829b9f8b290667 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Sat, 23 Oct 2021 05:16:15 +0200 Subject: [PATCH 196/896] fix(ssh-agent): fix check for running `ssh-agent` process with hidepid /proc (#8492) Fixes #8492 --- plugins/ssh-agent/ssh-agent.plugin.zsh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/plugins/ssh-agent/ssh-agent.plugin.zsh b/plugins/ssh-agent/ssh-agent.plugin.zsh index c006f1413..47dfef5b0 100644 --- a/plugins/ssh-agent/ssh-agent.plugin.zsh +++ b/plugins/ssh-agent/ssh-agent.plugin.zsh @@ -6,9 +6,11 @@ function _start_agent() { if [[ -f "$ssh_env_cache" ]]; then . "$ssh_env_cache" > /dev/null - { - [[ "$USERNAME" = root ]] && command ps ax || command ps x - } | command grep ssh-agent | command grep -q $SSH_AGENT_PID && return 0 + # Test if $SSH_AUTH_SOCK is visible + zmodload zsh/net/socket + if [[ -S "$SSH_AUTH_SOCK" ]] && zsocket "$SSH_AUTH_SOCK" 2>/dev/null; then + return 0 + fi fi # Set a maximum lifetime for identities added to ssh-agent From 1e5e834e0f6486a569efd6b12ce4e33624fef0c9 Mon Sep 17 00:00:00 2001 From: Sina Tak Tehrani Date: Mon, 25 Oct 2021 20:28:22 +0200 Subject: [PATCH 197/896] fix(cli): exit `omz update` with correct error code (#10342) --- lib/cli.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/cli.zsh b/lib/cli.zsh index 4b14360c1..0b6bbc6cb 100644 --- a/lib/cli.zsh +++ b/lib/cli.zsh @@ -755,9 +755,9 @@ function _omz::update { # Run update script if [[ "$1" != --unattended ]]; then - ZSH="$ZSH" zsh -f "$ZSH/tools/upgrade.sh" --interactive + ZSH="$ZSH" zsh -f "$ZSH/tools/upgrade.sh" --interactive || return $? else - ZSH="$ZSH" zsh -f "$ZSH/tools/upgrade.sh" + ZSH="$ZSH" zsh -f "$ZSH/tools/upgrade.sh" || return $? fi # Update last updated file From c2b9ae29371f142fe7f2da694f893f1365170bc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 26 Oct 2021 13:23:07 +0200 Subject: [PATCH 198/896] fix(changelog): don't show more than 40 commits (#10345) Fixes #10345 --- tools/changelog.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/changelog.sh b/tools/changelog.sh index 7329a9526..ebdffba0a 100755 --- a/tools/changelog.sh +++ b/tools/changelog.sh @@ -400,7 +400,7 @@ function main { # commit if $since is unset, in short hash form. command git rev-list --abbrev-commit --abbrev=7 ${since:+$since..}$until | while read hash; do # Truncate list on versions with a lot of commits - if [[ -z "$since" ]] && (( ++read_commits > 35 )); then + if (( ++read_commits > 40 )); then truncate=1 break fi From 4f67b02a9f43b0996ad85ee600b468399e1477e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Camelo=20Freitas?= Date: Tue, 26 Oct 2021 07:07:46 -0700 Subject: [PATCH 199/896] feat(mix): update `mix` commands and descriptions (#10273) --- plugins/mix/README.md | 16 ++++++++-------- plugins/mix/_mix | 43 +++++++++++++++++++++++++++++++++++-------- 2 files changed, 43 insertions(+), 16 deletions(-) diff --git a/plugins/mix/README.md b/plugins/mix/README.md index 878f370f2..f0258fe88 100644 --- a/plugins/mix/README.md +++ b/plugins/mix/README.md @@ -9,11 +9,11 @@ plugins=(... mix) ``` ## Supported Task Types -| Task Type | Documentation | -|-------------------------|----------------------------------------------------------| -| Elixir | [Elixir Lang](https://elixir-lang.org/) | -| Phoenix v1.2.1 and below| [Phoenix](https://hexdocs.pm/phoenix/1.2.1/Phoenix.html) | -| Phoenix v1.3.0 and above| [Phoenix](https://hexdocs.pm/phoenix/Phoenix.html) | -| Ecto | [Ecto](https://hexdocs.pm/ecto/Ecto.html) | -| Hex | [Hex](https://hex.pm/) | -| Nerves | [Nerves](https://nerves-project.org/) | +| Task Type | Documentation | +|--------------------------|----------------------------------------------------------| +| Elixir | [Elixir Lang](https://elixir-lang.org/) | +| Phoenix v1.2.1 and below | [Phoenix](https://hexdocs.pm/phoenix/1.2.1/Phoenix.html) | +| Phoenix v1.3.0 and above | [Phoenix](https://hexdocs.pm/phoenix/Phoenix.html) | +| Ecto | [Ecto](https://hexdocs.pm/ecto/Ecto.html) | +| Hex | [Hex](https://hex.pm/) | +| Nerves | [Nerves](https://nerves-project.org/) | diff --git a/plugins/mix/_mix b/plugins/mix/_mix index c0fe68c91..7940ff1c9 100644 --- a/plugins/mix/_mix +++ b/plugins/mix/_mix @@ -5,8 +5,10 @@ local -a _1st_arguments _1st_arguments=( + 'app.config:Configures all registered apps' 'app.start:Start all registered apps' - 'archive:List all archives' + 'app.tree:Prints the application tree' + 'archive:Lists installed archives' 'archive.build:Archive this project into a .ez file' 'archive.install:Install an archive locally' 'archive.uninstall:Uninstall archives' @@ -18,6 +20,7 @@ _1st_arguments=( "deps.clean:Remove the given dependencies' files" 'deps.compile:Compile dependencies' 'deps.get:Get all out of date dependencies' + 'deps.tree:Prints the dependency tree' 'deps.unlock:Unlock the given dependencies' 'deps.update:Update the given dependencies' 'do:Executes the tasks separated by comma' @@ -30,27 +33,39 @@ _1st_arguments=( 'ecto.migrate:Runs Ecto migration' 'ecto.migrations:Displays the up / down migration status' 'ecto.rollback:Reverts applied migrations' + 'escript:Lists installed escripts' 'escript.build:Builds an escript for the project' + 'escript.install:Installs an escript locally' + 'escript.uninstall:Uninstalls escripts' 'firmware:Nerves - Build a firmware image for the selected target platform' 'firmware.burn:Nerves - Writes the generated firmware image to an attached SDCard or file' 'firmware.image:Nerves - Create a firmware image file that can be copied byte-for-byte' 'format:Formats the given files and patterns' 'help:Print help information for tasks' 'hex:Print hex help information' - 'hex.config:Read or update hex config' - 'hex.docs:Publish docs for package' + 'hex.audit:Shows retired Hex deps for the current project' + 'hex.build:Builds a new package version locally' + 'hex.config:Reads, updates or deletes local Hex config' + 'hex.docs:Fetches or opens documentation of a package' 'hex.info:Print hex information' + 'hex.organization:Manages Hex.pm organizations' 'hex.key:Hex API key tasks' - 'hex.outdated:Shows outdated hex deps for the current project' - 'hex.owner:Hex package ownership tasks' + 'hex.outdated:Shows outdated Hex deps for the current project' + 'hex.owner:Manages Hex package ownership' + 'hex.package:Fetches or diffs packages' 'hex.publish:Publish a new package version' + 'hex.registry:Manages local Hex registries' + 'hex.repo:Manages Hex repositories' + 'hex.retire:Retires a package version' 'hex.search:Search for package names' - 'hex.user:Hex user tasks' + 'hex.sponsor:Show Hex packages accepting sponsorships' + 'hex.user:Manages your Hex user account' 'loadconfig:Loads and persists the given configuration' 'local:List local tasks' 'local.hex:Install hex locally' 'local.phoenix:Updates Phoenix locally' 'local.phx:Updates the Phoenix project generator locally' + 'local.public_keys:Manages public keys' 'local.rebar:Install rebar locally' 'nerves.artifact:Create an artifact for a specified Nerves package' 'nerves.artifact.get:Nerves get artifacts' @@ -69,21 +84,33 @@ _1st_arguments=( 'phoenix.server:Starts applications and their servers' 'phx.digest:Digests and compresses static files' 'phx.digest.clean:Removes old versions of static assets.' + 'phx.gen.auth:Generates authentication logic for a resource' + 'phx.gen.cert:Generates a self-signed certificate for HTTPS testing' 'phx.gen.channel:Generates a Phoenix channel' 'phx.gen.context:Generates a context with functions around an Ecto schema' 'phx.gen.embedded:Generates an embedded Ecto schema file' 'phx.gen.html:Generates controller, views, and context for an HTML resource' 'phx.gen.json:Generates controller, views, and context for a JSON resource' + 'phx.gen.live:Generates LiveView, templates, and context for a resource' + 'phx.gen.notifier:Generates a notifier that delivers emails by default' 'phx.gen.presence:Generates a Presence tracker' 'phx.gen.schema:Generates an Ecto schema and migration file' 'phx.gen.secret:Generates a secret' - 'phx.new:Creates a new Phoenix v1.3.0 application' + 'phx.gen.socket:Generates a Phoenix socket handler' + 'phx.new:Creates a new Phoenix application' 'phx.new.ecto:Creates a new Ecto project within an umbrella project' 'phx.new.web:Creates a new Phoenix web project within an umbrella project' 'phx.routes:Prints all routes' 'phx.server:Starts applications and their servers' + 'profile.cprof:Profiles the given file or expression with cprof' + 'profile.eprof:Profiles the given file or expression with eprof' + 'profile.fprof:Profiles the given file or expression with fprof' + 'release:Assembles a self-contained release' + 'release.init:Generates sample files for releases' 'run:Run the given file or expression' "test:Run a project's tests" + 'test.coverage:Build report from exported test coverage' + 'xref:Prints cross reference information' '--help:Describe available tasks' '--version:Prints the Elixir version information' ) @@ -93,7 +120,7 @@ __task_list () local expl declare -a tasks - tasks=(app.start archive archive.build archive.install archive.uninstall clean cmd compile compile.protocols deps deps.clean deps.compile deps.get deps.unlock deps.update do escript.build format help hex hex.config hex.docs hex.info hex.key hex.outdated hex.owner hex.publish hex.search hex.user loadconfig local local.hex local.rebar new phoenix.digest phoenix.gen.channel phoenix.gen.html phoenix.gen.json phoenix.gen.model phoenix.gen.secret phoenix.new phoenix.routes phoenix.server phx.digest phx.digest.clean phx.gen.channel phx.gen.context phx.gen.embedded phx.gen.html phx.gen.json phx.gen.presence phx.gen.schema phx.gen.secret phx.new phx.new.ecto phx.new.web phx.routes phx.server run test) + tasks=(app.config app.start app.tree archive archive.build archive.install archive.uninstall clean cmd compile compile.protocols deps deps.clean deps.compile deps.get deps.tree deps.unlock deps.update do ecto.create ecto.drop ecto.dump ecto.gen.migration ecto.gen.repo ecto.load ecto.migrate ecto.migrations ecto.rollback escript escript.build escript.install escript.uninstall firmware firmware.burn firmware.image format help hex hex.audit hex.build hex.config hex.docs hex.info hex.organization hex.key hex.outdated hex.owner hex.package hex.publish hex.registry hex.repo hex.retire hex.search hex.sponsor hex.user loadconfig local local.hex local.phoenix local.phx local.public_keys local.rebar nerves.artifact nerves.artifact.get nerves.info nerves.new nerves.release.init new phoenix.digest phoenix.gen.channel phoenix.gen.html phoenix.gen.json phoenix.gen.model phoenix.gen.secret phoenix.new phoenix.routes phoenix.server phx.digest phx.digest.clean phx.gen.auth phx.gen.cert phx.gen.channel phx.gen.context phx.gen.embedded phx.gen.html phx.gen.json phx.gen.live phx.gen.notifier phx.gen.presence phx.gen.schema phx.gen.secret phx.gen.socket phx.new phx.new.ecto phx.new.web phx.routes phx.server profile.cprof profile.eprof profile.fprof release release.init run test test.coverage xref) _wanted tasks expl 'help' compadd $tasks } From 9c8131e417a15fccb15615e3b03ce44a53678fe0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 26 Oct 2021 18:24:29 +0200 Subject: [PATCH 200/896] perf(changelog): use a single `git log` command to get all commit messages --- tools/changelog.sh | 50 +++++++++++++++++++++++++++++++--------------- 1 file changed, 34 insertions(+), 16 deletions(-) diff --git a/tools/changelog.sh b/tools/changelog.sh index ebdffba0a..13cfb9530 100755 --- a/tools/changelog.sh +++ b/tools/changelog.sh @@ -1,5 +1,8 @@ #!/usr/bin/env zsh +cd "$ZSH" +setopt extendedglob + ############################## # CHANGELOG SCRIPT CONSTANTS # ############################## @@ -114,15 +117,8 @@ function parse-commit { fi } - # Ignore commit if it is a merge commit - if [[ $(command git show -s --format=%p $1 | wc -w) -gt 1 ]]; then - return - fi - # Parse commit with hash $1 - local hash="$1" subject body warning rhash - subject="$(command git show -s --format=%s $hash)" - body="$(command git show -s --format=%b $hash)" + local hash="$1" subject="$2" body="$3" warning rhash # Commits following Conventional Commits (https://www.conventionalcommits.org/) # have the following format, where parts between [] are optional: @@ -384,7 +380,8 @@ function main { # Commit classification arrays local -A commits subjects scopes breaking reverts local truncate=0 read_commits=0 - local hash version tag + local version tag + local hash refs subject body # Get the first version name: # 1) try tag-like version, or @@ -396,17 +393,40 @@ function main { || version=$(command git symbolic-ref --quiet --short $until 2>/dev/null) \ || version=$(command git rev-parse --short $until 2>/dev/null) - # Get commit list from $until commit until $since commit, or until root - # commit if $since is unset, in short hash form. - command git rev-list --abbrev-commit --abbrev=7 ${since:+$since..}$until | while read hash; do + # Get commit list from $until commit until $since commit, or until root commit if $since is unset + local range=${since:+$since..}$until + + # Git log options + # -z: commits are delimited by null bytes + # --format: [7-char hash][ref names][subject][body] + # --abbrev=7: force commit hashes to be 7 characters long + # --no-merges: merge commits are omitted + local SEP="0mZmAgIcSeP" + local -a raw_commits + raw_commits=(${(0)"$(command git log -z \ + --format="%h${SEP}%D${SEP}%s${SEP}%b" --abbrev=7 \ + --no-merges $range)"}) + + local raw_commit + local -a raw_fields + for raw_commit in $raw_commits; do # Truncate list on versions with a lot of commits if (( ++read_commits > 40 )); then truncate=1 break fi + # Read the commit fields (@ is needed to keep empty values) + raw_fields=("${(@ps:$SEP:)raw_commit}") + hash="${raw_fields[1]}" + refs="${raw_fields[2]}" + subject="${raw_fields[3]}" + body="${raw_fields[4]}" + # If we find a new release (exact tag) - if tag=$(command git describe --exact-match --tags $hash 2>/dev/null); then + if [[ "$refs" = *tag:\ * ]]; then + # Parse tag name (needs: setopt extendedglob) + tag="${${refs##*tag: }%%,# *}" # Output previous release display-release # Reinitialize commit storage @@ -420,7 +440,7 @@ function main { read_commits=1 fi - parse-commit "$hash" + parse-commit "$hash" "$subject" "$body" done display-release @@ -431,8 +451,6 @@ function main { fi } -cd "$ZSH" - # Use raw output if stdout is not a tty if [[ ! -t 1 && -z "$3" ]]; then main "$1" "$2" --raw From 140bfa84320d6f0a9c3b429c1c6be41878e60352 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 26 Oct 2021 18:26:02 +0200 Subject: [PATCH 201/896] fix(changelog): go back to ignoring commits from merged branches --- tools/changelog.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/changelog.sh b/tools/changelog.sh index 13cfb9530..5c3159732 100755 --- a/tools/changelog.sh +++ b/tools/changelog.sh @@ -401,17 +401,18 @@ function main { # --format: [7-char hash][ref names][subject][body] # --abbrev=7: force commit hashes to be 7 characters long # --no-merges: merge commits are omitted + # --first-parent: commits from merged branches are omitted local SEP="0mZmAgIcSeP" local -a raw_commits raw_commits=(${(0)"$(command git log -z \ --format="%h${SEP}%D${SEP}%s${SEP}%b" --abbrev=7 \ - --no-merges $range)"}) + --no-merges --first-parent $range)"}) local raw_commit local -a raw_fields for raw_commit in $raw_commits; do # Truncate list on versions with a lot of commits - if (( ++read_commits > 40 )); then + if [[ -z "$since" ]] && (( ++read_commits > 35 )); then truncate=1 break fi From 0267cb89eba6dc9f2744bfba73ada391a6582249 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 26 Oct 2021 18:59:39 +0200 Subject: [PATCH 202/896] perf(changelog): use regex-match instead of `sed` to parse commit subjects --- tools/changelog.sh | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/tools/changelog.sh b/tools/changelog.sh index 5c3159732..3641179e2 100755 --- a/tools/changelog.sh +++ b/tools/changelog.sh @@ -52,10 +52,15 @@ function parse-commit { # make a breaking change function commit:type { - local type="$(sed -E 's/^([a-zA-Z_\-]+)(\(.+\))?!?: .+$/\1/' <<< "$1")" + local type + + # Parse commit type from the subject + if [[ "$1" =~ '^([a-zA-Z_\-]+)(\(.+\))?!?: .+$' ]]; then + type="${match[1]}" + fi # If $type doesn't appear in $TYPES array mark it as 'other' - if [[ -n "${(k)TYPES[(i)$type]}" ]]; then + if [[ -n "$type" && -n "${(k)TYPES[(i)$type]}" ]]; then echo $type else echo other @@ -66,17 +71,18 @@ function parse-commit { local scope # Try to find scope in "type():" format - scope=$(sed -nE 's/^[a-zA-Z_\-]+\((.+)\)!?: .+$/\1/p' <<< "$1") - if [[ -n "$scope" ]]; then - echo "$scope" + if [[ "$1" =~ '^[a-zA-Z_\-]+\((.+)\)!?: .+$' ]]; then + echo "${match[1]}" return fi # If no scope found, try to find it in ":" format - # Make sure it's not a type before printing it - scope=$(sed -nE 's/^([a-zA-Z_\-]+): .+$/\1/p' <<< "$1") - if [[ -z "${(k)TYPES[(i)$scope]}" ]]; then - echo "$scope" + if [[ "$1" =~ '^([a-zA-Z_\-]+): .+$' ]]; then + scope="${match[1]}" + # Make sure it's not a type before printing it + if [[ -z "${(k)TYPES[(i)$scope]}" ]]; then + echo "$scope" + fi fi } @@ -84,7 +90,11 @@ function parse-commit { # Only display the relevant part of the commit, i.e. if it has the format # type[(scope)!]: subject, where the part between [] is optional, only # displays subject. If it doesn't match the format, returns the whole string. - sed -E 's/^[a-zA-Z_\-]+(\(.+\))?!?: (.+)$/\2/' <<< "$1" + if [[ "$1" =~ '^[a-zA-Z_\-]+(\(.+\))?!?: (.+)$' ]]; then + echo "${match[2]}" + else + echo "$1" + fi } # Return subject if the body or subject match the breaking change format From 4b3a5c54117fa8af12878d1b659c14214cb4bbec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 26 Oct 2021 20:54:39 +0200 Subject: [PATCH 203/896] fix(changelog): fix percent escapes in `printf` calls --- tools/changelog.sh | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/tools/changelog.sh b/tools/changelog.sh index 3641179e2..e32d503b1 100755 --- a/tools/changelog.sh +++ b/tools/changelog.sh @@ -201,9 +201,9 @@ function display-release { #* Uses $hash from outer scope local hash="${1:-$hash}" case "$output" in - raw) printf "$hash" ;; - text) printf "\e[33m$hash\e[0m" ;; # red - md) printf "[\`$hash\`](https://github.com/ohmyzsh/ohmyzsh/commit/$hash)" ;; + raw) printf '%s' "$hash" ;; + text) printf '\e[33m%s\e[0m' "$hash" ;; # red + md) printf '[`%s`](https://github.com/ohmyzsh/ohmyzsh/commit/%s)' "$hash" ;; esac } @@ -215,16 +215,16 @@ function display-release { case "$output" in raw) case "$level" in - 1) printf "$header\n$(printf '%.0s=' {1..${#header}})\n\n" ;; - 2) printf "$header\n$(printf '%.0s-' {1..${#header}})\n\n" ;; - *) printf "$header:\n\n" ;; + 1) printf '%s\n%s\n\n' "$header" "$(printf '%.0s=' {1..${#header}})" ;; + 2) printf '%s\n%s\n\n' "$header" "$(printf '%.0s-' {1..${#header}})" ;; + *) printf '%s:\n\n' "$header" ;; esac ;; text) case "$level" in - 1|2) printf "\e[1;4m$header\e[0m\n\n" ;; # bold, underlined - *) printf "\e[1m$header:\e[0m\n\n" ;; # bold + 1|2) printf '\e[1;4m%s\e[0m\n\n' "$header" ;; # bold, underlined + *) printf '\e[1m%s:\e[0m\n\n' "$header" ;; # bold esac ;; - md) printf "$(printf '%.0s#' {1..${level}}) $header\n\n" ;; + md) printf '%s %s\n\n' "$(printf '%.0s#' {1..${level}})" "$header" ;; esac } @@ -250,8 +250,8 @@ function display-release { # Print [scope] case "$output" in - raw|md) printf "[$scope]${padding} " ;; - text) printf "[\e[38;5;9m$scope\e[0m]${padding} " ;; # red 9 + raw|md) printf '[%s]%s ' "$scope" "$padding";; + text) printf '[\e[38;5;9m%s\e[0m]%s ' "$scope" "$padding";; # red 9 esac } @@ -264,7 +264,7 @@ function display-release { subject="${(U)subject:0:1}${subject:1}" case "$output" in - raw) printf "$subject" ;; + raw) printf '%s' "$subject" ;; # In text mode, highlight (#) and dim text between `backticks` text) sed -E $'s|#([0-9]+)|\e[32m#\\1\e[0m|g;s|`([^`]+)`|`\e[2m\\1\e[0m`|g' <<< "$subject" ;; # In markdown mode, link to (#) issues @@ -277,8 +277,8 @@ function display-release { local type="${1:-${TYPES[$type]:-${(C)type}}}" [[ -z "$type" ]] && return 0 case "$output" in - raw|md) printf "$type: " ;; - text) printf "\e[4m$type\e[24m: " ;; # underlined + raw|md) printf '%s: ' "$type" ;; + text) printf '\e[4m%s\e[24m: ' "$type" ;; # underlined esac } @@ -292,7 +292,7 @@ function display-release { (( $#breaking != 0 )) || return 0 case "$output" in - text) fmt:header "\e[31mBREAKING CHANGES" 3 ;; + text) printf '\e[31m'; fmt:header "BREAKING CHANGES" 3 ;; raw) fmt:header "BREAKING CHANGES" 3 ;; md) fmt:header "BREAKING CHANGES âš " 3 ;; esac From 1dba1120410280699c6a97a5252bab24681b46b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 27 Oct 2021 10:12:23 +0200 Subject: [PATCH 204/896] fix(changelog): fix for `${(@ps:$sep:)var}` construct in zsh < 5.0.8 In recent zsh versions, `${(@ps:$sep:)var}` where $sep is a variable containing a separator string and $var is a string with multiple values separated by $sep, the `p` flag makes zsh correctly expand $sep before splitting $var. In versions older than 5.0.8, this doesn't happen, so we use `eval` to get the same effect. --- tools/changelog.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/changelog.sh b/tools/changelog.sh index e32d503b1..664f34608 100755 --- a/tools/changelog.sh +++ b/tools/changelog.sh @@ -428,7 +428,7 @@ function main { fi # Read the commit fields (@ is needed to keep empty values) - raw_fields=("${(@ps:$SEP:)raw_commit}") + eval "raw_fields=(\"\${(@ps:$SEP:)raw_commit}\")" hash="${raw_fields[1]}" refs="${raw_fields[2]}" subject="${raw_fields[3]}" From 2e46b2a2dcb96cadd94283bdce95eca75bef1433 Mon Sep 17 00:00:00 2001 From: Christophe Bliard Date: Wed, 27 Oct 2021 11:40:09 +0200 Subject: [PATCH 205/896] feat(fzf): support getting fzf from nix-darwin (#10355) --- plugins/fzf/fzf.plugin.zsh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/fzf/fzf.plugin.zsh b/plugins/fzf/fzf.plugin.zsh index a979fe222..aabd62cb1 100644 --- a/plugins/fzf/fzf.plugin.zsh +++ b/plugins/fzf/fzf.plugin.zsh @@ -20,7 +20,9 @@ function setup_using_base_dir() { done if [[ -z "${fzf_base}" ]]; then - if (( ${+commands[brew]} )) && dir="$(brew --prefix fzf 2>/dev/null)"; then + if (( ${+commands[fzf-share]} )) && dir="$(fzf-share)" && [[ -d "${dir}" ]]; then + fzf_base="${dir}" + elif (( ${+commands[brew]} )) && dir="$(brew --prefix fzf 2>/dev/null)"; then if [[ -d "${dir}" ]]; then fzf_base="${dir}" fi From 1861b5f175dc8f6d6408772b707c9d6deb28a53f Mon Sep 17 00:00:00 2001 From: YR Chen Date: Fri, 29 Oct 2021 23:40:23 +0800 Subject: [PATCH 206/896] feat(xcode): support `Package.swift` as project file in `xc` (#10358) --- plugins/xcode/README.md | 2 +- plugins/xcode/xcode.plugin.zsh | 28 +++++++++------------------- 2 files changed, 10 insertions(+), 20 deletions(-) diff --git a/plugins/xcode/README.md b/plugins/xcode/README.md index 37f882638..664a063a3 100644 --- a/plugins/xcode/README.md +++ b/plugins/xcode/README.md @@ -26,7 +26,7 @@ plugins=(... xcode) ### `xc` -Opens the current directory in Xcode as an Xcode project. This will open one of the `.xcworkspace` and `.xcodeproj` files that it can find in the current working directory. You can also specify a directory to look in for the Xcode files. +Opens the current directory in Xcode as an Xcode project or a Swift package. This will open one of the `.xcworkspace`, `.xcodeproj` and `Package.swift` files that it can find in the current working directory. You can also specify a directory to look in for the Xcode files. Returns 1 if it didn't find any relevant files. ### `xx` diff --git a/plugins/xcode/xcode.plugin.zsh b/plugins/xcode/xcode.plugin.zsh index 89703fe3c..41b9e37e4 100644 --- a/plugins/xcode/xcode.plugin.zsh +++ b/plugins/xcode/xcode.plugin.zsh @@ -6,28 +6,18 @@ alias xcsel='sudo xcode-select --switch' # original author: @subdigital # source: https://gist.github.com/subdigital/5420709 function xc { - local xcode_proj - if [[ $# == 0 ]]; then - xcode_proj=(*.{xcworkspace,xcodeproj}(N)) - else - xcode_proj=($1/*.{xcworkspace,xcodeproj}(N)) - fi + local xcode_files + xcode_files=(${1:-.}/{*.{xcworkspace,xcodeproj},Package.swift}(N)) - - if [[ ${#xcode_proj} -eq 0 ]]; then - if [[ $# == 0 ]]; then - echo "No xcworkspace/xcodeproj file found in the current directory." - else - echo "No xcworkspace/xcodeproj file found in $1." - fi + if [[ ${#xcode_files} -eq 0 ]]; then + echo "No Xcode files found in ${1:-the current directory}." >&2 return 1 - else - local active_path - active_path=$(xcode-select -p) - active_path=${active_path%%/Contents/Developer*} - echo "Found ${xcode_proj[1]}. Opening with ${active_path}" - open -a "$active_path" "${xcode_proj[1]}" fi + + local active_path + active_path=${"$(xcode-select -p)"%%/Contents/Developer*} + echo "Found ${xcode_files[1]}. Opening with ${active_path}" + open -a "$active_path" "${xcode_files[1]}" } # Opens a file or files in the Xcode IDE. Multiple files are opened in multi-file browser From 04c96e235ff522704a6f1482e7fd06a05467cbb7 Mon Sep 17 00:00:00 2001 From: Afzal Sayed <14029371+afzalsayed96@users.noreply.github.com> Date: Sat, 30 Oct 2021 16:50:30 +0530 Subject: [PATCH 207/896] chore: fix grammar mistake in `CONTRIBUTING.md` (#10362) --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4903584ee..605142845 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -202,7 +202,7 @@ type(scope)!: subject feat(archlinux): add support for aura AUR helper (#9467) ``` - - Formatted inline code by using backticks: the text inbetween backticks will also be highlighted by + - Formatted inline code by using backticks: the text between backticks will also be highlighted by the changelog tool: ``` feat(shell-proxy): enable unexported `DEFAULT_PROXY` setting (#9774) From bf88ff3f904e7b6675ff142e44d8aae3132bad96 Mon Sep 17 00:00:00 2001 From: Richard Mitchell Date: Tue, 2 Nov 2021 07:05:37 -0400 Subject: [PATCH 208/896] fix(lib): fix `1` alias to `cd` to directory 1 in stack (#10370) --- lib/directories.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/directories.zsh b/lib/directories.zsh index cf87bd7e4..6696854b0 100644 --- a/lib/directories.zsh +++ b/lib/directories.zsh @@ -9,7 +9,7 @@ alias -g .....='../../../..' alias -g ......='../../../../..' alias -- -='cd -' -alias 1='cd -' +alias 1='cd -1' alias 2='cd -2' alias 3='cd -3' alias 4='cd -4' From 49458b872d1bab1aa8338e319f27c9b3705c9fd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Fri, 29 Oct 2021 18:21:13 +0200 Subject: [PATCH 209/896] docs(dirhistory): document OPT key alternative for macOS and fix style Fixes #10350 --- plugins/dirhistory/README.md | 42 ++++++++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 11 deletions(-) diff --git a/plugins/dirhistory/README.md b/plugins/dirhistory/README.md index 602fc8284..ede9b5410 100644 --- a/plugins/dirhistory/README.md +++ b/plugins/dirhistory/README.md @@ -12,19 +12,27 @@ plugins=(... dirhistory) | Shortcut | Description | |-----------------------------------|-----------------------------------------------------------| -| alt + left | Go to previous directory | -| alt + right | Undo alt + left | -| alt + up | Move into the parent directory | -| alt + down | Move into the first child directory by alphabetical order | +| Alt + Left | Go to previous directory | +| Alt + Right | Go to next directory | +| Alt + Up | Move into the parent directory | +| Alt + Down | Move into the first child directory by alphabetical order | -NOTE: some terminals might override the ALT+Arrows key bindings (Windows Terminal, for example). -If these don't work check your terminal settings and change them to a different keyboard shortcut. +**For macOS: use the Option key (⌥) instead of Alt**. + +> NOTE: some terminals might override the Alt + Arrows key bindings (e.g. Windows Terminal). +> If these don't work check your terminal settings and change them to a different keyboard shortcut. ## Usage -This plugin allows you to navigate the history of previous current-working-directories using ALT-LEFT and ALT-RIGHT. ALT-LEFT moves back to directories that the user has changed to in the past, and ALT-RIGHT undoes ALT-LEFT. MAC users may alternately use OPT-LEFT and OPT-RIGHT. +This plugin allows you to navigate the history of previous working directories using Alt + Left +and Alt + Right. Alt + Left moves to past directories, and +Alt + Right goes back to recent directories. -Also, navigate directory **hierarchy** using ALT-UP and ALT-DOWN. (mac keybindings not yet implemented). ALT-UP moves to higher hierarchy (shortcut for 'cd ..'). ALT-DOWN moves into the first directory found in alphabetical order (useful to navigate long empty directories e.g. java packages) +**NOTE: the maximum directory history size is 30.** + +You can also navigate **directory hierarchies** using Alt + Up and Alt + Down. +Alt + Up moves to the parent directory, while Alt + Down moves into the first +child directory found in alphabetical order (useful to navigate long empty directories, e.g. Java packages). For example, if the shell was started, and the following commands were entered: @@ -35,8 +43,20 @@ cd share cd doc ``` -Then entering ALT-LEFT at the prompt would change directory from /usr/share/doc to /usr/share, then if pressed again to /usr/, then ~. If ALT-RIGHT were pressed the directory would be changed to /usr/ again. +the directory stack (`dirs -v`) would look like this: -After that, ALT-DOWN will probably go to /usr/bin (depends on your /usr structure), ALT-UP will return to /usr, then ALT-UP will get you to / +```console +$ dirs -v +0 /usr/share/doc +1 /usr/share +2 /usr +3 ~ +``` -**Currently the max history size is 30**. The navigation should work for xterm, PuTTY xterm mode, GNU screen, and on MAC with alternate keys as mentioned above. +then entering Alt + Left at the prompt would change directory from `/usr/share/doc` to `/usr/share`, +then if pressed again to `/usr`, then `~`. If Alt + Right were pressed the directory would be changed +to `/usr` again. + +After that, Alt + Down will probably go to `/usr/bin` if `bin` is the first directory in alphabetical +order (depends on your `/usr` folder structure). Alt + Up will return to `/usr`, and once more will get +you to the root folder (`/`). From 7f494944e6e8047b49fdbd42977b4eb4670381fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Fri, 29 Oct 2021 18:22:35 +0200 Subject: [PATCH 210/896] fix(dirhistory): fix ALT+Up/Down key bindings for Terminal.app --- plugins/dirhistory/dirhistory.plugin.zsh | 76 ++++++++++-------------- 1 file changed, 32 insertions(+), 44 deletions(-) diff --git a/plugins/dirhistory/dirhistory.plugin.zsh b/plugins/dirhistory/dirhistory.plugin.zsh index cbac84600..d949064d8 100644 --- a/plugins/dirhistory/dirhistory.plugin.zsh +++ b/plugins/dirhistory/dirhistory.plugin.zsh @@ -121,35 +121,24 @@ function dirhistory_zle_dirhistory_future() { } zle -N dirhistory_zle_dirhistory_back -# xterm in normal mode -bindkey "\e[3D" dirhistory_zle_dirhistory_back -bindkey "\e[1;3D" dirhistory_zle_dirhistory_back -# Terminal.app -if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]]; then - bindkey "^[b" dirhistory_zle_dirhistory_back -fi -# iTerm2 -if [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then - bindkey "^[^[[D" dirhistory_zle_dirhistory_back -fi -# Putty: -bindkey "\e\e[D" dirhistory_zle_dirhistory_back -# GNU screen: -bindkey "\eO3D" dirhistory_zle_dirhistory_back +bindkey "\e[3D" dirhistory_zle_dirhistory_back # xterm in normal mode +bindkey "\e[1;3D" dirhistory_zle_dirhistory_back # xterm in normal mode +bindkey "\e\e[D" dirhistory_zle_dirhistory_back # Putty +bindkey "\eO3D" dirhistory_zle_dirhistory_back # GNU screen +case "$TERM_PROGRAM" in +iTerm.app) bindkey "^[^[[D" dirhistory_zle_dirhistory_back ;; # iTerm2 +Apple_Terminal) bindkey "^[b" dirhistory_zle_dirhistory_back ;; # Terminal.app +esac zle -N dirhistory_zle_dirhistory_future -bindkey "\e[3C" dirhistory_zle_dirhistory_future -bindkey "\e[1;3C" dirhistory_zle_dirhistory_future -# Terminal.app -if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]]; then - bindkey "^[f" dirhistory_zle_dirhistory_future -fi -# iTerm2 -if [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then - bindkey "^[^[[C" dirhistory_zle_dirhistory_future -fi -bindkey "\e\e[C" dirhistory_zle_dirhistory_future -bindkey "\eO3C" dirhistory_zle_dirhistory_future +bindkey "\e[3C" dirhistory_zle_dirhistory_future # xterm in normal mode +bindkey "\e[1;3C" dirhistory_zle_dirhistory_future # xterm in normal mode +bindkey "\e\e[C" dirhistory_zle_dirhistory_future # Putty +bindkey "\eO3C" dirhistory_zle_dirhistory_future # GNU screen +case "$TERM_PROGRAM" in +iTerm.app) bindkey "^[^[[C" dirhistory_zle_dirhistory_future ;; # iTerm2 +Apple_Terminal) bindkey "^[f" dirhistory_zle_dirhistory_future ;; # Terminal.app +esac # @@ -181,22 +170,21 @@ function dirhistory_zle_dirhistory_down() { } zle -N dirhistory_zle_dirhistory_up -# xterm in normal mode -bindkey "\e[3A" dirhistory_zle_dirhistory_up -bindkey "\e[1;3A" dirhistory_zle_dirhistory_up -if [[ "$TERM_PROGRAM" == "Apple_Terminal" || "$TERM_PROGRAM" == "iTerm.app" ]]; then - bindkey "^[[A" dirhistory_zle_dirhistory_up -fi -# Putty: -bindkey "\e\e[A" dirhistory_zle_dirhistory_up -# GNU screen: -bindkey "\eO3A" dirhistory_zle_dirhistory_up +bindkey "\e[3A" dirhistory_zle_dirhistory_up # xterm in normal mode +bindkey "\e[1;3A" dirhistory_zle_dirhistory_up # xterm in normal mode +bindkey "\e\e[A" dirhistory_zle_dirhistory_up # Putty +bindkey "\eO3A" dirhistory_zle_dirhistory_up # GNU screen +case "$TERM_PROGRAM" in +iTerm.app) bindkey "^[^[[A" dirhistory_zle_dirhistory_up ;; # iTerm2 +Apple_Terminal) bindkey "^[OA" dirhistory_zle_dirhistory_up ;; # Terminal.app +esac zle -N dirhistory_zle_dirhistory_down -bindkey "\e[3B" dirhistory_zle_dirhistory_down -bindkey "\e[1;3B" dirhistory_zle_dirhistory_down -if [[ "$TERM_PROGRAM" == "Apple_Terminal" || "$TERM_PROGRAM" == "iTerm.app" ]]; then - bindkey "^[[B" dirhistory_zle_dirhistory_down -fi -bindkey "\e\e[B" dirhistory_zle_dirhistory_down -bindkey "\eO3B" dirhistory_zle_dirhistory_down +bindkey "\e[3B" dirhistory_zle_dirhistory_down # xterm in normal mode +bindkey "\e[1;3B" dirhistory_zle_dirhistory_down # xterm in normal mode +bindkey "\e\e[B" dirhistory_zle_dirhistory_down # Putty +bindkey "\eO3B" dirhistory_zle_dirhistory_down # GNU screen +case "$TERM_PROGRAM" in +iTerm.app) bindkey "^[^[[B" dirhistory_zle_dirhistory_down ;; # iTerm2 +Apple_Terminal) bindkey "^[OB" dirhistory_zle_dirhistory_down ;; # Terminal.app +esac From 79cf4b3ceb9bf981ce05adc1db3f01aa551efce8 Mon Sep 17 00:00:00 2001 From: Michael Peick Date: Sun, 10 Nov 2019 15:32:41 +0100 Subject: [PATCH 211/896] feat(dirhistory): support urxvt terminal key binding (#8370) Closes #8370 --- plugins/dirhistory/dirhistory.plugin.zsh | 30 +++++++++++++++++------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/plugins/dirhistory/dirhistory.plugin.zsh b/plugins/dirhistory/dirhistory.plugin.zsh index d949064d8..26ef07494 100644 --- a/plugins/dirhistory/dirhistory.plugin.zsh +++ b/plugins/dirhistory/dirhistory.plugin.zsh @@ -1,7 +1,7 @@ -## -# Navigate directory history using ALT-LEFT and ALT-RIGHT. ALT-LEFT moves back to directories +## +# Navigate directory history using ALT-LEFT and ALT-RIGHT. ALT-LEFT moves back to directories # that the user has changed to in the past, and ALT-RIGHT undoes ALT-LEFT. -# +# # Navigate directory hierarchy using ALT-UP and ALT-DOWN. # ALT-UP moves to higher hierarchy (cd ..) # ALT-DOWN moves into the first directory found in alphabetical order @@ -14,8 +14,8 @@ export dirhistory_future export DIRHISTORY_SIZE=30 -# Pop the last element of dirhistory_past. -# Pass the name of the variable to return the result in. +# Pop the last element of dirhistory_past. +# Pass the name of the variable to return the result in. # Returns the element if the array was not empty, # otherwise returns empty string. function pop_past() { @@ -32,7 +32,7 @@ function pop_future() { fi } -# Push a new element onto the end of dirhistory_past. If the size of the array +# Push a new element onto the end of dirhistory_past. If the size of the array # is >= DIRHISTORY_SIZE, the array is shifted function push_past() { if [[ $#dirhistory_past -ge $DIRHISTORY_SIZE ]]; then @@ -76,7 +76,7 @@ function dirhistory_back() { local d="" # Last element in dirhistory_past is the cwd. - pop_past cw + pop_past cw if [[ "" == "$cw" ]]; then # Someone overwrote our variable. Recover it. dirhistory_past=($PWD) @@ -129,6 +129,9 @@ case "$TERM_PROGRAM" in iTerm.app) bindkey "^[^[[D" dirhistory_zle_dirhistory_back ;; # iTerm2 Apple_Terminal) bindkey "^[b" dirhistory_zle_dirhistory_back ;; # Terminal.app esac +if (( ${+terminfo[kcub1]} )); then + bindkey "^[${terminfo[kcub1]}" dirhistory_zle_dirhistory_back # urxvt +fi zle -N dirhistory_zle_dirhistory_future bindkey "\e[3C" dirhistory_zle_dirhistory_future # xterm in normal mode @@ -139,11 +142,14 @@ case "$TERM_PROGRAM" in iTerm.app) bindkey "^[^[[C" dirhistory_zle_dirhistory_future ;; # iTerm2 Apple_Terminal) bindkey "^[f" dirhistory_zle_dirhistory_future ;; # Terminal.app esac +if (( ${+terminfo[kcuf1]} )); then + bindkey "^[${terminfo[kcuf1]}" dirhistory_zle_dirhistory_future # urxvt +fi -# +# # HIERARCHY Implemented in this section, in case someone wants to split it to another plugin if it clashes bindings -# +# # Move up in hierarchy function dirhistory_up() { @@ -178,6 +184,9 @@ case "$TERM_PROGRAM" in iTerm.app) bindkey "^[^[[A" dirhistory_zle_dirhistory_up ;; # iTerm2 Apple_Terminal) bindkey "^[OA" dirhistory_zle_dirhistory_up ;; # Terminal.app esac +if (( ${+terminfo[kcuu1]} )); then + bindkey "^[${terminfo[kcuu1]}" dirhistory_zle_dirhistory_up # urxvt +fi zle -N dirhistory_zle_dirhistory_down bindkey "\e[3B" dirhistory_zle_dirhistory_down # xterm in normal mode @@ -188,3 +197,6 @@ case "$TERM_PROGRAM" in iTerm.app) bindkey "^[^[[B" dirhistory_zle_dirhistory_down ;; # iTerm2 Apple_Terminal) bindkey "^[OB" dirhistory_zle_dirhistory_down ;; # Terminal.app esac +if (( ${+terminfo[kcud1]} )); then + bindkey "^[${terminfo[kcud1]}" dirhistory_zle_dirhistory_down # urxvt +fi From 5e8905b4b22dfec9042590f3aa399935b8b83eed Mon Sep 17 00:00:00 2001 From: Aaron Hutchinson Date: Tue, 2 Nov 2021 18:40:40 +0000 Subject: [PATCH 212/896] feat(ys): increase color contrast with light color schemes (#10295) --- themes/ys.zsh-theme | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/themes/ys.zsh-theme b/themes/ys.zsh-theme index 303c898b4..251b48827 100644 --- a/themes/ys.zsh-theme +++ b/themes/ys.zsh-theme @@ -5,8 +5,10 @@ # # Mar 2013 Yad Smood +typeset +H my_gray="$FG[247]" + # VCS -YS_VCS_PROMPT_PREFIX1=" %{$fg[white]%}on%{$reset_color%} " +YS_VCS_PROMPT_PREFIX1=" %{$my_gray%}on%{$reset_color%} " YS_VCS_PROMPT_PREFIX2=":%{$fg[cyan]%}" YS_VCS_PROMPT_SUFFIX="%{$reset_color%}" YS_VCS_PROMPT_DIRTY=" %{$fg[red]%}x" @@ -60,13 +62,13 @@ local exit_code="%(?,,C:%{$fg[red]%}%?%{$reset_color%})" PROMPT=" %{$terminfo[bold]$fg[blue]%}#%{$reset_color%} \ %(#,%{$bg[yellow]%}%{$fg[black]%}%n%{$reset_color%},%{$fg[cyan]%}%n) \ -%{$fg[white]%}@ \ +%{$my_gray%}@ \ %{$fg[green]%}%m \ -%{$fg[white]%}in \ +%{$my_gray%}in \ %{$terminfo[bold]$fg[yellow]%}%~%{$reset_color%}\ ${hg_info}\ ${git_info}\ ${venv_info}\ \ -%{$fg[white]%}[%*] $exit_code +%{$my_gray%}[%*] $exit_code %{$terminfo[bold]$fg[red]%}$ %{$reset_color%}" From 9a02515c7c8eee90909fe72d59d2e3169cb5ed28 Mon Sep 17 00:00:00 2001 From: amnore Date: Wed, 3 Nov 2021 20:17:23 +0800 Subject: [PATCH 213/896] fix(command-not-found): pass arguments correctly in NixOS (#10381) --- plugins/command-not-found/command-not-found.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/command-not-found/command-not-found.plugin.zsh b/plugins/command-not-found/command-not-found.plugin.zsh index 3ec13429c..cb96fe063 100644 --- a/plugins/command-not-found/command-not-found.plugin.zsh +++ b/plugins/command-not-found/command-not-found.plugin.zsh @@ -50,7 +50,7 @@ fi # NixOS: https://github.com/NixOS/nixpkgs/tree/master/nixos/modules/programs/command-not-found if [[ -x /run/current-system/sw/bin/command-not-found ]]; then command_not_found_handler() { - /run/current-system/sw/bin/command-not-found -- "$@" + /run/current-system/sw/bin/command-not-found "$@" } fi From 0520c2e30934a6e01b27988dca5bbbe3511d6868 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 3 Nov 2021 18:21:04 +0100 Subject: [PATCH 214/896] docs: add Security Policy --- SECURITY.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 SECURITY.md diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 000000000..cda53379f --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,22 @@ +# Security Policy + +## Supported Versions + +At the moment Oh My Zsh only considers the very latest commit to be supported. +We combine that with our fast response to incidents, so risk is minimized. + +| Version | Supported | +|:-------------- |:------------------ | +| master | :white_check_mark: | +| other commits | :x: | + +In the near future we will introduce versioning, so expect this section to change. + +## Reporting a Vulnerability + +If you find a vulnerability, email all the maintainers directly at: + +- Robby: robby [at] planetargon.com +- Marc: hello [at] mcornella.com + +**Do not open an issue or Pull Request directly**, because it might reveal the vulnerability. From 7a2cb106258aa7a18bcd53e45df96c4871a03d5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Fri, 5 Nov 2021 19:47:29 +0100 Subject: [PATCH 215/896] fix(updater): stop update if connection unavailable --- tools/check_for_upgrade.sh | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh index 157b0cce2..8264762b6 100644 --- a/tools/check_for_upgrade.sh +++ b/tools/check_for_upgrade.sh @@ -54,14 +54,27 @@ function is_update_available() { [[ "$repo" = ohmyzsh/ohmyzsh ]] || return 0 local api_url="https://api.github.com/repos/${repo}/commits/${branch}" - # Get local and remote HEADs and compare them. If we can't get either assume there are updates - local local_head remote_head + # Get local HEAD. If this fails assume there are updates + local local_head local_head=$(git -C "$ZSH" rev-parse $branch 2>/dev/null) || return 0 - remote_head=$(curl -fsSL -H 'Accept: application/vnd.github.v3.sha' $api_url 2>/dev/null) \ - || remote_head=$(wget -O- --header='Accept: application/vnd.github.v3.sha' $api_url 2>/dev/null) \ - || remote_head=$(HTTP_ACCEPT='Accept: application/vnd.github.v3.sha' fetch -o - $api_url 2>/dev/null) \ - || return 0 + # Get remote HEAD. If we can't get it assume there are updates unless there is no connection: + # - curl: 6 (could not resolve) or 7 (could not connect) + # - wget: 4 (network unreachable) + # - fetch: 1 (no route to host) + local remote_head ret + remote_head=$( + curl -fsSL -H 'Accept: application/vnd.github.v3.sha' $api_url 2>/dev/null || { + [[ $? -eq 6 || $? -eq 7 ]] && exit 1 + } || wget -O- --header='Accept: application/vnd.github.v3.sha' $api_url 2>/dev/null || { + [[ $? -eq 4 ]] && exit 1 + } || HTTP_ACCEPT='Accept: application/vnd.github.v3.sha' fetch -o - $api_url 2>/dev/null || { + [[ $? -eq 1 ]] && exit 1 + } || exit 0 + ) + + # If can't fetch remote HEAD, return exit code + ret=$?; [[ -n "$remote_head" ]] || return $ret # Compare local and remote HEADs [[ "$local_head" != "$remote_head" ]] From b2f35a7b98455b2bb8c7c3b11db6aa587e1d28bf Mon Sep 17 00:00:00 2001 From: Jonathan Batchelor Date: Fri, 5 Nov 2021 23:40:38 +0000 Subject: [PATCH 216/896] refactor(osx): Rename osx plugin to macos (#10341) Apple changed the name of their operating system from OS X to macOS a number of years ago. This was overdue! As per issue #10311 * refactor(osx): rename `osx` plugin to `macos` * refactor(macos): Add symbolic link from old `osx` plugin name. --- README.md | 2 +- plugins/{osx => macos}/README.md | 8 ++++---- plugins/{osx => macos}/_security | 0 .../{osx/osx.plugin.zsh => macos/macos.plugin.zsh} | 14 ++++++++++---- plugins/{osx => macos}/music | 0 plugins/macos/osx.plugin.zsh | 1 + plugins/{osx => macos}/spotify | 0 plugins/osx | 1 + 8 files changed, 17 insertions(+), 9 deletions(-) rename plugins/{osx => macos}/README.md (94%) rename plugins/{osx => macos}/_security (100%) rename plugins/{osx/osx.plugin.zsh => macos/macos.plugin.zsh} (93%) rename plugins/{osx => macos}/music (100%) create mode 120000 plugins/macos/osx.plugin.zsh rename plugins/{osx => macos}/spotify (100%) create mode 120000 plugins/osx diff --git a/README.md b/README.md index 907248beb..5712c1701 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,7 @@ plugins=( git bundler dotenv - osx + macos rake rbenv ruby diff --git a/plugins/osx/README.md b/plugins/macos/README.md similarity index 94% rename from plugins/osx/README.md rename to plugins/macos/README.md index 50458f60e..1bc4244a4 100644 --- a/plugins/osx/README.md +++ b/plugins/macos/README.md @@ -1,11 +1,11 @@ -# OSX plugin +# MacOS plugin This plugin provides a few utilities to make it more enjoyable on macOS (previously named OSX). -To start using it, add the `osx` plugin to your plugins array in `~/.zshrc`: +To start using it, add the `macos` plugin to your plugins array in `~/.zshrc`: ```zsh -plugins=(... osx) +plugins=(... macos) ``` Original author: [Sorin Ionescu](https://github.com/sorin-ionescu) @@ -31,7 +31,7 @@ Original author: [Sorin Ionescu](https://github.com/sorin-ionescu) | `itunes` | _DEPRECATED_. Use `music` from macOS Catalina on | | `music` | Control Apple Music. Use `music -h` for usage details | | `spotify` | Control Spotify and search by artist, album, track… | -| `rmdsstore` | Remove .DS\_Store files recursively in a directory | +| `rmdsstore` | Remove .DS_Store files recursively in a directory | | `btrestart` | Restart the Bluetooth daemon | | `freespace` | Erases purgeable disk space with 0s on the selected disk | diff --git a/plugins/osx/_security b/plugins/macos/_security similarity index 100% rename from plugins/osx/_security rename to plugins/macos/_security diff --git a/plugins/osx/osx.plugin.zsh b/plugins/macos/macos.plugin.zsh similarity index 93% rename from plugins/osx/osx.plugin.zsh rename to plugins/macos/macos.plugin.zsh index 16f16ddb6..4bcbbaead 100644 --- a/plugins/osx/osx.plugin.zsh +++ b/plugins/macos/macos.plugin.zsh @@ -1,3 +1,9 @@ +# Check if 'osx' is still in the plugins list and prompt to change to 'macos' +if [[ -n "${plugins[(r)osx]}" ]]; then + print ${(%):-"%F{yellow}The \`osx\` plugin is deprecated and has been renamed to \`macos\`."} + print ${(%):-"Please update your .zshrc to use the \`%Bmacos%b\` plugin instead.%f"} +fi + # Open the current directory in a Finder window alias ofd='open_command $PWD' @@ -11,7 +17,7 @@ function btrestart() { sudo kextload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport } -function _omz_osx_get_frontmost_app() { +function _omz_macos_get_frontmost_app() { osascript 2>/dev/null < 0 )) && command="${command}; $*" - local the_app=$(_omz_osx_get_frontmost_app) + local the_app=$(_omz_macos_get_frontmost_app) if [[ "$the_app" == 'Terminal' ]]; then # Discarding stdout to quash "tab N of window id XXX" output @@ -77,7 +83,7 @@ function vsplit_tab() { local command="cd \\\"$PWD\\\"; clear" (( $# > 0 )) && command="${command}; $*" - local the_app=$(_omz_osx_get_frontmost_app) + local the_app=$(_omz_macos_get_frontmost_app) if [[ "$the_app" == 'iTerm' ]]; then osascript < 0 )) && command="${command}; $*" - local the_app=$(_omz_osx_get_frontmost_app) + local the_app=$(_omz_macos_get_frontmost_app) if [[ "$the_app" == 'iTerm' ]]; then osascript 2>/dev/null < Date: Mon, 8 Nov 2021 14:01:34 +0100 Subject: [PATCH 217/896] refactor(percol): fix style, bind keys for vi-mode and remove dependencies --- plugins/percol/README.md | 23 ++++++++++-------- plugins/percol/percol.plugin.zsh | 41 +++++++++++++++++--------------- 2 files changed, 35 insertions(+), 29 deletions(-) diff --git a/plugins/percol/README.md b/plugins/percol/README.md index ec5de4f86..78c881f55 100644 --- a/plugins/percol/README.md +++ b/plugins/percol/README.md @@ -1,20 +1,23 @@ -## percol +# percol -Provides some useful function to make [percol](https://github.com/mooz/percol) work with zsh history and [jump plugin](https://github.com/ohmyzsh/ohmyzsh/blob/master/plugins/jump/jump.plugin.zsh) +Provides some useful function to make [percol](https://github.com/mooz/percol) work with zsh history and +the [jump plugin](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/jump), optionally. -### Requirements +To use it, add `percol` to the plugins array in your zshrc: -```shell -pip install percol +```zsh +plugins=(... percol) ``` -And [jump](https://github.com/ohmyzsh/ohmyzsh/blob/master/plugins/jump/jump.plugin.zsh) for `oh-my-zsh` is a optional requirement. +## Requirements -### Usage +- `percol`: install with `pip install percol`. -For default +- (_Optional_) [`jump`](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/jump) plugin: needs to be + enabled before the `percol` plugin. -- `^-r` bind to `percol_select_history`.You can use it to grep your history with percol. +## Usage -- `^-b` bind to `percol_select_marks`.You can use it to grep your bookmarks with percol. +- CTRL-R (bound to `percol_select_history`): you can use it to grep your history with percol. +- CTRL-B (bound to `percol_select_marks`): you can use it to grep your jump bookmarks with percol. diff --git a/plugins/percol/percol.plugin.zsh b/plugins/percol/percol.plugin.zsh index c6adf4e1e..b78383eee 100644 --- a/plugins/percol/percol.plugin.zsh +++ b/plugins/percol/percol.plugin.zsh @@ -1,22 +1,25 @@ -if which percol &> /dev/null; then - function percol_select_history() { - local tac - which gtac &> /dev/null && tac="gtac" || { which tac &> /dev/null && tac="tac" || { tac="tail -r" } } - BUFFER=$(fc -l -n 1 | eval $tac | percol --query "$LBUFFER") - CURSOR=$#BUFFER - zle -R -c - } +(( ${+commands[percol]} )) || return - zle -N percol_select_history - bindkey '^R' percol_select_history +function percol_select_history() { + # print history in reverse order (from -1 (latest) to 1 (oldest)) + BUFFER=$(fc -l -n -1 1 | percol --query "$LBUFFER") + CURSOR=$#BUFFER + zle -R -c +} +zle -N percol_select_history +bindkey -M emacs '^R' percol_select_history +bindkey -M viins '^R' percol_select_history +bindkey -M vicmd '^R' percol_select_history - if which marks &> /dev/null; then - function percol_select_marks() { - BUFFER=$(marks | percol --query "$LBUFFER" | awk '{print $3}') - CURSOR=$#BUFFER # move cursor - zle -R -c # refresh - } - zle -N percol_select_marks - bindkey '^B' percol_select_marks - fi +if (( ${+functions[marks]} )); then + function percol_select_marks() { + # parse directory from marks output (markname -> path) and quote if necessary + BUFFER=${(q)"$(marks | percol --query "$LBUFFER")"##*-> } + CURSOR=$#BUFFER + zle -R -c + } + zle -N percol_select_marks + bindkey -M emacs '^B' percol_select_marks + bindkey -M viins '^B' percol_select_marks + bindkey -M vicmd '^B' percol_select_marks fi From 55682e36920e2ab7633fc6eee11466d3faed0bf8 Mon Sep 17 00:00:00 2001 From: Shahin Sorkh Date: Mon, 8 Nov 2021 18:02:09 +0330 Subject: [PATCH 218/896] feat(tmux): set session name with `ZSH_TMUX_DEFAULT_SESSION_NAME` (#9063) --- plugins/tmux/README.md | 1 + plugins/tmux/tmux.plugin.zsh | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/tmux/README.md b/plugins/tmux/README.md index 2ceaf1ad5..551814a39 100644 --- a/plugins/tmux/README.md +++ b/plugins/tmux/README.md @@ -39,3 +39,4 @@ The plugin also supports the following: | `ZSH_TMUX_FIXTERM_WITH_256COLOR` | `$TERM` to use for 256-color terminals (default: `screen-256color` | | `ZSH_TMUX_CONFIG` | Set the configuration path (default: `$HOME/.tmux.conf`) | | `ZSH_TMUX_UNICODE` | Set `tmux -u` option to support unicode | +| `ZSH_TMUX_DEFAULT_SESSION_NAME` | Set tmux default session name when autostart is enabled | diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh index e52443a71..0ea3aa02a 100644 --- a/plugins/tmux/tmux.plugin.zsh +++ b/plugins/tmux/tmux.plugin.zsh @@ -76,7 +76,11 @@ function _zsh_tmux_plugin_run() { elif [[ -e "$ZSH_TMUX_CONFIG" ]]; then tmux_cmd+=(-f "$ZSH_TMUX_CONFIG") fi - $tmux_cmd new-session + if [[ -n "$ZSH_TMUX_DEFAULT_SESSION_NAME" ]]; then + $tmux_cmd new-session -s $ZSH_TMUX_DEFAULT_SESSION_NAME + else + $tmux_cmd new-session + fi fi if [[ "$ZSH_TMUX_AUTOQUIT" == "true" ]]; then From e86c6f5e7fc9f024a427e2870ab70644b5454725 Mon Sep 17 00:00:00 2001 From: Kevin Burke Date: Tue, 9 Nov 2021 00:04:10 -0800 Subject: [PATCH 219/896] style: use `-n` flag in `head` and `tail` commands (#10391) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Marc CornellĂ  --- lib/diagnostics.zsh | 2 +- lib/directories.zsh | 2 +- lib/functions.zsh | 4 ++-- lib/git.zsh | 2 +- plugins/scd/scd | 2 +- plugins/systemadmin/README.md | 4 ++-- plugins/systemadmin/systemadmin.plugin.zsh | 12 ++++++------ tools/install.sh | 2 +- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/lib/diagnostics.zsh b/lib/diagnostics.zsh index 650520797..eaeba7d23 100644 --- a/lib/diagnostics.zsh +++ b/lib/diagnostics.zsh @@ -335,7 +335,7 @@ function _omz_diag_dump_os_specific_version() { builtin echo "OS Version: $osname $osver build $(sw_vers -buildVersion)" ;; cygwin) - command systeminfo | command head -4 | command tail -2 + command systeminfo | command head -n 4 | command tail -n 2 ;; esac diff --git a/lib/directories.zsh b/lib/directories.zsh index 6696854b0..c62f56468 100644 --- a/lib/directories.zsh +++ b/lib/directories.zsh @@ -26,7 +26,7 @@ function d () { if [[ -n $1 ]]; then dirs "$@" else - dirs -v | head -10 + dirs -v | head -n 10 fi } compdef _dirs d diff --git a/lib/functions.zsh b/lib/functions.zsh index 73b491a59..fc53611b8 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -1,7 +1,7 @@ function zsh_stats() { fc -l 1 \ | awk '{ CMD[$2]++; count++; } END { for (a in CMD) print CMD[a] " " CMD[a]*100/count "% " a }' \ - | grep -v "./" | sort -nr | head -20 | column -c3 -s " " -t | nl + | grep -v "./" | sort -nr | head -n 20 | column -c3 -s " " -t | nl } function uninstall_oh_my_zsh() { @@ -45,7 +45,7 @@ function takeurl() { data="$(mktemp)" curl -L "$1" > "$data" tar xf "$data" - thedir="$(tar tf "$data" | head -1)" + thedir="$(tar tf "$data" | head -n 1)" rm "$data" cd "$thedir" } diff --git a/lib/git.zsh b/lib/git.zsh index 9a615e77b..8623473b0 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -51,7 +51,7 @@ function parse_git_dirty() { FLAGS+="--ignore-submodules=${GIT_STATUS_IGNORE_SUBMODULES:-dirty}" ;; esac - STATUS=$(__git_prompt_git status ${FLAGS} 2> /dev/null | tail -1) + STATUS=$(__git_prompt_git status ${FLAGS} 2> /dev/null | tail -n 1) fi if [[ -n $STATUS ]]; then echo "$ZSH_THEME_GIT_PROMPT_DIRTY" diff --git a/plugins/scd/scd b/plugins/scd/scd index a7db6c265..7e9654b44 100755 --- a/plugins/scd/scd +++ b/plugins/scd/scd @@ -270,7 +270,7 @@ fi # Determine the last recorded directory if [[ -s ${SCD_HISTFILE} ]]; then - last_directory=${"$(tail -1 ${SCD_HISTFILE})"#*;} + last_directory=${"$(tail -n 1 ${SCD_HISTFILE})"#*;} fi # The "record" function adds its arguments to the directory index. diff --git a/plugins/systemadmin/README.md b/plugins/systemadmin/README.md index 052fc6edc..146b58605 100644 --- a/plugins/systemadmin/README.md +++ b/plugins/systemadmin/README.md @@ -17,9 +17,9 @@ plugins=(... systemadmin) | path | `print -l $path` | Displays PATH with each entry on a separate line | | mkdir | `mkdir -pv` | Automatically create parent directories and display verbose output | | psmem | `ps -e -orss=,args= \| sort -b -k1 -nr` | Display the processes using the most memory | -| psmem10 | `ps -e -orss=,args= \| sort -b -k1 -nr \| head -10` | Display the top 10 processes using the most memory | +| psmem10 | `ps -e -orss=,args= \| sort -b -k1 -nr \| head -n 10` | Display the top 10 processes using the most memory | | pscpu | `ps -e -o pcpu,cpu,nice,state,cputime,args \|sort -k1 -nr` | Display the top processes using the most CPU | -| pscpu10 | `ps -e -o pcpu,cpu,nice,state,cputime,args \|sort -k1 -nr \| head -10` | Display the top 10 processes using the most CPU | +| pscpu10 | `ps -e -o pcpu,cpu,nice,state,cputime,args \|sort -k1 -nr \| head -n 10` | Display the top 10 processes using the most CPU | | hist10 | `print -l ${(o)history%% *} \| uniq -c \| sort -nr \| head -n 10` | Display the top 10 most used commands in the history | ## Functions diff --git a/plugins/systemadmin/systemadmin.plugin.zsh b/plugins/systemadmin/systemadmin.plugin.zsh index a77f0069b..2f9d1ef35 100644 --- a/plugins/systemadmin/systemadmin.plugin.zsh +++ b/plugins/systemadmin/systemadmin.plugin.zsh @@ -26,10 +26,10 @@ alias path='print -l $path' alias mkdir='mkdir -pv' # get top process eating memory alias psmem='ps -e -orss=,args= | sort -b -k1 -nr' -alias psmem10='ps -e -orss=,args= | sort -b -k1 -nr | head -10' +alias psmem10='ps -e -orss=,args= | sort -b -k1 -nr | head -n 10' # get top process eating cpu if not work try excute : export LC_ALL='C' alias pscpu='ps -e -o pcpu,cpu,nice,state,cputime,args|sort -k1,1n -nr' -alias pscpu10='ps -e -o pcpu,cpu,nice,state,cputime,args|sort -k1,1n -nr | head -10' +alias pscpu10='ps -e -o pcpu,cpu,nice,state,cputime,args|sort -k1,1n -nr | head -n 10' # top10 of the history alias hist10='print -l ${(o)history%% *} | uniq -c | sort -nr | head -n 10' @@ -74,7 +74,7 @@ req20() { # top20 of Using tcpdump port 80 access to view http20() { - sudo tcpdump -i eth0 -tnn dst port 80 -c 1000 | awk -F"." '{print $1"."$2"."$3"."$4}' | sort | uniq -c | sort -nr |head -20 + sudo tcpdump -i eth0 -tnn dst port 80 -c 1000 | awk -F"." '{print $1"."$2"."$3"."$4}' | sort | uniq -c | sort -nr |head -n 20 } # top20 of Find time_wait connection @@ -99,14 +99,14 @@ accessip10() { # top20 of Most Visited file or page visitpage20() { - awk '{print $11}' "$(retlog)"|sort|uniq -c|sort -nr|head -20 + awk '{print $11}' "$(retlog)"|sort|uniq -c|sort -nr|head -n 20 } # top100 of Page lists the most time-consuming (more than 60 seconds) as well as the corresponding page number of occurrences consume100() { - awk '($NF > 60 && $7~/\.php/){print $7}' "$(retlog)" |sort -n|uniq -c|sort -nr|head -100 + awk '($NF > 60 && $7~/\.php/){print $7}' "$(retlog)" |sort -n|uniq -c|sort -nr|head -n 100 # if django website or other webiste make by no suffix language - # awk '{print $7}' "$(retlog)" |sort -n|uniq -c|sort -nr|head -100 + # awk '{print $7}' "$(retlog)" |sort -n|uniq -c|sort -nr|head -n 100 } # Website traffic statistics (G) diff --git a/tools/install.sh b/tools/install.sh index 7704107c8..ca996f8a7 100755 --- a/tools/install.sh +++ b/tools/install.sh @@ -311,7 +311,7 @@ EOF # 1. Use the most preceding one based on $PATH, then check that it's in the shells file # 2. If that fails, get a zsh path from the shells file, then check it actually exists if ! zsh=$(command -v zsh) || ! grep -qx "$zsh" "$shells_file"; then - if ! zsh=$(grep '^/.*/zsh$' "$shells_file" | tail -1) || [ ! -f "$zsh" ]; then + if ! zsh=$(grep '^/.*/zsh$' "$shells_file" | tail -n 1) || [ ! -f "$zsh" ]; then fmt_error "no zsh binary found or not present in '$shells_file'" fmt_error "change your default shell manually." return From 4a74349635cf30d305766b459c7cc3246831676e Mon Sep 17 00:00:00 2001 From: Janusz Mordarski Date: Tue, 9 Nov 2021 09:50:25 +0100 Subject: [PATCH 220/896] feat(refined): allow selecting git branch by changing prefix to `:` (#10400) --- themes/refined.zsh-theme | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/themes/refined.zsh-theme b/themes/refined.zsh-theme index 2a4188c9d..5d39bd757 100644 --- a/themes/refined.zsh-theme +++ b/themes/refined.zsh-theme @@ -33,8 +33,8 @@ autoload -Uz vcs_info zstyle ':vcs_info:*' enable hg bzr git zstyle ':vcs_info:*:*' unstagedstr '!' zstyle ':vcs_info:*:*' stagedstr '+' -zstyle ':vcs_info:*:*' formats "$FX[bold]%r$FX[no-bold]/%S" "%s/%b" "%%u%c" -zstyle ':vcs_info:*:*' actionformats "$FX[bold]%r$FX[no-bold]/%S" "%s/%b" "%u%c (%a)" +zstyle ':vcs_info:*:*' formats "$FX[bold]%r$FX[no-bold]/%S" "%s:%b" "%%u%c" +zstyle ':vcs_info:*:*' actionformats "$FX[bold]%r$FX[no-bold]/%S" "%s:%b" "%u%c (%a)" zstyle ':vcs_info:*:*' nvcsformats "%~" "" "" # Fastest possible way to check if repo is dirty From 3dc66bd3676a564e3864fb5ccf5641c65fd42c6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 9 Nov 2021 10:25:23 +0100 Subject: [PATCH 221/896] fix(emotty): fix glyphs output width in emotty theme --- themes/emotty.zsh-theme | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/themes/emotty.zsh-theme b/themes/emotty.zsh-theme index 13adad78d..044b317e8 100644 --- a/themes/emotty.zsh-theme +++ b/themes/emotty.zsh-theme @@ -51,9 +51,9 @@ root_prompt="$emoji[skull]" warn_prompt="$emoji[collision_symbol]" vcs_unstaged_glyph="%{$emoji[circled_latin_capital_letter_m]$emoji2[emoji_style] %2G%}" -vcs_staged_glyph="%{$emoji[high_voltage_sign] %2G%}" -vcs_branch_glyph=$(print -P $'\Ue0a0') # î‚  -vcs_action_glyph=$(print -P $'\U276f') # ❯ +vcs_staged_glyph="%{$emoji[high_voltage_sign]%2G%}" +vcs_branch_glyph=$'\Ue0a0' # î‚  +vcs_action_glyph=$'\U276f' # ❯ red="$FG[001]" yellow="$FG[003]" From 9a11b34101a218532f5133b78e55e48e3dbeb2e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 9 Nov 2021 12:03:59 +0100 Subject: [PATCH 222/896] fix(cli): fix check for completion files in `omz plugin load` --- lib/cli.zsh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/cli.zsh b/lib/cli.zsh index 0b6bbc6cb..2975acb91 100644 --- a/lib/cli.zsh +++ b/lib/cli.zsh @@ -446,9 +446,9 @@ function _omz::plugin::load { fi # Check if it has completion to reload compinit - if [[ -f "$base/_$plugin" ]]; then - has_completion=1 - fi + local -a comp_files + comp_files=($base/_*(N)) + has_completion=$(( $#comp_files > 0 )) # Load the plugin if [[ -f "$base/$plugin.plugin.zsh" ]]; then From 5c2440cb0c2ee70afb33bda3954a93abe37c34f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 9 Nov 2021 12:07:23 +0100 Subject: [PATCH 223/896] style(frontend-search): rename completion file to `_frontend` --- plugins/frontend-search/{_frontend-search.sh => _frontend} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename plugins/frontend-search/{_frontend-search.sh => _frontend} (100%) diff --git a/plugins/frontend-search/_frontend-search.sh b/plugins/frontend-search/_frontend similarity index 100% rename from plugins/frontend-search/_frontend-search.sh rename to plugins/frontend-search/_frontend From db19589fcf03690a443f1a206361963b47809b93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 9 Nov 2021 19:27:43 +0100 Subject: [PATCH 224/896] refactor(updater): simplify check for available updates --- tools/check_for_upgrade.sh | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh index 8264762b6..70cd21f84 100644 --- a/tools/check_for_upgrade.sh +++ b/tools/check_for_upgrade.sh @@ -58,23 +58,20 @@ function is_update_available() { local local_head local_head=$(git -C "$ZSH" rev-parse $branch 2>/dev/null) || return 0 - # Get remote HEAD. If we can't get it assume there are updates unless there is no connection: - # - curl: 6 (could not resolve) or 7 (could not connect) - # - wget: 4 (network unreachable) - # - fetch: 1 (no route to host) - local remote_head ret + # Get remote HEAD. If no suitable command is found assume there are updates + # On any other error, skip the update (connection may be down) + local remote_head remote_head=$( - curl -fsSL -H 'Accept: application/vnd.github.v3.sha' $api_url 2>/dev/null || { - [[ $? -eq 6 || $? -eq 7 ]] && exit 1 - } || wget -O- --header='Accept: application/vnd.github.v3.sha' $api_url 2>/dev/null || { - [[ $? -eq 4 ]] && exit 1 - } || HTTP_ACCEPT='Accept: application/vnd.github.v3.sha' fetch -o - $api_url 2>/dev/null || { - [[ $? -eq 1 ]] && exit 1 - } || exit 0 - ) - - # If can't fetch remote HEAD, return exit code - ret=$?; [[ -n "$remote_head" ]] || return $ret + if (( ${+commands[curl]} )); then + curl -fsSL -H 'Accept: application/vnd.github.v3.sha' $api_url 2>/dev/null + elif (( ${+commands[wget]} )); then + wget -O- --header='Accept: application/vnd.github.v3.sha' $api_url 2>/dev/null + elif (( ${+commands[fetch]} )); then + HTTP_ACCEPT='Accept: application/vnd.github.v3.sha' fetch -o - $api_url 2>/dev/null + else + exit 0 + fi + ) || return 1 # Compare local and remote HEADs [[ "$local_head" != "$remote_head" ]] From e3f7b8aa570a09186a7e3d1877b36d7e43d39197 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 10 Nov 2021 11:21:59 +0100 Subject: [PATCH 225/896] fix(updater): avoid `git -C` for compatibility with git < v1.8.5 (#10404) Fixes #10404 --- tools/check_for_upgrade.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh index 70cd21f84..a6fdf4659 100644 --- a/tools/check_for_upgrade.sh +++ b/tools/check_for_upgrade.sh @@ -34,11 +34,11 @@ function current_epoch() { function is_update_available() { local branch - branch=${"$(git -C "$ZSH" config --local oh-my-zsh.branch)":-master} + branch=${"$(cd "$ZSH"; git config --local oh-my-zsh.branch)":-master} local remote remote_url remote_repo - remote=${"$(git -C "$ZSH" config --local oh-my-zsh.remote)":-origin} - remote_url=$(git -C "$ZSH" config remote.$remote.url) + remote=${"$(cd "$ZSH"; git config --local oh-my-zsh.remote)":-origin} + remote_url=$(cd "$ZSH"; git config remote.$remote.url) local repo case "$remote_url" in @@ -56,7 +56,7 @@ function is_update_available() { # Get local HEAD. If this fails assume there are updates local local_head - local_head=$(git -C "$ZSH" rev-parse $branch 2>/dev/null) || return 0 + local_head=$(cd "$ZSH"; git rev-parse $branch 2>/dev/null) || return 0 # Get remote HEAD. If no suitable command is found assume there are updates # On any other error, skip the update (connection may be down) From 1d166eaaa138d7413365205c61412ccb68286b3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 10 Nov 2021 11:35:17 +0100 Subject: [PATCH 226/896] fix(cli): avoid `git -C` for compatibility with git < v1.8.5 (#10404) --- lib/cli.zsh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/cli.zsh b/lib/cli.zsh index 2975acb91..d90cc6469 100644 --- a/lib/cli.zsh +++ b/lib/cli.zsh @@ -36,7 +36,7 @@ function _omz { elif (( CURRENT == 3 )); then case "$words[2]" in changelog) local -a refs - refs=("${(@f)$(command git -C "$ZSH" for-each-ref --format="%(refname:short):%(subject)" refs/heads refs/tags)}") + refs=("${(@f)$(cd "$ZSH"; command git for-each-ref --format="%(refname:short):%(subject)" refs/heads refs/tags)}") _describe 'command' refs ;; plugin) subcmds=( 'disable:Disable plugin(s)' @@ -171,9 +171,12 @@ EOF function _omz::changelog { local version=${1:-HEAD} format=${3:-"--text"} - if ! command git -C "$ZSH" show-ref --verify refs/heads/$version &>/dev/null && \ - ! command git -C "$ZSH" show-ref --verify refs/tags/$version &>/dev/null && \ - ! command git -C "$ZSH" rev-parse --verify "${version}^{commit}" &>/dev/null; then + if ( + cd "$ZSH" + ! command git show-ref --verify refs/heads/$version && \ + ! command git show-ref --verify refs/tags/$version && \ + ! command git rev-parse --verify "${version}^{commit}" + ) &>/dev/null; then cat >&2 < Date: Wed, 10 Nov 2021 17:03:38 +0300 Subject: [PATCH 227/896] fix(command-not-found): pass arguments correctly in Termux (#10403) --- plugins/command-not-found/command-not-found.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/command-not-found/command-not-found.plugin.zsh b/plugins/command-not-found/command-not-found.plugin.zsh index cb96fe063..e46350604 100644 --- a/plugins/command-not-found/command-not-found.plugin.zsh +++ b/plugins/command-not-found/command-not-found.plugin.zsh @@ -57,6 +57,6 @@ fi # Termux: https://github.com/termux/command-not-found if [[ -x /data/data/com.termux/files/usr/libexec/termux/command-not-found ]]; then command_not_found_handler() { - /data/data/com.termux/files/usr/libexec/termux/command-not-found -- "$1" + /data/data/com.termux/files/usr/libexec/termux/command-not-found "$1" } fi From 1448d234d6d9c25f64a48b16379b34db28a36898 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Thu, 11 Nov 2021 17:20:07 +0100 Subject: [PATCH 228/896] fix(dirhistory): fix Up/Down key bindings for Terminal.app Reference: https://github.com/ohmyzsh/ohmyzsh/commit/7f49494#commitcomment-60117011 --- plugins/dirhistory/dirhistory.plugin.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/dirhistory/dirhistory.plugin.zsh b/plugins/dirhistory/dirhistory.plugin.zsh index 26ef07494..971eb6540 100644 --- a/plugins/dirhistory/dirhistory.plugin.zsh +++ b/plugins/dirhistory/dirhistory.plugin.zsh @@ -182,7 +182,7 @@ bindkey "\e\e[A" dirhistory_zle_dirhistory_up # Putty bindkey "\eO3A" dirhistory_zle_dirhistory_up # GNU screen case "$TERM_PROGRAM" in iTerm.app) bindkey "^[^[[A" dirhistory_zle_dirhistory_up ;; # iTerm2 -Apple_Terminal) bindkey "^[OA" dirhistory_zle_dirhistory_up ;; # Terminal.app +Apple_Terminal) bindkey "^[[A" dirhistory_zle_dirhistory_up ;; # Terminal.app esac if (( ${+terminfo[kcuu1]} )); then bindkey "^[${terminfo[kcuu1]}" dirhistory_zle_dirhistory_up # urxvt @@ -195,7 +195,7 @@ bindkey "\e\e[B" dirhistory_zle_dirhistory_down # Putty bindkey "\eO3B" dirhistory_zle_dirhistory_down # GNU screen case "$TERM_PROGRAM" in iTerm.app) bindkey "^[^[[B" dirhistory_zle_dirhistory_down ;; # iTerm2 -Apple_Terminal) bindkey "^[OB" dirhistory_zle_dirhistory_down ;; # Terminal.app +Apple_Terminal) bindkey "^[[B" dirhistory_zle_dirhistory_down ;; # Terminal.app esac if (( ${+terminfo[kcud1]} )); then bindkey "^[${terminfo[kcud1]}" dirhistory_zle_dirhistory_down # urxvt From 6cb41b70a6d04301fd50cd5862ecd705ba226c0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Mon, 8 Nov 2021 17:46:14 +0100 Subject: [PATCH 229/896] fix(lib): fix `omz_urldecode` unsafe eval bug The `omz_urldecode` function uses an eval to decode the input which can be exploited to inject commands. This is used only in the svn plugin and it requires a complex process to exploit, so it is highly unlikely to have been used by an attacker. --- lib/functions.zsh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/functions.zsh b/lib/functions.zsh index fc53611b8..61f4dd49e 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -237,12 +237,11 @@ function omz_urldecode { tmp=${tmp:gs/\\/\\\\/} # Handle %-escapes by turning them into `\xXX` printf escapes tmp=${tmp:gs/%/\\x/} - local decoded - eval "decoded=\$'$tmp'" + local decoded="$(printf -- "$tmp")" # Now we have a UTF-8 encoded string in the variable. We need to re-encode # it if caller is in a non-UTF-8 locale. - local safe_encodings + local -a safe_encodings safe_encodings=(UTF-8 utf8 US-ASCII) if [[ -z ${safe_encodings[(r)$caller_encoding]} ]]; then decoded=$(echo -E "$decoded" | iconv -f UTF-8 -t $caller_encoding) From 06fc5fb12900d7ee5821a5f20b47be2c4b894ac0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 9 Nov 2021 15:05:53 +0100 Subject: [PATCH 230/896] fix(dirhistory): fix unsafe eval bug in back and forward widgets The plugin unsafely processes directory paths in pop_past and pop_future. This commit fixes that. --- plugins/dirhistory/dirhistory.plugin.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/dirhistory/dirhistory.plugin.zsh b/plugins/dirhistory/dirhistory.plugin.zsh index 971eb6540..e3f45ee99 100644 --- a/plugins/dirhistory/dirhistory.plugin.zsh +++ b/plugins/dirhistory/dirhistory.plugin.zsh @@ -19,14 +19,14 @@ export DIRHISTORY_SIZE=30 # Returns the element if the array was not empty, # otherwise returns empty string. function pop_past() { - eval "$1='$dirhistory_past[$#dirhistory_past]'" + eval "$1=${(q)dirhistory_past[$#dirhistory_past]}" if [[ $#dirhistory_past -gt 0 ]]; then dirhistory_past[$#dirhistory_past]=() fi } function pop_future() { - eval "$1='$dirhistory_future[$#dirhistory_future]'" + eval "$1=${(q)dirhistory_future[$#dirhistory_future]}" if [[ $#dirhistory_future -gt 0 ]]; then dirhistory_future[$#dirhistory_future]=() fi From a263cdac9c15de4003d3289a53cad1d19c8cfb3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 9 Nov 2021 09:08:18 +0100 Subject: [PATCH 231/896] fix(lib): fix potential command injection in `title` and `spectrum` functions The `title` function unsafely prints its input without sanitization, which if used with custom user code that calls it, it could trigger command injection. The `spectrum_ls` and `spectrum_bls` could similarly be exploited if a variable is changed in the user's shell environment with a carefully crafted value. This is highly unlikely to occur (and if possible, other methods would be used instead), but with this change the exploit of these two functions is now impossible. --- lib/spectrum.zsh | 6 ++++-- lib/termsupport.zsh | 13 ++++++------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/lib/spectrum.zsh b/lib/spectrum.zsh index d5c22a8c5..97f5c360a 100644 --- a/lib/spectrum.zsh +++ b/lib/spectrum.zsh @@ -20,16 +20,18 @@ done # Show all 256 colors with color number function spectrum_ls() { + setopt localoptions nopromptsubst local ZSH_SPECTRUM_TEXT=${ZSH_SPECTRUM_TEXT:-Arma virumque cano Troiae qui primus ab oris} for code in {000..255}; do - print -P -- "$code: $FG[$code]$ZSH_SPECTRUM_TEXT%{$reset_color%}" + print -P -- "$code: ${FG[$code]}${ZSH_SPECTRUM_TEXT}%{$reset_color%}" done } # Show all 256 colors where the background is set to specific color function spectrum_bls() { + setopt localoptions nopromptsubst local ZSH_SPECTRUM_TEXT=${ZSH_SPECTRUM_TEXT:-Arma virumque cano Troiae qui primus ab oris} for code in {000..255}; do - print -P -- "$code: $BG[$code]$ZSH_SPECTRUM_TEXT%{$reset_color%}" + print -P -- "$code: ${BG[$code]}${ZSH_SPECTRUM_TEXT}%{$reset_color%}" done } diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh index ef0d78895..49f64400b 100644 --- a/lib/termsupport.zsh +++ b/lib/termsupport.zsh @@ -7,8 +7,7 @@ # (In screen, only short_tab_title is used) # Limited support for Apple Terminal (Terminal can't set window and tab separately) function title { - emulate -L zsh - setopt prompt_subst + setopt localoptions nopromptsubst # Don't set the title if inside emacs, unless using vterm [[ -n "$INSIDE_EMACS" && "$INSIDE_EMACS" != vterm ]] && return @@ -48,13 +47,13 @@ fi # Runs before showing the prompt function omz_termsupport_precmd { - [[ "${DISABLE_AUTO_TITLE:-}" == true ]] && return - title $ZSH_THEME_TERM_TAB_TITLE_IDLE $ZSH_THEME_TERM_TITLE_IDLE + [[ "${DISABLE_AUTO_TITLE:-}" != true ]] || return + title "$ZSH_THEME_TERM_TAB_TITLE_IDLE" "$ZSH_THEME_TERM_TITLE_IDLE" } # Runs before executing the command function omz_termsupport_preexec { - [[ "${DISABLE_AUTO_TITLE:-}" == true ]] && return + [[ "${DISABLE_AUTO_TITLE:-}" != true ]] || return emulate -L zsh setopt extended_glob @@ -97,10 +96,10 @@ function omz_termsupport_preexec { fi # cmd name only, or if this is sudo or ssh, the next cmd - local CMD=${1[(wr)^(*=*|sudo|ssh|mosh|rake|-*)]:gs/%/%%} + local CMD="${1[(wr)^(*=*|sudo|ssh|mosh|rake|-*)]:gs/%/%%}" local LINE="${2:gs/%/%%}" - title '$CMD' '%100>...>$LINE%<<' + title "$CMD" "%100>...>${LINE}%<<" } autoload -Uz add-zsh-hook From 72928432f1ddaa244e02067dd7fc14948a4a5ce4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 9 Nov 2021 09:31:09 +0100 Subject: [PATCH 232/896] fix(plugins): fix potential command injection in `rand-quote` and `hitokoto` The `rand-quote` plugin uses quotationspage.com and prints part of its content to the shell without sanitization, which could trigger command injection. There is no evidence that this has been exploited, but this commit removes all possibility for exploit. Similarly, the `hitokoto` plugin uses the hitokoto.cn website to print quotes to the shell, also without sanitization. Furthermore, there is also no evidence that this has been exploited, but with this change it is now impossible. --- plugins/hitokoto/hitokoto.plugin.zsh | 18 +++++++++++------- plugins/rand-quote/rand-quote.plugin.zsh | 23 ++++++++++++++++------- 2 files changed, 27 insertions(+), 14 deletions(-) diff --git a/plugins/hitokoto/hitokoto.plugin.zsh b/plugins/hitokoto/hitokoto.plugin.zsh index 8646ebf3b..e346d18c5 100644 --- a/plugins/hitokoto/hitokoto.plugin.zsh +++ b/plugins/hitokoto/hitokoto.plugin.zsh @@ -1,14 +1,18 @@ if ! (( $+commands[curl] )); then - echo "hitokoto plugin needs curl to work" >&2 - return + echo "hitokoto plugin needs curl to work" >&2 + return fi function hitokoto { - emulate -L zsh - Q=$(curl -s --connect-timeout 2 "https://v1.hitokoto.cn" | jq -j '.hitokoto+"\t"+.from') + setopt localoptions nopromptsubst - TXT=$(echo "$Q" | awk -F '\t' '{print $1}') - WHO=$(echo "$Q" | awk -F '\t' '{print $2}') + # Get hitokoto data + local -a data + data=("${(ps:\n:)"$(command curl -s --connect-timeout 2 "https://v1.hitokoto.cn" | command jq -j '.hitokoto+"\n"+.from')"}") - [[ -n "$WHO" && -n "$TXT" ]] && print -P "%F{3}${WHO}%f: “%F{5}${TXT}%f”" + # Exit if could not fetch hitokoto + [[ -n "$data" ]] || return 0 + + local quote="${data[1]}" author="${data[2]}" + print -P "%F{3}${author}%f: “%F{5}${quote}%f”" } diff --git a/plugins/rand-quote/rand-quote.plugin.zsh b/plugins/rand-quote/rand-quote.plugin.zsh index 371b997d3..23c21dc8f 100644 --- a/plugins/rand-quote/rand-quote.plugin.zsh +++ b/plugins/rand-quote/rand-quote.plugin.zsh @@ -1,14 +1,23 @@ if ! (( $+commands[curl] )); then - echo "rand-quote plugin needs curl to work" >&2 - return + echo "rand-quote plugin needs curl to work" >&2 + return fi function quote { - emulate -L zsh - Q=$(curl -s --connect-timeout 2 "http://www.quotationspage.com/random.php" | iconv -c -f ISO-8859-1 -t UTF-8 | grep -m 1 "dt ") + setopt localoptions nopromptsubst - TXT=$(echo "$Q" | sed -e 's/<\/dt>.*//g' -e 's/.*html//g' -e 's/^[^a-zA-Z]*//' -e 's/<\/a..*$//g') - WHO=$(echo "$Q" | sed -e 's/.*\/quotes\///g' -e 's/<.*//g' -e 's/.*">//g') + # Get random quote data + local data + data="$(command curl -s --connect-timeout 2 "http://www.quotationspage.com/random.php" \ + | iconv -c -f ISO-8859-1 -t UTF-8 \ + | command grep -a -m 1 'dt class="quote"')" - [[ -n "$WHO" && -n "$TXT" ]] && print -P "%F{3}${WHO}%f: “%F{5}${TXT}%f”" + # Exit if could not fetch random quote + [[ -n "$data" ]] || return 0 + + local quote author + quote=$(sed -e 's|.*||g' -e 's|.*html||g' -e 's|^[^a-zA-Z]*||' -e 's|||g' <<< "$data") + + print -P "%F{3}${author}%f: “%F{5}${quote}%f”" } From b3ba9978cc42a5031c7b68e3cf917ec2e64643bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 9 Nov 2021 09:54:21 +0100 Subject: [PATCH 233/896] fix(themes): fix potential command injection in `pygmalion`, `pygmalion-virtualenv` and `refined` The pygmalion and pygmalion-virtualenv themes unsafely handle git prompt information which results in a double evaluation of this information, so a malicious git repository could trigger a command injection if the user cloned and entered the repository. A similar method could be used in the refined theme. All themes have been patched against this vulnerability. --- themes/pygmalion-virtualenv.zsh-theme | 11 ++++++----- themes/pygmalion.zsh-theme | 6 +++--- themes/refined.zsh-theme | 1 + 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/themes/pygmalion-virtualenv.zsh-theme b/themes/pygmalion-virtualenv.zsh-theme index 47b0b4fb1..c2ab7f4e6 100644 --- a/themes/pygmalion-virtualenv.zsh-theme +++ b/themes/pygmalion-virtualenv.zsh-theme @@ -35,19 +35,20 @@ prompt_setup_pygmalion(){ } prompt_pygmalion_precmd(){ - setopt localoptions extendedglob + setopt localoptions nopromptsubst extendedglob local gitinfo=$(git_prompt_info) local gitinfo_nocolor=${gitinfo//\%\{[^\}]##\}} - local exp_nocolor="$(print -P \"$base_prompt_nocolor$gitinfo_nocolor$post_prompt_nocolor\")" + local exp_nocolor="$(print -P \"${base_prompt_nocolor}${gitinfo_nocolor}${post_prompt_nocolor}\")" local prompt_length=${#exp_nocolor} + # add new line on prompt longer than 40 characters local nl="" - if [[ $prompt_length -gt 40 ]]; then - nl=$'\n%{\r%}'; + nl=$'\n%{\r%}' fi - PROMPT="$base_prompt$gitinfo$nl$post_prompt" + + PROMPT="${base_prompt}\$(git_prompt_info)${nl}${post_prompt}" } prompt_setup_pygmalion diff --git a/themes/pygmalion.zsh-theme b/themes/pygmalion.zsh-theme index b13adfd5f..be9ca3889 100644 --- a/themes/pygmalion.zsh-theme +++ b/themes/pygmalion.zsh-theme @@ -19,14 +19,14 @@ prompt_setup_pygmalion(){ } prompt_pygmalion_precmd(){ - setopt localoptions extendedglob + setopt localoptions nopromptsubst extendedglob local gitinfo=$(git_prompt_info) local gitinfo_nocolor=${gitinfo//\%\{[^\}]##\}} - local exp_nocolor="$(print -P \"$base_prompt_nocolor$gitinfo_nocolor$post_prompt_nocolor\")" + local exp_nocolor="$(print -P \"${base_prompt_nocolor}${gitinfo_nocolor}${post_prompt_nocolor}\")" local prompt_length=${#exp_nocolor} - PROMPT="${base_prompt}${gitinfo}${post_prompt}" + PROMPT="${base_prompt}\$(git_prompt_info)${post_prompt}" } prompt_setup_pygmalion diff --git a/themes/refined.zsh-theme b/themes/refined.zsh-theme index 5d39bd757..5e2de7a87 100644 --- a/themes/refined.zsh-theme +++ b/themes/refined.zsh-theme @@ -70,6 +70,7 @@ preexec() { # Output additional information about paths, repos and exec time # precmd() { + setopt localoptions nopromptsubst vcs_info # Get version control info before we start outputting stuff print -P "\n$(repo_information) %F{yellow}$(cmd_exec_time)%f" unset cmd_timestamp #Reset cmd exec time. From 2c06852546f52330c389b53a1b81348e62f64423 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 16 Nov 2021 17:18:07 +0100 Subject: [PATCH 234/896] style(dirhistory): remove use of `eval` completely --- plugins/dirhistory/dirhistory.plugin.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/dirhistory/dirhistory.plugin.zsh b/plugins/dirhistory/dirhistory.plugin.zsh index e3f45ee99..9f39264cf 100644 --- a/plugins/dirhistory/dirhistory.plugin.zsh +++ b/plugins/dirhistory/dirhistory.plugin.zsh @@ -19,14 +19,14 @@ export DIRHISTORY_SIZE=30 # Returns the element if the array was not empty, # otherwise returns empty string. function pop_past() { - eval "$1=${(q)dirhistory_past[$#dirhistory_past]}" + print -v $1 "${dirhistory_past[$#dirhistory_past]}" if [[ $#dirhistory_past -gt 0 ]]; then dirhistory_past[$#dirhistory_past]=() fi } function pop_future() { - eval "$1=${(q)dirhistory_future[$#dirhistory_future]}" + print -v $1 "${dirhistory_future[$#dirhistory_future]}" if [[ $#dirhistory_future -gt 0 ]]; then dirhistory_future[$#dirhistory_future]=() fi From fb12e4135311b9c4189a7e4556be619922052f6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 16 Nov 2021 18:38:59 +0100 Subject: [PATCH 235/896] fix(install): fix backslash in `printf` when showing logo (#10422) Fixes #10422 --- tools/install.sh | 10 +++++----- tools/upgrade.sh | 12 ++++++------ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/tools/install.sh b/tools/install.sh index ca996f8a7..47166059d 100755 --- a/tools/install.sh +++ b/tools/install.sh @@ -339,11 +339,11 @@ EOF # shellcheck disable=SC2183 # printf string has more %s than arguments ($RAINBOW expands to multiple arguments) print_success() { - printf '%s %s__ %s %s %s %s %s__ %s\n' $RAINBOW $RESET - printf '%s ____ %s/ /_ %s ____ ___ %s__ __ %s ____ %s_____%s/ /_ %s\n' $RAINBOW $RESET - printf '%s / __ \%s/ __ \ %s / __ `__ \%s/ / / / %s /_ / %s/ ___/%s __ \ %s\n' $RAINBOW $RESET - printf '%s/ /_/ /%s / / / %s / / / / / /%s /_/ / %s / /_%s(__ )%s / / / %s\n' $RAINBOW $RESET - printf '%s\____/%s_/ /_/ %s /_/ /_/ /_/%s\__, / %s /___/%s____/%s_/ /_/ %s\n' $RAINBOW $RESET + printf '%s %s__ %s %s %s %s %s__ %s\n' $RAINBOW $RESET + printf '%s ____ %s/ /_ %s ____ ___ %s__ __ %s ____ %s_____%s/ /_ %s\n' $RAINBOW $RESET + printf '%s / __ \\%s/ __ \\ %s / __ `__ \\%s/ / / / %s /_ / %s/ ___/%s __ \\ %s\n' $RAINBOW $RESET + printf '%s/ /_/ /%s / / / %s / / / / / /%s /_/ / %s / /_%s(__ )%s / / / %s\n' $RAINBOW $RESET + printf '%s\\____/%s_/ /_/ %s /_/ /_/ /_/%s\\__, / %s /___/%s____/%s_/ /_/ %s\n' $RAINBOW $RESET printf '%s %s %s %s /____/ %s %s %s %s....is now installed!%s\n' $RAINBOW $GREEN $RESET printf '\n' printf '\n' diff --git a/tools/upgrade.sh b/tools/upgrade.sh index 7642858fe..994ffe9c9 100755 --- a/tools/upgrade.sh +++ b/tools/upgrade.sh @@ -182,12 +182,12 @@ if git pull --rebase --stat $remote $branch; then printf "${BLUE}%s \`${BOLD}%s${RESET}${BLUE}\`${RESET}\n" "You can see the changelog with" "omz changelog" fi - printf '%s %s__ %s %s %s %s %s__ %s\n' $RAINBOW $RESET - printf '%s ____ %s/ /_ %s ____ ___ %s__ __ %s ____ %s_____%s/ /_ %s\n' $RAINBOW $RESET - printf '%s / __ \%s/ __ \ %s / __ `__ \%s/ / / / %s /_ / %s/ ___/%s __ \ %s\n' $RAINBOW $RESET - printf '%s/ /_/ /%s / / / %s / / / / / /%s /_/ / %s / /_%s(__ )%s / / / %s\n' $RAINBOW $RESET - printf '%s\____/%s_/ /_/ %s /_/ /_/ /_/%s\__, / %s /___/%s____/%s_/ /_/ %s\n' $RAINBOW $RESET - printf '%s %s %s %s /____/ %s %s %s %s\n' $RAINBOW $RESET + printf '%s %s__ %s %s %s %s %s__ %s\n' $RAINBOW $RESET + printf '%s ____ %s/ /_ %s ____ ___ %s__ __ %s ____ %s_____%s/ /_ %s\n' $RAINBOW $RESET + printf '%s / __ \\%s/ __ \\ %s / __ `__ \\%s/ / / / %s /_ / %s/ ___/%s __ \\ %s\n' $RAINBOW $RESET + printf '%s/ /_/ /%s / / / %s / / / / / /%s /_/ / %s / /_%s(__ )%s / / / %s\n' $RAINBOW $RESET + printf '%s\\____/%s_/ /_/ %s /_/ /_/ /_/%s\\__, / %s /___/%s____/%s_/ /_/ %s\n' $RAINBOW $RESET + printf '%s %s %s %s /____/ %s %s %s %s\n' $RAINBOW $RESET printf '\n' printf "${BLUE}%s${RESET}\n\n" "$message" printf "${BLUE}${BOLD}%s %s${RESET}\n" "To keep up with the latest news and updates, follow us on Twitter:" "$(fmt_link @ohmyzsh https://twitter.com/ohmyzsh)" From 60b89cd264a5d889573704f5116cefc8e690062c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 17 Nov 2021 09:55:39 +0100 Subject: [PATCH 236/896] feat(ssh-agent): add `quiet` option to silence plugin (#9659) Closes #9659 Co-authored-by: Jeff Warner --- plugins/ssh-agent/README.md | 56 +++++++++++++++----------- plugins/ssh-agent/ssh-agent.plugin.zsh | 12 +++--- 2 files changed, 38 insertions(+), 30 deletions(-) diff --git a/plugins/ssh-agent/README.md b/plugins/ssh-agent/README.md index 1d6914ec6..fa6a996d4 100644 --- a/plugins/ssh-agent/README.md +++ b/plugins/ssh-agent/README.md @@ -13,28 +13,24 @@ plugins=(... ssh-agent) **IMPORTANT: put these settings _before_ the line that sources oh-my-zsh** +### `agent-forwarding` + To enable **agent forwarding support** add the following to your zshrc file: ```zsh -zstyle :omz:plugins:ssh-agent agent-forwarding on +zstyle :omz:plugins:ssh-agent agent-forwarding yes ``` ----- +### `helper` -To **NOT load any identities on start** use the `lazy` setting. This is particularly -useful when combined with the `AddKeysToAgent` setting (available since OpenSSH 7.2), -since it allows to enter the password only on first use. _NOTE: you can know your -OpenSSH version with `ssh -V`._ +To set an **external helper** to ask for the passwords and possibly store +them in the system keychain use the `helper` style. For example: ```zsh -zstyle :omz:plugins:ssh-agent lazy yes +zstyle :omz:plugins:ssh-agent helper ksshaskpass ``` -You can enable `AddKeysToAgent` by passing `-o AddKeysToAgent=yes` to the `ssh` command, -or by adding `AddKeysToAgent yes` to your `~/.ssh/config` file [1]. -See the [OpenSSH 7.2 Release Notes](http://www.openssh.com/txt/release-7.2). - ----- +### `identities` To **load multiple identities** use the `identities` style (**this has no effect if the `lazy` setting is enabled**). For example: @@ -52,7 +48,22 @@ zstyle :omz:plugins:ssh-agent identities ~/.config/ssh/id_rsa ~/.config/ssh/id_r zstyle :omz:plugins:ssh-agent identities ~/.config/ssh/{id_rsa,id_rsa2,id_github} ``` ----- +### `lazy` + +To **NOT load any identities on start** use the `lazy` setting. This is particularly +useful when combined with the `AddKeysToAgent` setting (available since OpenSSH 7.2), +since it allows to enter the password only on first use. _NOTE: you can know your +OpenSSH version with `ssh -V`._ + +```zsh +zstyle :omz:plugins:ssh-agent lazy yes +``` + +You can enable `AddKeysToAgent` by passing `-o AddKeysToAgent=yes` to the `ssh` command, +or by adding `AddKeysToAgent yes` to your `~/.ssh/config` file [1]. +See the [OpenSSH 7.2 Release Notes](http://www.openssh.com/txt/release-7.2). + +### `lifetime` To **set the maximum lifetime of the identities**, use the `lifetime` style. The lifetime may be specified in seconds or as described in sshd_config(5) @@ -62,7 +73,15 @@ The lifetime may be specified in seconds or as described in sshd_config(5) zstyle :omz:plugins:ssh-agent lifetime 4h ``` ----- +### `quiet` + +To silence the plugin, use the following setting: + +```zsh +zstyle :omz:plugins:ssh-agent quiet yes +``` + +### `ssh-add-args` To **pass arguments to the `ssh-add` command** that adds the identities on startup, use the `ssh-add-args` setting. You can pass multiple arguments separated by spaces: @@ -80,15 +99,6 @@ ssh-add -K -c -a /run/user/1000/ssh-auth For valid `ssh-add` arguments run `ssh-add --help` or `man ssh-add`. ----- - -To set an **external helper** to ask for the passwords and possibly store -them in the system keychain use the `helper` style. For example: - -```zsh -zstyle :omz:plugins:ssh-agent helper ksshaskpass -``` - ## Credits Based on code from Joseph M. Reagle: https://www.cygwin.com/ml/cygwin/2001-06/msg00537.html diff --git a/plugins/ssh-agent/ssh-agent.plugin.zsh b/plugins/ssh-agent/ssh-agent.plugin.zsh index 47dfef5b0..0d6a35b35 100644 --- a/plugins/ssh-agent/ssh-agent.plugin.zsh +++ b/plugins/ssh-agent/ssh-agent.plugin.zsh @@ -18,7 +18,7 @@ function _start_agent() { zstyle -s :omz:plugins:ssh-agent lifetime lifetime # start ssh-agent and setup environment - echo Starting ssh-agent... + zstyle -t :omz:plugins:ssh-agent quiet || echo >&2 "Starting ssh-agent ..." ssh-agent -s ${lifetime:+-t} ${lifetime} | sed '/^echo/d' >! "$ssh_env_cache" chmod 600 "$ssh_env_cache" . "$ssh_env_cache" > /dev/null @@ -78,7 +78,7 @@ function _add_identities() { if [[ -n "$helper" ]]; then if [[ -z "${commands[$helper]}" ]]; then - echo "ssh-agent: the helper '$helper' has not been found." + echo >&2 "ssh-agent: the helper '$helper' has not been found." else SSH_ASKPASS="$helper" ssh-add "${args[@]}" ${^not_loaded} < /dev/null return $? @@ -88,11 +88,9 @@ function _add_identities() { ssh-add "${args[@]}" ${^not_loaded} } -# test if agent-forwarding is enabled -zstyle -b :omz:plugins:ssh-agent agent-forwarding agent_forwarding - -# Add a nifty symlink for screen/tmux if agent forwarding -if [[ $agent_forwarding = "yes" && -n "$SSH_AUTH_SOCK" && ! -L "$SSH_AUTH_SOCK" ]]; then +# Add a nifty symlink for screen/tmux if agent forwarding is enabled +if zstyle -t :omz:plugins:ssh-agent agent-forwarding \ + && [[ -n "$SSH_AUTH_SOCK" && ! -L "$SSH_AUTH_SOCK" ]]; then ln -sf "$SSH_AUTH_SOCK" /tmp/ssh-agent-$USERNAME-screen else _start_agent From 2b379ec42c8675d6076737e1373767c160f5ae70 Mon Sep 17 00:00:00 2001 From: Brian Tannous Date: Wed, 17 Nov 2021 01:33:48 -0800 Subject: [PATCH 237/896] feat(kn): add plugin for `kn` completion (#8927) --- plugins/kn/README.md | 17 +++++++++++++++++ plugins/kn/kn.plugin.zsh | 8 ++++++++ 2 files changed, 25 insertions(+) create mode 100644 plugins/kn/README.md create mode 100644 plugins/kn/kn.plugin.zsh diff --git a/plugins/kn/README.md b/plugins/kn/README.md new file mode 100644 index 000000000..d2eb9b31d --- /dev/null +++ b/plugins/kn/README.md @@ -0,0 +1,17 @@ +# kn - Knative CLI + +This plugin provides autocompletion for [kn](https://knative.dev/docs/install/client/install-kn/) operations. + +To use it, add `kn` to the plugins array of your zshrc file: + +```zsh +plugins=(... kn) +``` + +## See Also + ++ [kn/client](https://github.com/knative/client) + +## Contributors + ++ [btannous](https://github.com/btannous) - Plugin Author diff --git a/plugins/kn/kn.plugin.zsh b/plugins/kn/kn.plugin.zsh new file mode 100644 index 000000000..f60177dd9 --- /dev/null +++ b/plugins/kn/kn.plugin.zsh @@ -0,0 +1,8 @@ +# Autocompletion for kn, the command line interface for knative +# +# Author: https://github.com/btannous + +if [ $commands[kn] ]; then + source <(kn completion zsh) + compdef _kn kn +fi From b60b3f184275c39800dd7284d6904fcf295b3956 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 17 Nov 2021 10:53:17 +0100 Subject: [PATCH 238/896] fix(osx): deprecate `osx` plugin without symlink (#10428) Fixes #10428 --- plugins/macos/macos.plugin.zsh | 6 ------ plugins/macos/osx.plugin.zsh | 1 - plugins/osx | 1 - plugins/osx/README.md | 3 +++ plugins/osx/osx.plugin.zsh | 5 +++++ 5 files changed, 8 insertions(+), 8 deletions(-) delete mode 120000 plugins/macos/osx.plugin.zsh delete mode 120000 plugins/osx create mode 100644 plugins/osx/README.md create mode 100644 plugins/osx/osx.plugin.zsh diff --git a/plugins/macos/macos.plugin.zsh b/plugins/macos/macos.plugin.zsh index 4bcbbaead..6a91be336 100644 --- a/plugins/macos/macos.plugin.zsh +++ b/plugins/macos/macos.plugin.zsh @@ -1,9 +1,3 @@ -# Check if 'osx' is still in the plugins list and prompt to change to 'macos' -if [[ -n "${plugins[(r)osx]}" ]]; then - print ${(%):-"%F{yellow}The \`osx\` plugin is deprecated and has been renamed to \`macos\`."} - print ${(%):-"Please update your .zshrc to use the \`%Bmacos%b\` plugin instead.%f"} -fi - # Open the current directory in a Finder window alias ofd='open_command $PWD' diff --git a/plugins/macos/osx.plugin.zsh b/plugins/macos/osx.plugin.zsh deleted file mode 120000 index 73d718d43..000000000 --- a/plugins/macos/osx.plugin.zsh +++ /dev/null @@ -1 +0,0 @@ -macos.plugin.zsh \ No newline at end of file diff --git a/plugins/osx b/plugins/osx deleted file mode 120000 index a8d0f9c48..000000000 --- a/plugins/osx +++ /dev/null @@ -1 +0,0 @@ -macos \ No newline at end of file diff --git a/plugins/osx/README.md b/plugins/osx/README.md new file mode 100644 index 000000000..98d859545 --- /dev/null +++ b/plugins/osx/README.md @@ -0,0 +1,3 @@ +# osx plugin + +**Deprecated: use the [`macos`](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/macos) plugin instead.** diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh new file mode 100644 index 000000000..9304e7f32 --- /dev/null +++ b/plugins/osx/osx.plugin.zsh @@ -0,0 +1,5 @@ +print ${(%):-'%F{yellow}The `osx` plugin is deprecated and has been renamed to `macos`.'} +print ${(%):-'Please update your .zshrc to use the `%Bmacos%b` plugin instead.%f'} + +(( ${fpath[(Ie)$ZSH/plugins/macos]} )) || fpath=("$ZSH/plugins/macos" $fpath) +source "$ZSH/plugins/macos/macos.plugin.zsh" From 88e72e8a5482db677a1d07722293a3a4f8f71342 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 17 Nov 2021 10:35:32 +0100 Subject: [PATCH 239/896] fix(docker-compose)!: check for old command instead of calling `docker` (#10409) BREAKING CHANGE: the plugin now checks for the `docker-compose` command instead of trying whether `docker compose` is a valid command. This means that if the old command is still installed it will be used instead. To use `docker compose`, uninstall any old copies of `docker-compose`. Fixes #10409 --- plugins/docker-compose/docker-compose.plugin.zsh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/plugins/docker-compose/docker-compose.plugin.zsh b/plugins/docker-compose/docker-compose.plugin.zsh index 13985fc82..b8a4b067d 100644 --- a/plugins/docker-compose/docker-compose.plugin.zsh +++ b/plugins/docker-compose/docker-compose.plugin.zsh @@ -1,7 +1,5 @@ # support Compose v2 as docker CLI plugin -DOCKER_CONTEXT=default command docker compose &>/dev/null \ - && dccmd='docker compose' \ - || dccmd='docker-compose' +(( ${+commands[docker-compose]} )) && dccmd='docker-compose' || dccmd='docker compose' alias dco="$dccmd" alias dcb="$dccmd build" From ff09151d6b82fef7af4ced774a416a36e7835b8a Mon Sep 17 00:00:00 2001 From: Aurora Date: Wed, 17 Nov 2021 11:44:04 +0100 Subject: [PATCH 240/896] fix(bgnotify): avoid permission prompts by checking frontmost app ID (#10318) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Marc CornellĂ  --- plugins/bgnotify/bgnotify.plugin.zsh | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/plugins/bgnotify/bgnotify.plugin.zsh b/plugins/bgnotify/bgnotify.plugin.zsh index aecde20ea..479796dbe 100644 --- a/plugins/bgnotify/bgnotify.plugin.zsh +++ b/plugins/bgnotify/bgnotify.plugin.zsh @@ -20,6 +20,12 @@ if ! (type bgnotify_formatted | grep -q 'function'); then ## allow custom functi } fi +currentAppId () { + if (( $+commands[osascript] )); then + osascript -e 'tell application (path to frontmost application as text) to id' 2>/dev/null + fi +} + currentWindowId () { if hash osascript 2>/dev/null; then #osx osascript -e 'tell application (path to frontmost application as text) to id of front window' 2&> /dev/null || echo "0" @@ -32,11 +38,20 @@ currentWindowId () { bgnotify () { ## args: (title, subtitle) if hash terminal-notifier 2>/dev/null; then #osx - [[ "$TERM_PROGRAM" == 'iTerm.app' ]] && term_id='com.googlecode.iterm2'; - [[ "$TERM_PROGRAM" == 'Apple_Terminal' ]] && term_id='com.apple.terminal'; + local term_id="$bgnotify_appid" + if [[ -z "$term_id" ]]; then + case "$TERM_PROGRAM" in + iTerm.app) term_id='com.googlecode.iterm2' ;; + Apple_Terminal) term_id='com.apple.terminal' ;; + esac + fi + ## now call terminal-notifier, (hopefully with $term_id!) - [ -z "$term_id" ] && terminal-notifier -message "$2" -title "$1" >/dev/null || - terminal-notifier -message "$2" -title "$1" -activate "$term_id" -sender "$term_id" >/dev/null + if [[ -z "$term_id" ]]; then + terminal-notifier -message "$2" -title "$1" >/dev/null + else + terminal-notifier -message "$2" -title "$1" -activate "$term_id" -sender "$term_id" >/dev/null + fi elif hash growlnotify 2>/dev/null; then #osx growl growlnotify -m "$1" "$2" elif hash notify-send 2>/dev/null; then #ubuntu gnome! @@ -54,6 +69,7 @@ bgnotify () { ## args: (title, subtitle) bgnotify_begin() { bgnotify_timestamp=$EPOCHSECONDS bgnotify_lastcmd="${1:-$2}" + bgnotify_appid="$(currentAppId)" bgnotify_windowid=$(currentWindowId) } @@ -62,7 +78,7 @@ bgnotify_end() { elapsed=$(( EPOCHSECONDS - bgnotify_timestamp )) past_threshold=$(( elapsed >= bgnotify_threshold )) if (( bgnotify_timestamp > 0 )) && (( past_threshold )); then - if [ $(currentWindowId) != "$bgnotify_windowid" ]; then + if [[ $(currentAppId) != "$bgnotify_appid" || $(currentWindowId) != "$bgnotify_windowid" ]]; then print -n "\a" bgnotify_formatted "$didexit" "$bgnotify_lastcmd" "$elapsed" fi From 98b48015486bc638ba8f989af9285b73c413f9e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 17 Nov 2021 12:35:23 +0100 Subject: [PATCH 241/896] fix(bundler): use BUNDLE_JOBS in `bi` to avoid config file change When calling `bundle install` with `--jobs=`, bundle persists this argument in `.bundle/config`. If we run `BUNDLE_JOBS= bundle install` instead, this is not persisted. Fixes #10425 --- plugins/bundler/bundler.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh index 6293dc28a..c93d4869e 100644 --- a/plugins/bundler/bundler.plugin.zsh +++ b/plugins/bundler/bundler.plugin.zsh @@ -40,7 +40,7 @@ bundle_install() { else local cores_num="$(nproc)" fi - bundle install --jobs="$cores_num" "$@" + BUNDLE_JOBS="$cores_num" bundle install "$@" } ## Gem wrapper From 15fd9c84deae400ba52451d75548fb8f6ec26bcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 9 Nov 2021 15:07:09 +0100 Subject: [PATCH 242/896] style(bundler): simplify `bundled_commands` array operations --- plugins/bundler/bundler.plugin.zsh | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh index c93d4869e..c1cbb13dd 100644 --- a/plugins/bundler/bundler.plugin.zsh +++ b/plugins/bundler/bundler.plugin.zsh @@ -81,14 +81,12 @@ bundled_commands=( ) # Remove $UNBUNDLED_COMMANDS from the bundled_commands list -for cmd in $UNBUNDLED_COMMANDS; do - bundled_commands=(${bundled_commands#$cmd}); -done +bundled_commands=(${bundled_commands:|UNBUNDLED_COMMANDS}) +unset UNBUNDLED_COMMANDS # Add $BUNDLED_COMMANDS to the bundled_commands list -for cmd in $BUNDLED_COMMANDS; do - bundled_commands+=($cmd); -done +bundled_commands+=($BUNDLED_COMMANDS) +unset BUNDLED_COMMANDS # Check if in the root or a subdirectory of a bundled project _within-bundled-project() { @@ -126,5 +124,4 @@ for cmd in $bundled_commands; do compdef "_$cmd" "bundled_$cmd"="$cmd" fi done - unset cmd bundled_commands From 2b96b7c54bbc86743d5550196e31f14b1b3d4951 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Thu, 25 Nov 2021 11:46:37 +0100 Subject: [PATCH 243/896] fix(updater): stop update if `$ZSH` is not a git repository (#10448) Fixes #10448 --- tools/check_for_upgrade.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh index a6fdf4659..b6625a395 100644 --- a/tools/check_for_upgrade.sh +++ b/tools/check_for_upgrade.sh @@ -133,6 +133,12 @@ function update_ohmyzsh() { return fi + # Test if Oh My Zsh directory is a git repository + if ! (cd "$ZSH" && LANG= git rev-parse &>/dev/null); then + echo >&2 "[oh-my-zsh] Can't update: not a git repository." + return + fi + # Check if there are updates available before proceeding if ! is_update_available; then return From 0314604384529fb535825bf1d93c6fdb3c5ccbbe Mon Sep 17 00:00:00 2001 From: Paul Scott Date: Thu, 25 Nov 2021 22:55:21 +0000 Subject: [PATCH 244/896] fix(lib): don't error if `INSIDE_EMACS` is not defined (#10443) --- lib/termsupport.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh index 49f64400b..4035d10a1 100644 --- a/lib/termsupport.zsh +++ b/lib/termsupport.zsh @@ -10,7 +10,7 @@ function title { setopt localoptions nopromptsubst # Don't set the title if inside emacs, unless using vterm - [[ -n "$INSIDE_EMACS" && "$INSIDE_EMACS" != vterm ]] && return + [[ -n "${INSIDE_EMACS:-}" && "$INSIDE_EMACS" != vterm ]] && return # if $2 is unset use $1 as default # if it is set and empty, leave it as is From 452ddff763ebbaba40a060006e8290d497e2993a Mon Sep 17 00:00:00 2001 From: Kyle <43724855+Kyle-Ye@users.noreply.github.com> Date: Fri, 26 Nov 2021 06:57:08 +0800 Subject: [PATCH 245/896] feat(xcode): support `.swiftpm` as project file in `xc` (#10434) --- plugins/xcode/README.md | 2 +- plugins/xcode/xcode.plugin.zsh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/xcode/README.md b/plugins/xcode/README.md index 664a063a3..27d6a228b 100644 --- a/plugins/xcode/README.md +++ b/plugins/xcode/README.md @@ -26,7 +26,7 @@ plugins=(... xcode) ### `xc` -Opens the current directory in Xcode as an Xcode project or a Swift package. This will open one of the `.xcworkspace`, `.xcodeproj` and `Package.swift` files that it can find in the current working directory. You can also specify a directory to look in for the Xcode files. +Opens the current directory in Xcode as an Xcode project or a Swift package. This will open one of the `.xcworkspace`, `.xcodeproj`, `.swiftpm` and `Package.swift` files that it can find in the current working directory. You can also specify a directory to look in for the Xcode files. Returns 1 if it didn't find any relevant files. ### `xx` diff --git a/plugins/xcode/xcode.plugin.zsh b/plugins/xcode/xcode.plugin.zsh index 41b9e37e4..3bd12cdec 100644 --- a/plugins/xcode/xcode.plugin.zsh +++ b/plugins/xcode/xcode.plugin.zsh @@ -7,7 +7,7 @@ alias xcsel='sudo xcode-select --switch' # source: https://gist.github.com/subdigital/5420709 function xc { local xcode_files - xcode_files=(${1:-.}/{*.{xcworkspace,xcodeproj},Package.swift}(N)) + xcode_files=(${1:-.}/{*.{xcworkspace,xcodeproj,swiftpm},Package.swift}(N)) if [[ ${#xcode_files} -eq 0 ]]; then echo "No Xcode files found in ${1:-the current directory}." >&2 From 8e5f3db305bb1fc363d3fe98c2d1177f0027a5bc Mon Sep 17 00:00:00 2001 From: Adam Cwyk <8567636+acwyk@users.noreply.github.com> Date: Sat, 27 Nov 2021 12:23:08 +1100 Subject: [PATCH 246/896] feat(dotnet): add alias for `dotnet build` command (#10435) Co-authored-by: Adam Cwyk --- plugins/dotnet/README.md | 1 + plugins/dotnet/dotnet.plugin.zsh | 1 + 2 files changed, 2 insertions(+) diff --git a/plugins/dotnet/README.md b/plugins/dotnet/README.md index 7554b4e3c..87dfd8f8d 100644 --- a/plugins/dotnet/README.md +++ b/plugins/dotnet/README.md @@ -21,3 +21,4 @@ plugins=(... dotnet) | da | dotnet add | Add a package or reference to a .NET project. | | dp | dotnet pack | Create a NuGet package. | | dng | dotnet nuget | Provides additional NuGet commands. | +| db | dotnet build | Build a .NET project | diff --git a/plugins/dotnet/dotnet.plugin.zsh b/plugins/dotnet/dotnet.plugin.zsh index 6bd4b7af8..5bc1587c5 100644 --- a/plugins/dotnet/dotnet.plugin.zsh +++ b/plugins/dotnet/dotnet.plugin.zsh @@ -30,3 +30,4 @@ alias ds='dotnet sln' alias da='dotnet add' alias dp='dotnet pack' alias dng='dotnet nuget' +alias db='dotnet build' From 58478d0888aa842adc71aded80009cba5be190ec Mon Sep 17 00:00:00 2001 From: Markus Hofbauer Date: Sat, 27 Nov 2021 20:30:03 +0100 Subject: [PATCH 247/896] feat(git): Add alias for rebasing to origin/main-branch (#10445) --- plugins/git/README.md | 1 + plugins/git/git.plugin.zsh | 1 + 2 files changed, 2 insertions(+) diff --git a/plugins/git/README.md b/plugins/git/README.md index 113080874..b9af3488f 100644 --- a/plugins/git/README.md +++ b/plugins/git/README.md @@ -130,6 +130,7 @@ plugins=(... git) | grbd | git rebase $(git_develop_branch) | | grbi | git rebase -i | | grbm | git rebase $(git_main_branch) | +| grbom | git rebase origin/$(git_main_branch) | | grbo | git rebase --onto | | grbs | git rebase --skip | | grev | git revert | diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 5a3c98287..648fa0a33 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -251,6 +251,7 @@ alias grbc='git rebase --continue' alias grbd='git rebase $(git_develop_branch)' alias grbi='git rebase -i' alias grbm='git rebase $(git_main_branch)' +alias grbom='git rebase origin/$(git_main_branch)' alias grbo='git rebase --onto' alias grbs='git rebase --skip' alias grev='git revert' From bf303965e685489f2f1b764d5d22dc4766ca78c8 Mon Sep 17 00:00:00 2001 From: Nicholas Hawkes Date: Sat, 27 Nov 2021 15:34:47 -0500 Subject: [PATCH 248/896] feat(aws): Adds the login option for AWS SSO (#9921) --- plugins/aws/README.md | 1 + plugins/aws/aws.plugin.zsh | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/plugins/aws/README.md b/plugins/aws/README.md index 011bbd8b4..24c6429dd 100644 --- a/plugins/aws/README.md +++ b/plugins/aws/README.md @@ -14,6 +14,7 @@ plugins=(... aws) * `asp []`: sets `$AWS_PROFILE` and `$AWS_DEFAULT_PROFILE` (legacy) to ``. It also sets `$AWS_EB_PROFILE` to `` for the Elastic Beanstalk CLI. Run `asp` without arguments to clear the profile. +* `asp [] login`: If AWS SSO has been configured in your aws profile, it will run the `aws sso login` command following profile selection. * `acp []`: in addition to `asp` functionality, it actually changes the profile by assuming the role specified in the `` configuration. It supports MFA and sets diff --git a/plugins/aws/aws.plugin.zsh b/plugins/aws/aws.plugin.zsh index 2d095635b..3a3a111b4 100644 --- a/plugins/aws/aws.plugin.zsh +++ b/plugins/aws/aws.plugin.zsh @@ -21,6 +21,10 @@ function asp() { export AWS_DEFAULT_PROFILE=$1 export AWS_PROFILE=$1 export AWS_EB_PROFILE=$1 + + if [[ "$2" == "login" ]]; then + aws sso login + fi } # AWS profile switch From f0f792fa6b207bc72453ae55011b6b44f678fb78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 30 Nov 2021 10:13:23 +0100 Subject: [PATCH 249/896] feat(cli): add `omz version` command --- lib/cli.zsh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/lib/cli.zsh b/lib/cli.zsh index d90cc6469..aed84e08f 100644 --- a/lib/cli.zsh +++ b/lib/cli.zsh @@ -29,6 +29,7 @@ function _omz { 'reload:Reload the current zsh session' 'theme:Manage themes' 'update:Update Oh My Zsh' + 'version:Show the version' ) if (( CURRENT == 2 )); then @@ -164,6 +165,7 @@ Available commands: reload Reload the current zsh session theme Manage themes update Update Oh My Zsh + version Show the version EOF } @@ -777,3 +779,24 @@ function _omz::update { [[ "$zsh" = -* || -o login ]] && exec -l "${zsh#-}" || exec "$zsh" fi } + +function _omz::version { + ( + cd "$ZSH" + + # Get the version name: + # 1) try tag-like version + # 2) try name-rev + # 3) try branch name + local version + version=$(command git describe --tags HEAD 2>/dev/null) \ + || version=$(command git name-rev --no-undefined --name-only --exclude="remotes/*" HEAD 2>/dev/null) \ + || version=$(command git symbolic-ref --quiet --short HEAD 2>/dev/null) + + # Get short hash for the current HEAD + local commit=$(command git rev-parse --short HEAD 2>/dev/null) + + # Show version and commit hash + printf "%s (%s)\n" "$version" "$commit" + ) +} From 1c1d74c5ec49e5ab7e2d664e557c61745d1995e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 30 Nov 2021 10:19:21 +0100 Subject: [PATCH 250/896] chore: update new issue templates --- .github/ISSUE_TEMPLATE/bug_report.yml | 15 ++--- .github/ISSUE_TEMPLATE/bug_report_omz.yml | 77 ++++++++++++++++++++++ .github/ISSUE_TEMPLATE/feature_request.yml | 7 +- 3 files changed, 90 insertions(+), 9 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/bug_report_omz.yml diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index af2973fec..98f66b1d2 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -1,12 +1,11 @@ -name: Bug report -description: Create a report to help us improve Oh My Zsh -labels: 'Bug' +name: Report a bug +description: Report a bug that isn't caused by Oh My Zsh. If unsure, use this form body: - type: markdown attributes: value: | ## Self Check - - Try searching existing [GitHub Issues](https://github.com/ohmyzsh/ohmyzsh/issues?q=is%3Aissue) (open or closed) for similar issues. + - Look for similar errors in existing [GitHub Issues](https://github.com/ohmyzsh/ohmyzsh/issues?q=is%3Aissue) (open or closed). - Try reaching out on the [Discord server](https://discord.gg/ohmyzsh) for help. - type: textarea validations: @@ -41,21 +40,21 @@ body: validations: required: true attributes: - label: OS / Distro - placeholder: e.g. Windows 10, Ubuntu 20.04, Arch Linux, macOS 10.15... + label: OS / Linux distribution + placeholder: Windows 10, Ubuntu 20.04, Arch Linux, macOS 10.15... - type: input validations: required: true attributes: label: Zsh version description: Run `echo $ZSH_VERSION` to check. - placeholder: e.g. 5.6 + placeholder: "5.6" - type: input validations: required: true attributes: label: Terminal emulator - placeholder: e.g. iTerm2, Gnome Terminal... + placeholder: iTerm2, GNOME Terminal, Terminal.app... - type: dropdown attributes: label: If using WSL on Windows, which version of WSL diff --git a/.github/ISSUE_TEMPLATE/bug_report_omz.yml b/.github/ISSUE_TEMPLATE/bug_report_omz.yml new file mode 100644 index 000000000..96f5ad934 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report_omz.yml @@ -0,0 +1,77 @@ +name: Report a bug in Oh My Zsh +description: Create a report to help us improve Oh My Zsh +labels: ['Bug'] +body: + - type: markdown + attributes: + value: | + ## Self Check + - **Make sure this bug only happens with Oh My Zsh enabled**. + - Look for similar errors in existing [GitHub Issues](https://github.com/ohmyzsh/ohmyzsh/issues?q=is%3Aissue) (open or closed). + - Try reaching out on the [Discord server](https://discord.gg/ohmyzsh) for help. + - type: textarea + validations: + required: true + attributes: + label: Describe the bug + description: A clear description of what the bug is. + - type: textarea + validations: + required: true + attributes: + label: Steps to reproduce + description: | + Steps to reproduce the problem. + placeholder: | + For example: + 1. Enable plugin '...' + 2. Run command '...' or try to complete command '...' + 3. See error + - type: textarea + validations: + required: true + attributes: + label: Expected behavior + description: A brief description of what should happen. + - type: textarea + attributes: + label: Screenshots and recordings + description: | + If applicable, add screenshots to help explain your problem. You can also record an asciinema session: https://asciinema.org/ + - type: input + validations: + required: true + attributes: + label: OS / Linux distribution + placeholder: Windows 10, Ubuntu 20.04, Arch Linux, macOS 10.15... + - type: input + validations: + required: true + attributes: + label: Zsh version + description: Run `echo $ZSH_VERSION` to check. + placeholder: "5.6" + - type: input + validations: + required: true + attributes: + label: Oh My Zsh version + description: Run `omz version` to check. + placeholder: master (bf303965) + - type: input + validations: + required: true + attributes: + label: Terminal emulator + placeholder: iTerm2, GNOME Terminal, Terminal.app... + - type: dropdown + attributes: + label: If using WSL on Windows, which version of WSL + description: Run `wsl -l -v` to check. + options: + - WSL1 + - WSL2 + - type: textarea + attributes: + label: Additional context + description: Add any other context about the problem here. This can be themes, plugins, custom settings... diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml index dc4baf2b1..ac966dfd9 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -1,7 +1,12 @@ name: Feature request description: Suggest a feature for Oh My Zsh -labels: 'Feature' +labels: ["Feature"] body: + - type: markdown + attributes: + value: | + ## Self Check + - Look for similar features in existing [GitHub Issues](https://github.com/ohmyzsh/ohmyzsh/issues?q=is%3Aissue) (open or closed). - type: input attributes: label: If the feature request is for a plugin or theme, specify it here. From 0e41181d547e2f89ffc503a7afc8b0f3991dd1a8 Mon Sep 17 00:00:00 2001 From: Josh Soref <2119212+jsoref@users.noreply.github.com> Date: Wed, 1 Dec 2021 06:20:31 -0500 Subject: [PATCH 251/896] chore: fix spelling errors across the project (#10459) Co-authored-by: Josh Soref --- plugins/aliases/cheatsheet.py | 8 ++++---- plugins/aliases/termcolor.py | 2 +- plugins/bower/bower.plugin.zsh | 8 ++++---- plugins/catimg/catimg.plugin.zsh | 2 +- plugins/catimg/catimg.sh | 2 +- plugins/chucknorris/fortunes/chucknorris | 10 +++++----- plugins/colorize/colorize.plugin.zsh | 2 +- plugins/cpanm/_cpanm | 2 +- plugins/docker-machine/_docker-machine | 6 +++--- plugins/dotnet/dotnet.plugin.zsh | 2 +- plugins/emoji/emoji.plugin.zsh | 2 +- plugins/fastfile/fastfile.plugin.zsh | 12 ++++++------ plugins/fd/README.md | 2 +- plugins/flutter/README.md | 2 +- plugins/fzf/README.md | 2 +- plugins/gitfast/git-completion.bash | 2 +- plugins/grails/grails.plugin.zsh | 2 +- plugins/grunt/grunt.plugin.zsh | 4 ++-- .../history-substring-search.zsh | 4 ++-- plugins/ipfs/_ipfs | 2 +- plugins/iterm2/iterm2.plugin.zsh | 2 +- plugins/jenv/README.md | 2 +- plugins/macos/spotify | 2 +- plugins/mercurial/README.md | 2 +- plugins/npm/README.md | 2 +- plugins/pep8/_pep8 | 2 +- plugins/please/README.md | 2 +- plugins/pm2/_pm2 | 4 ++-- plugins/powify/_powify | 2 +- plugins/rake/rake.plugin.zsh | 2 +- plugins/rebar/_rebar | 2 +- plugins/redis-cli/_redis-cli | 10 +++++----- plugins/salt/_salt | 2 +- plugins/scala/_scala | 2 +- plugins/sfdx/_sfdx | 2 +- plugins/sprunge/README.md | 2 +- plugins/supervisor/_supervisorctl | 10 +++++----- plugins/supervisor/supervisor.plugin.zsh | 2 +- plugins/suse/README.md | 2 +- plugins/symfony2/README.md | 2 +- plugins/systemadmin/systemadmin.plugin.zsh | 4 ++-- plugins/terminitor/_terminitor | 2 +- plugins/ubuntu/README.md | 2 +- plugins/vault/_vault | 4 ++-- plugins/yarn/_yarn | 2 +- plugins/yum/yum.plugin.zsh | 2 +- themes/dallas.zsh-theme | 2 +- themes/essembeh.zsh-theme | 2 +- themes/nicoulaj.zsh-theme | 2 +- 49 files changed, 79 insertions(+), 79 deletions(-) diff --git a/plugins/aliases/cheatsheet.py b/plugins/aliases/cheatsheet.py index d6d507b92..694afd31c 100644 --- a/plugins/aliases/cheatsheet.py +++ b/plugins/aliases/cheatsheet.py @@ -26,16 +26,16 @@ def cheatsheet(lines): target_aliases.extend(group_list) return cheatsheet -def pretty_print_group(key, aliases, hightlight=None): +def pretty_print_group(key, aliases, highlight=None): if len(aliases) == 0: return group_hl_formatter = lambda g, hl: termcolor.colored(hl, 'yellow').join([termcolor.colored(part, 'red') for part in ('[%s]' % g).split(hl)]) alias_hl_formatter = lambda alias, hl: termcolor.colored(hl, 'yellow').join([termcolor.colored(part, 'green') for part in ('\t%s = %s' % alias[0:2]).split(hl)]) group_formatter = lambda g: termcolor.colored('[%s]' % g, 'red') alias_formatter = lambda alias: termcolor.colored('\t%s = %s' % alias[0:2], 'green') - if hightlight and len(hightlight)>0: - print (group_hl_formatter(key, hightlight)) - print ('\n'.join([alias_hl_formatter(alias, hightlight) for alias in aliases])) + if highlight and len(highlight)>0: + print (group_hl_formatter(key, highlight)) + print ('\n'.join([alias_hl_formatter(alias, highlight) for alias in aliases])) else: print (group_formatter(key)) print ('\n'.join([alias_formatter(alias) for alias in aliases])) diff --git a/plugins/aliases/termcolor.py b/plugins/aliases/termcolor.py index f11b824b2..bb725e905 100644 --- a/plugins/aliases/termcolor.py +++ b/plugins/aliases/termcolor.py @@ -21,7 +21,7 @@ # # Author: Konstantin Lepa -"""ANSII Color formatting for output in terminal.""" +"""ANSI Color formatting for output in terminal.""" from __future__ import print_function import os diff --git a/plugins/bower/bower.plugin.zsh b/plugins/bower/bower.plugin.zsh index 3a40b3af0..c4f71c2ae 100644 --- a/plugins/bower/bower.plugin.zsh +++ b/plugins/bower/bower.plugin.zsh @@ -9,7 +9,7 @@ _bower_installed_packages () { } _bower () { - local -a _1st_arguments _no_color _dopts _save_dev _force_lastest _production + local -a _1st_arguments _no_color _dopts _save_dev _force_latest _production local expl typeset -A opt_args @@ -22,7 +22,7 @@ _bower () _save_dev=('(--save-dev)--save-dev[Save installed packages into the project"s bower.json devDependencies]') - _force_lastest=('(--force-latest)--force-latest[Force latest version on conflict]') + _force_latest=('(--force-latest)--force-latest[Force latest version on conflict]') _production=('(--production)--production[Do not install project devDependencies]') @@ -54,7 +54,7 @@ _bower () _arguments \ $_dopts \ $_save_dev \ - $_force_lastest \ + $_force_latest \ $_no_color \ $_production ;; @@ -62,7 +62,7 @@ _bower () _arguments \ $_dopts \ $_no_color \ - $_force_lastest + $_force_latest _bower_installed_packages compadd "$@" $(echo $bower_package_list) ;; diff --git a/plugins/catimg/catimg.plugin.zsh b/plugins/catimg/catimg.plugin.zsh index ca46444cc..f4ff6f856 100644 --- a/plugins/catimg/catimg.plugin.zsh +++ b/plugins/catimg/catimg.plugin.zsh @@ -2,7 +2,7 @@ # catimg script by Eduardo San Martin Morote aka Posva # # https://posva.net # # # -# Ouput the content of an image to the stdout using the 256 colors of the # +# Output the content of an image to the stdout using the 256 colors of the # # terminal. # # GitHub: https://github.com/posva/catimg # ################################################################################ diff --git a/plugins/catimg/catimg.sh b/plugins/catimg/catimg.sh index 713a03291..f58392428 100644 --- a/plugins/catimg/catimg.sh +++ b/plugins/catimg/catimg.sh @@ -2,7 +2,7 @@ # catimg script by Eduardo San Martin Morote aka Posva # # https://posva.net # # # -# Ouput the content of an image to the stdout using the 256 colors of the # +# Output the content of an image to the stdout using the 256 colors of the # # terminal. # # GitHub: https://github.com/posva/catimg # ################################################################################ diff --git a/plugins/chucknorris/fortunes/chucknorris b/plugins/chucknorris/fortunes/chucknorris index 6ba5bb9b5..9e36ce89a 100644 --- a/plugins/chucknorris/fortunes/chucknorris +++ b/plugins/chucknorris/fortunes/chucknorris @@ -228,7 +228,7 @@ Chuck Norris once punched the ground to stop an earthquake. The resulting afters % Chuck Norris once round-house kicked a salesman. Over the phone. % -Chuck Norris once rounhouse kicked a football. The astronomical society now considers it a planet. +Chuck Norris once roundhouse kicked a football. The astronomical society now considers it a planet. % Chuck Norris once thought he was wrong. He was, however, mistaken. % @@ -342,7 +342,7 @@ Every time there's an earthquake, you know Chuck Norris is hungry. The earthquak % Evolution's driving mechanism is nature's desperate attempt to escape Chuck Norris. % -Fear of spiders is arachnaphobia. Fear of tight spaces is claustrophobia. Fear of Chuck Norris is called Logic. +Fear of spiders is arachnophobia. Fear of tight spaces is claustrophobia. Fear of Chuck Norris is called Logic. % Fool me once, shame on you. Fool Chuck Norris once and he will roundhouse you in the face. % @@ -426,7 +426,7 @@ Some people ask for a Kleenex when they sneeze, Chuck Norris asks for a body bag % Someone once videotaped Chuck Norris getting pissed off. It was called Walker: Texas Chain Saw Massacre. % -Staring at Chuck Norris for extended periods of time without proper eye protection will cause blindess, and possibly foot sized brusies on the face. +Staring at Chuck Norris for extended periods of time without proper eye protection will cause blindness, and possibly foot sized bruises on the face. % Taking Karate Lessons = $100, Buying MMA DVD's = $150, Subscribing to a UFC event = $50, Getting a Roundhouse Kick from Chuck Norris = PRICELESS. % @@ -452,7 +452,7 @@ The best part of waking up is not Folgers in your cup. it's knowing that Chuck N % The chief export of Chuck Norris is pain. % -The dictionary references Chuck Norris several times, he is metioned under Fear, Law, Order and Chucktatorship. +The dictionary references Chuck Norris several times, he is mentioned under Fear, Law, Order and Chucktatorship. % The leading causes of death in the United States are: 1. Heart Disease 2. Chuck Norris 3. Cancer. % @@ -468,7 +468,7 @@ The only way sharks will come near CN underwater is when CN is inside of a cage. % The only word that rhymes with orange is Chuck Norris. % -The producers of the movie "The Last Airbender" are now in talks with Chuck Norris in Order to star him in their next sequal "The Last Skull Bender". +The producers of the movie "The Last Airbender" are now in talks with Chuck Norris in Order to star him in their next sequel "The Last Skull Bender". % The quickest way to a man's heart is with Chuck Norris' fist. % diff --git a/plugins/colorize/colorize.plugin.zsh b/plugins/colorize/colorize.plugin.zsh index 8ea98f80a..a9da6cf83 100644 --- a/plugins/colorize/colorize.plugin.zsh +++ b/plugins/colorize/colorize.plugin.zsh @@ -82,7 +82,7 @@ colorize_less() { # This variable tells less to pipe every file through the specified command # (see the man page of less INPUT PREPROCESSOR). # 'zsh -ic "colorize_cat %s 2> /dev/null"' would not work for huge files like - # the ~/.zsh_history. For such files the tty of the preprocessor will be supended. + # the ~/.zsh_history. For such files the tty of the preprocessor will be suspended. # Therefore we must source this file to make colorize_cat available in the # preprocessor without the interactive mode. # `2>/dev/null` will suppress the error for large files 'broken pipe' of the python diff --git a/plugins/cpanm/_cpanm b/plugins/cpanm/_cpanm index ff9ae1c15..f328dd997 100644 --- a/plugins/cpanm/_cpanm +++ b/plugins/cpanm/_cpanm @@ -36,7 +36,7 @@ arguments=( '--reinstall[Reinstall the distribution even if you already have the latest version installed]' '--interactive[Turn on interactive configure]' - '--scandeps[Scan the depencencies of given modules and output the tree in a text format]' + '--scandeps[Scan the dependencies of given modules and output the tree in a text format]' '--format[Specify what format to display the scanned dependency tree]:scandeps format:(tree json yaml dists)' '--save-dists[Specify the optional directory path to copy downloaded tarballs]' diff --git a/plugins/docker-machine/_docker-machine b/plugins/docker-machine/_docker-machine index 7c19ba8e7..fbd36d7c6 100644 --- a/plugins/docker-machine/_docker-machine +++ b/plugins/docker-machine/_docker-machine @@ -90,7 +90,7 @@ __docker-machine_filters() { } __get_swarm_discovery() { - declare -a masters serivces + declare -a masters services local service services=() masters=($(docker-machine ls -f {{.Swarm}} |grep '(master)' |awk '{print $1}')) @@ -169,7 +169,7 @@ __get_create_argument() { __docker-machine_subcommand() { local -a opts_help opts_help=("(- :)--help[Print usage]") - local -a opts_only_host opts_driver opts_storage_driver opts_stragery + local -a opts_only_host opts_driver opts_storage_driver opts_state opts_only_host=( "$opts_help" "*:host:__docker-machine_hosts_all" @@ -330,7 +330,7 @@ _docker-machine() { _arguments -C \ "(- :)"{-h,--help}"[Show help]" \ "(-D --debug)"{-D,--debug}"[Enable debug mode]" \ - '(-s --stroage-path)'{-s,--storage-path}'[Configures storage path]:file:_files' \ + '(-s --storage-path)'{-s,--storage-path}'[Configures storage path]:file:_files' \ '--tls-ca-cert[CA to verify remotes against]:file:_files' \ '--tls-ca-key[Private key to generate certificates]:file:_files' \ '--tls-client-cert[Client cert to use for TLS]:file:_files' \ diff --git a/plugins/dotnet/dotnet.plugin.zsh b/plugins/dotnet/dotnet.plugin.zsh index 5bc1587c5..8ea31cdbd 100644 --- a/plugins/dotnet/dotnet.plugin.zsh +++ b/plugins/dotnet/dotnet.plugin.zsh @@ -12,7 +12,7 @@ _dotnet_zsh_complete() return fi - # This is not a variable assigment, don't remove spaces! + # This is not a variable assignment, don't remove spaces! _values = "${(ps:\n:)completions}" } diff --git a/plugins/emoji/emoji.plugin.zsh b/plugins/emoji/emoji.plugin.zsh index 7876f1c89..f70e09320 100644 --- a/plugins/emoji/emoji.plugin.zsh +++ b/plugins/emoji/emoji.plugin.zsh @@ -20,7 +20,7 @@ unset _omz_emoji_plugin_dir # These additional emoji are not in the definition file, but are useful in conjunction with it -# This is a combinin character that can be placed after any other character to surround +# This is a combining character that can be placed after any other character to surround # it in a "keycap" symbol. # The digits 0-9 are already in the emoji table as keycap_digit_, keycap_ten, etc. # It's unclear whether this should be in the $emoji array, because those characters are all ones diff --git a/plugins/fastfile/fastfile.plugin.zsh b/plugins/fastfile/fastfile.plugin.zsh index ccbbce3b2..6288bb275 100644 --- a/plugins/fastfile/fastfile.plugin.zsh +++ b/plugins/fastfile/fastfile.plugin.zsh @@ -18,7 +18,7 @@ default fastfile_var_prefix "§" # 1. name - The name of the shortcut (default: name of the file) # 2. file - The file or directory to make the shortcut for # STDOUT: -# => fastfle_print +# => fastfile_print # function fastfile() { test "$2" || 2="." @@ -75,14 +75,14 @@ function fastfile_print() { # List all shortcuts # # STDOUT: -# (=> fastfle_print) for each shortcut +# (=> fastfile_print) for each shortcut # function fastfile_ls() { for f in "${fastfile_dir}"/*(NF); do - file=`basename "$f"` # To enable simpler handeling of spaces in file names + file=`basename "$f"` # To enable simpler handling of spaces in file names varkey=`echo "$file" | tr " " "_"` - # Special format for colums + # Special format for columns echo "${fastfile_var_prefix}${varkey}|->|$(fastfile_get "$file")" done | column -t -s "|" } @@ -93,7 +93,7 @@ function fastfile_ls() { # Arguments: # 1. name - The name of the shortcut (default: name of the file) # STDOUT: -# => fastfle_print +# => fastfile_print # function fastfile_rm() { fastfile_print "$1" @@ -105,7 +105,7 @@ function fastfile_rm() { # function fastfile_sync() { for f in "${fastfile_dir}"/*(NF); do - file=`basename "$f"` # To enable simpler handeling of spaces in file names + file=`basename "$f"` # To enable simpler handling of spaces in file names varkey=`echo "$file" | tr " " "_"` alias -g "${fastfile_var_prefix}${varkey}"="'$(fastfile_get "$file")'" diff --git a/plugins/fd/README.md b/plugins/fd/README.md index aabd624b8..4d9cf190f 100644 --- a/plugins/fd/README.md +++ b/plugins/fd/README.md @@ -10,4 +10,4 @@ plugins=(... fd) Completion is taken from the fd release [`7.3.0`](https://github.com/sharkdp/fd/releases/tag/v7.3.0). -Updated on Febrary 13th, 2019. +Updated on February 13th, 2019. diff --git a/plugins/flutter/README.md b/plugins/flutter/README.md index be419144f..9c8169afc 100644 --- a/plugins/flutter/README.md +++ b/plugins/flutter/README.md @@ -18,4 +18,4 @@ plugins=(... flutter) | `flb` | `flutter build` | Build flutter application | | `flattach` | `flutter attach` | Attaches flutter to a running flutter application with enabled observatory | | `flget` | `flutter packages get` | Installs dependencies | -| `flc` | `flutter clean` | Cleans flutter porject | +| `flc` | `flutter clean` | Cleans flutter project | diff --git a/plugins/fzf/README.md b/plugins/fzf/README.md index 791a3eb6f..15d4d31f3 100644 --- a/plugins/fzf/README.md +++ b/plugins/fzf/README.md @@ -26,7 +26,7 @@ export FZF_BASE=/path/to/fzf/install/dir Set default command to use when input is tty: ```zsh -export FZF_DEFAULT_COMMAND='' +export FZF_DEFAULT_COMMAND='' ``` If not set, the plugin will try to set it to these, in the order in which they're found: diff --git a/plugins/gitfast/git-completion.bash b/plugins/gitfast/git-completion.bash index 4497a294f..f7b09b2c1 100644 --- a/plugins/gitfast/git-completion.bash +++ b/plugins/gitfast/git-completion.bash @@ -3383,7 +3383,7 @@ _git_worktree () # Here we are not completing an --option, it's either the # path or a ref. case "$prev" in - -b|-B) # Complete refs for branch to be created/reseted. + -b|-B) # Complete refs for branch to be created/reset. __git_complete_refs ;; -*) # The previous word is an -o|--option without an diff --git a/plugins/grails/grails.plugin.zsh b/plugins/grails/grails.plugin.zsh index 11777738c..ddc257428 100644 --- a/plugins/grails/grails.plugin.zsh +++ b/plugins/grails/grails.plugin.zsh @@ -1,5 +1,5 @@ _enumerateGrailsScripts() { - # Default directoryies + # Default directories directories=($GRAILS_HOME/scripts ~/.grails/scripts ./scripts) # Check all of the plugins directories, if they exist diff --git a/plugins/grunt/grunt.plugin.zsh b/plugins/grunt/grunt.plugin.zsh index 3f9695177..a89469a59 100644 --- a/plugins/grunt/grunt.plugin.zsh +++ b/plugins/grunt/grunt.plugin.zsh @@ -82,7 +82,7 @@ function __grunt() { update_msg=' (cache updated)' fi - # Make optioins completion. + # Make options completion. if [[ ${#__grunt_opts} -gt 0 ]]; then opts+=("${__grunt_opts[@]}") fi @@ -161,7 +161,7 @@ function __grunt_update_cache() { fi if [[ $is_updating -ne 0 ]]; then - # Update caceh. + # Update cache. __grunt_version=$version __grunt_gruntfile=$gruntfile is_updating=1 diff --git a/plugins/history-substring-search/history-substring-search.zsh b/plugins/history-substring-search/history-substring-search.zsh index a791cc4da..c326778d4 100644 --- a/plugins/history-substring-search/history-substring-search.zsh +++ b/plugins/history-substring-search/history-substring-search.zsh @@ -243,8 +243,8 @@ _history-substring-search-begin() { fi # - # Escape and join query parts with wildcard character '*' as seperator - # `(j:CHAR:)` join array to string with CHAR as seperator + # Escape and join query parts with wildcard character '*' as separator + # `(j:CHAR:)` join array to string with CHAR as separator # local search_pattern="*${(j:*:)_history_substring_search_query_parts[@]//(#m)[\][()|\\*?#<>~^]/\\$MATCH}*" diff --git a/plugins/ipfs/_ipfs b/plugins/ipfs/_ipfs index 9ee8bd79c..90c0a61c8 100644 --- a/plugins/ipfs/_ipfs +++ b/plugins/ipfs/_ipfs @@ -596,7 +596,7 @@ case $MAIN_SUBCOMMAND in '(-v --headers)'{-v,--headers}'[Print table headers (Hash, Size, Name).]' \ '--resolve-type[Resolve linked objects to find out their types. Default: true.]' \ '--size[Resolve linked objects to find out their file size. Default: true.]' \ - '(-s --stream)'{-s,--stream}'[Enable exprimental streaming of directory entries as they are traversed.]' \ + '(-s --stream)'{-s,--stream}'[Enable experimental streaming of directory entries as they are traversed.]' \ ;; (mount) _arguments \ diff --git a/plugins/iterm2/iterm2.plugin.zsh b/plugins/iterm2/iterm2.plugin.zsh index e4ac72ee3..9d8e40bf6 100644 --- a/plugins/iterm2/iterm2.plugin.zsh +++ b/plugins/iterm2/iterm2.plugin.zsh @@ -8,7 +8,7 @@ if [[ "$OSTYPE" == darwin* ]] && [[ -n "$ITERM_SESSION_ID" ]] ; then ### - # Executes an arbitrary iTerm2 command via an escape code sequce. + # Executes an arbitrary iTerm2 command via an escape code sequence. # See https://iterm2.com/documentation-escape-codes.html for all supported commands. # Example: $ _iterm2_command "1337;StealFocus" function _iterm2_command() { diff --git a/plugins/jenv/README.md b/plugins/jenv/README.md index c043c626e..148794197 100644 --- a/plugins/jenv/README.md +++ b/plugins/jenv/README.md @@ -1,6 +1,6 @@ # jenv plugin -[jenv](https://www.jenv.be/) is a Java version manager similiar to [rbenv](https://github.com/rbenv/rbenv) +[jenv](https://www.jenv.be/) is a Java version manager similar to [rbenv](https://github.com/rbenv/rbenv) and [pyenv](https://github.com/yyuu/pyenv). This plugin initializes jenv and provides the `jenv_prompt_info` function to add Java diff --git a/plugins/macos/spotify b/plugins/macos/spotify index 663215a74..491a60686 100644 --- a/plugins/macos/spotify +++ b/plugins/macos/spotify @@ -191,7 +191,7 @@ while [ $# -gt 0 ]; do -d "grant_type=client_credentials" \ ) if ! [[ "${SPOTIFY_TOKEN_RESPONSE_DATA}" =~ "access_token" ]]; then - cecho "Autorization failed, please check ${USER_CONFG_FILE}" + cecho "Authorization failed, please check ${USER_CONFG_FILE}" cecho "${SPOTIFY_TOKEN_RESPONSE_DATA}" showAPIHelp return 1 diff --git a/plugins/mercurial/README.md b/plugins/mercurial/README.md index 756964896..4beee0a95 100644 --- a/plugins/mercurial/README.md +++ b/plugins/mercurial/README.md @@ -61,7 +61,7 @@ ZSH_THEME_HG_PROMPT_CLEAN="%{$fg[magenta]%})" This is the same as git plugin does. **Note**: additional changes to `.zshrc`, or using a theme designed to use `hg_prompt_info`, are required in order for this to work. -## Mantainers +## Maintainers - [ptrv](https://github.com/ptrv): original creator - [oshybystyi](https://github.com/oshybystyi) diff --git a/plugins/npm/README.md b/plugins/npm/README.md index 47d153619..e970c3c7a 100644 --- a/plugins/npm/README.md +++ b/plugins/npm/README.md @@ -10,7 +10,7 @@ plugins=(... npm) ## Aliases -| Alias | Command | Descripton | +| Alias | Command | Description | |:------ |:-----------------------------|:----------------------------------------------------------------| | `npmg` | `npm i -g` | Install dependencies globally | | `npmS` | `npm i -S` | Install and save to dependencies in your package.json | diff --git a/plugins/pep8/_pep8 b/plugins/pep8/_pep8 index ce19951dc..27b7fc544 100644 --- a/plugins/pep8/_pep8 +++ b/plugins/pep8/_pep8 @@ -29,6 +29,6 @@ _arguments -s -S \ "--max-line-length[set maximum allowed line length (default: 79)]::n:_files" \ "--format[set the error format \[default|pylint|\]]::format:_files" \ "--diff[report only lines changed according to the unified diff received on STDIN]" \ - "--benchmark[measure processing speed are read from the \[pep8\] section of the tox.ini fg file located in any parent folder of the path(s) llowed options are: exclude, filename, select, ngth, count, format, quiet, show-pep8, show-source, .]" \ + "--benchmark[measure processing speed are read from the \[pep8\] section of the tox.ini fg file located in any parent folder of the path(s) allowed options are: exclude, filename, select, ngth, count, format, quiet, show-pep8, show-source, .]" \ "--config[user config file location (default: /home/gsemet/.config/pep8)]::path:_files" \ "*::args:_files" diff --git a/plugins/please/README.md b/plugins/please/README.md index 89bfbf105..0a33f897b 100644 --- a/plugins/please/README.md +++ b/plugins/please/README.md @@ -1,7 +1,7 @@ # please plugin [Please](https://please.build) is a cross-language build system with an emphasis on -high performance, extensibility and reproduceability. It supports a number of popular +high performance, extensibility and reproducibility. It supports a number of popular languages and can automate nearly any aspect of your build process. This plugin adds autocomplete and major aliases for `plz`, the command line tool for diff --git a/plugins/pm2/_pm2 b/plugins/pm2/_pm2 index 6f1e89df5..86412aef1 100644 --- a/plugins/pm2/_pm2 +++ b/plugins/pm2/_pm2 @@ -124,7 +124,7 @@ logs_options=( '--out[only shows standard output]' '--lines[output the last N lines, instead of the last 15 by default]' '--timestamp[add timestamps (default format YYYY-MM-DD-HH:mm:ss)]' - '--nostream[print logs without lauching the log stream]' + '--nostream[print logs without launching the log stream]' '(-h --help)'{-h,--help}'[output usage information]' $id_all_comp ) @@ -139,7 +139,7 @@ case "$words[1]" in stop|restart|delete|reload|reset) _arguments $id_all_comp && return 0 ;; - env|inspect|monitor|unmonitor|discribe) + env|inspect|monitor|unmonitor|describe) _arguments $id_comp && return 0 ;; deploy|startOrRestart|startOrReload) diff --git a/plugins/powify/_powify b/plugins/powify/_powify index 9507f400e..57042aa63 100644 --- a/plugins/powify/_powify +++ b/plugins/powify/_powify @@ -15,7 +15,7 @@ _1st_arguments=( 'restart:restarts the pow app linked to the current directory' 'always_restart:reload the pow app after each request' 'always_restart_off:do not reload the pow app after each request' - 'rename:rename the current pow app to [NAME] or renmae [OLD] to [NEW]' + 'rename:rename the current pow app to [NAME] or rename [OLD] to [NEW]' 'environment:run the this pow app in a different environment (aliased `env`)' 'browse:opens and navigates the default browser to this app' 'logs:tail the application logs' diff --git a/plugins/rake/rake.plugin.zsh b/plugins/rake/rake.plugin.zsh index 121150017..3ceb20fea 100644 --- a/plugins/rake/rake.plugin.zsh +++ b/plugins/rake/rake.plugin.zsh @@ -2,7 +2,7 @@ # over the years. We will miss you dearly. alias jimweirich="rake" -alias rake="noglob rake" # allows square brackts for rake task invocation +alias rake="noglob rake" # allows square brackets for rake task invocation alias brake='noglob bundle exec rake' # execute the bundled rake gem alias srake='noglob sudo rake' # noglob must come before sudo alias sbrake='noglob sudo bundle exec rake' # altogether now ... diff --git a/plugins/rebar/_rebar b/plugins/rebar/_rebar index 7ac5a510c..ea0d8a674 100644 --- a/plugins/rebar/_rebar +++ b/plugins/rebar/_rebar @@ -32,7 +32,7 @@ _rebar () { 'create[Create skel based on template and vars]' \ 'create-app[Create simple app skel]' \ 'create-node[Create simple node skel]' \ - 'list-template[List avaiavle templates]' \ + 'list-template[List available templates]' \ 'doc[Generate Erlang program documentation]' \ 'check-deps[Display to be fetched dependencies]' \ 'get-deps[Fetch dependencies]' \ diff --git a/plugins/redis-cli/_redis-cli b/plugins/redis-cli/_redis-cli index 1569f2916..f93624565 100644 --- a/plugins/redis-cli/_redis-cli +++ b/plugins/redis-cli/_redis-cli @@ -8,7 +8,7 @@ _1st_arguments=( 'append:append a value to a key' 'auth:authenticate to the server' 'bgrewriteeaof:asynchronously rewrite the append-only file' - 'bgsave:asynchornously save the dataset to disk' + 'bgsave:asynchronously save the dataset to disk' 'blpop:remove and get the first element in a list, or block until one is available' 'brpop:remove and get the last element in a list, or block until one is available' 'brpoplpush:pop a value from a list, push it to another list and return it; or block until one is available' @@ -17,9 +17,9 @@ _1st_arguments=( # 'config resetstat: reset the stats returned by INFO' 'dbsize:return the number of keys in the selected database' # 'debug object:get debugging information about a key' - # 'debug setgfault:make the server crash' + # 'debug segfault:make the server crash' 'decr:decrement the integer value of a key by one' - 'decrby:decrement the integet value of a key by the given number' + 'decrby:decrement the integer value of a key by the given number' 'del:delete a key' 'discard:discard all commands issued after MULTI' 'echo:echo the given string' @@ -63,7 +63,7 @@ _1st_arguments=( 'mget:get the values of all the given keys' 'monitor:listen for all requests received by the server in real time' 'move:move a key to another database' - 'mset:set multiple keys to muliple values' + 'mset:set multiple keys to multiple values' 'msetnx:set multiple keys tom ultiple values, only if none of the keys exist' 'multi:mark the start of a transaction block' 'object:inspect the internals of Redis objects' @@ -122,7 +122,7 @@ _1st_arguments=( 'zrem:remove a member from a sorted set' 'zremrangebyrank:remove all members in a sorted set within the given indexes' 'zremrangebyscore:remove all members in a sorted set within the given scores' - 'zrevrange:return a range of membrs in a sorted set, by index, with scores ordered from high to low' + 'zrevrange:return a range of members in a sorted set, by index, with scores ordered from high to low' 'zrevrangebyscore:return a range of members in a sorted set, by score, with scores ordered from high to low' 'zrevrank:determine the index of a member in a sorted set, with scores ordered from high to low' 'zscore:get the score associated with the given member in a sorted set' diff --git a/plugins/salt/_salt b/plugins/salt/_salt index 78d8611d2..a1c55f350 100644 --- a/plugins/salt/_salt +++ b/plugins/salt/_salt @@ -145,7 +145,7 @@ _master_options=( '(-v --verbose)'{-v,--verbose}'[Turn on command verbosity, display jid and active job queries]' '--hide-timeout[Hide minions that timeout]' '(-b --batch --batch-size)'{-b,--batch,--batch-size}'[Execute the salt job in batch mode, pass number or percentage to batch.]:Batch Size:' - '(-a --auth --eauth --extrenal-auth)'{-a,--auth,--eauth,--external-auth}'[Specify an external authentication system to use.]:eauth:' + '(-a --auth --eauth --external-auth)'{-a,--auth,--eauth,--external-auth}'[Specify an external authentication system to use.]:eauth:' '(-T --make-token)'{-T,--make-token}'[Generate and save an authentication token for re-use.]' '--return[Set an alternative return method.]:Returners:_path_files -W "$salt_dir/returners" -g "[^_]*.py(\:r)"' '(-d --doc --documentation)'{-d,--doc,--documentation}'[Return the documentation for the specified module]' diff --git a/plugins/scala/_scala b/plugins/scala/_scala index f7511a647..ba7ac3874 100644 --- a/plugins/scala/_scala +++ b/plugins/scala/_scala @@ -190,7 +190,7 @@ Y_opts=( "-Yshow-symkinds[Print abbreviated symbol kinds next to symbol names]" "-Yshow-trees[Print detailed ASTs (requires -Xprint\:phase)]" "-Yshow-trees-compact[Print detailed ASTs in compact form (requires -Xprint\:)]" - "-Yshow-trees-stringified[Print stringifications along with detailed ASTs (requires -Xprint\:)]" + "-Yshow-trees-stringified[Print stringification along with detailed ASTs (requires -Xprint\:)]" "-Ystatistics[Print compiler statistics]" "-Ystruct-dispatch\:-[Structural method dispatch policy (default\: poly-cache)]:policy name:(no-cache mono-cache poly-cache invoke-dynamic)" diff --git a/plugins/sfdx/_sfdx b/plugins/sfdx/_sfdx index 42ee55970..3a441f257 100644 --- a/plugins/sfdx/_sfdx +++ b/plugins/sfdx/_sfdx @@ -900,7 +900,7 @@ case "$words[1]" in force:data:tree:export) _command_args=( '(-q|--query)'{-q,--query}'[soql query, or filepath of file containing a soql query, to retrieve records]' \ - '(-p|--plan)'{-p,--plan}'[generate mulitple sobject tree files and a plan definition file for aggregated import]' \ + '(-p|--plan)'{-p,--plan}'[generate multiple sobject tree files and a plan definition file for aggregated import]' \ '(-x|--prefix)'{-x,--prefix}'[prefix of generated files]' \ '(-d|--outputdir)'{-d,--outputdir}'[directory to store files]:file:_files' \ '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ diff --git a/plugins/sprunge/README.md b/plugins/sprunge/README.md index 28ed1834a..fb70d42eb 100644 --- a/plugins/sprunge/README.md +++ b/plugins/sprunge/README.md @@ -28,5 +28,5 @@ http://sprunge.us/XxjnKz - Sprunge accepts piped data, stdin redirection, text strings as input or filenames. Only one of these can be used at a time. - Argument precedence goes as follows: stdin > piped input > text strings. -- If a filename is mispelled or doesn't have the necessary path description, it will NOT +- If a filename is misspelled or doesn't have the necessary path description, it will NOT generate an error, but instead treat it as a text string. diff --git a/plugins/supervisor/_supervisorctl b/plugins/supervisor/_supervisorctl index 9f576c0c0..87cffab86 100644 --- a/plugins/supervisor/_supervisorctl +++ b/plugins/supervisor/_supervisorctl @@ -109,27 +109,27 @@ _supervisorctl_maintail() { _supervisorctl_start() { # TODO: add 'all' _arguments -s \ - '*::supvervisor process:_get_supervisor_procs' + '*::supervisor process:_get_supervisor_procs' } (( $+functions[_supervisorctl_restart] )) || _supervisorctl_restart() { # TODO: add 'all' _arguments -s \ - '*::supvervisor process:_get_supervisor_procs' + '*::supervisor process:_get_supervisor_procs' } (( $+functions[_supervisorctl_status] )) || _supervisorctl_status() { _arguments \ - '*::supvervisor process:_get_supervisor_procs' + '*::supervisor process:_get_supervisor_procs' } (( $+functions[_supervisorctl_stop] )) || _supervisorctl_stop() { # TODO: add 'all' _arguments -s \ - '*::supvervisor process:_get_supervisor_procs' + '*::supervisor process:_get_supervisor_procs' } (( $+functions[_supervisorctl_tail] )) || @@ -137,7 +137,7 @@ _supervisorctl_tail() { # TODO: add 'stderr' _arguments -s \ '-f[Continuous tail of named process stdout Ctrl-C to exit.]' \ - '*::supvervisor process:_get_supervisor_procs' + '*::supervisor process:_get_supervisor_procs' } _supervisorctl "$@" diff --git a/plugins/supervisor/supervisor.plugin.zsh b/plugins/supervisor/supervisor.plugin.zsh index f11f0ed3f..ad5430275 100644 --- a/plugins/supervisor/supervisor.plugin.zsh +++ b/plugins/supervisor/supervisor.plugin.zsh @@ -1,4 +1,4 @@ -# DECLARION: This plugin was created by hhatto. What I did is just making a portal from https://bitbucket.org/hhatto/zshcompfunc4supervisor. +# DECLARATION: This plugin was created by hhatto. What I did is just making a portal from https://bitbucket.org/hhatto/zshcompfunc4supervisor. alias sup='sudo supervisorctl' alias supad='sudo supervisorctl add' diff --git a/plugins/suse/README.md b/plugins/suse/README.md index 06c6d9ef5..f37ec1695 100644 --- a/plugins/suse/README.md +++ b/plugins/suse/README.md @@ -62,7 +62,7 @@ plugins=(... suse) NOTE: `--no-refresh` is passed to zypper for speeding up the calls and avoid errors due to lack of root privileges. If you need to refresh the repositories, call `sudo zypper ref` (`zref` alias) -before runing these aliases. +before running these aliases. Related: [#9798](https://github.com/ohmyzsh/ohmyzsh/pull/9798). diff --git a/plugins/symfony2/README.md b/plugins/symfony2/README.md index 2946d0937..76233472f 100644 --- a/plugins/symfony2/README.md +++ b/plugins/symfony2/README.md @@ -17,7 +17,7 @@ plugins=(... symfony2) | `sfsr` | sf server:run | Run the dev server | | `sfcw` | sf cache:warmup | Use the Bundles warmer | | `sfroute` | sf debug:router | Show the different routes | -| `sfcontainer` | sf debug:contaner | List the different services | +| `sfcontainer` | sf debug:container | List the different services | | `sfgb` | sf generate:bundle | Generate a bundle | | `sfgc` | sf generate:controller | Generate a controller | | `sfgcom` | sf generate:command | Generate a command | diff --git a/plugins/systemadmin/systemadmin.plugin.zsh b/plugins/systemadmin/systemadmin.plugin.zsh index 2f9d1ef35..9a2129060 100644 --- a/plugins/systemadmin/systemadmin.plugin.zsh +++ b/plugins/systemadmin/systemadmin.plugin.zsh @@ -27,7 +27,7 @@ alias mkdir='mkdir -pv' # get top process eating memory alias psmem='ps -e -orss=,args= | sort -b -k1 -nr' alias psmem10='ps -e -orss=,args= | sort -b -k1 -nr | head -n 10' -# get top process eating cpu if not work try excute : export LC_ALL='C' +# get top process eating cpu if not work try execute : export LC_ALL='C' alias pscpu='ps -e -o pcpu,cpu,nice,state,cputime,args|sort -k1,1n -nr' alias pscpu10='ps -e -o pcpu,cpu,nice,state,cputime,args|sort -k1,1n -nr | head -n 10' # top10 of the history @@ -105,7 +105,7 @@ visitpage20() { # top100 of Page lists the most time-consuming (more than 60 seconds) as well as the corresponding page number of occurrences consume100() { awk '($NF > 60 && $7~/\.php/){print $7}' "$(retlog)" |sort -n|uniq -c|sort -nr|head -n 100 - # if django website or other webiste make by no suffix language + # if django website or other website make by no suffix language # awk '{print $7}' "$(retlog)" |sort -n|uniq -c|sort -nr|head -n 100 } diff --git a/plugins/terminitor/_terminitor b/plugins/terminitor/_terminitor index 1ce87c3ad..3615350e2 100644 --- a/plugins/terminitor/_terminitor +++ b/plugins/terminitor/_terminitor @@ -11,7 +11,7 @@ local -a _1st_arguments _1st_arguments=( 'create:create a Termfile in directory' 'delete:delete terminitor script' - 'edit:open termitor script' + 'edit:open terminitor script' 'fetch:clone the designated repo and run setup' 'help:Describe available tasks or one specific task' 'init:create initial root terminitor folder' diff --git a/plugins/ubuntu/README.md b/plugins/ubuntu/README.md index f72182f5c..9efef0732 100644 --- a/plugins/ubuntu/README.md +++ b/plugins/ubuntu/README.md @@ -19,7 +19,7 @@ Commands that use `$APT` will use `apt` if installed or defer to `apt-get` other | acp | `apt-cache policy` | Display the package source priorities | | afs | `apt-file search --regexp` | Perform a regular expression apt-file search | | afu | `sudo apt-file update` | Generates or updates the apt-file package database | -| aga | `sudo $APT autoclean` | Clears out the local reposityory of retrieved package files that can no longer be downloaded | +| aga | `sudo $APT autoclean` | Clears out the local repository of retrieved package files that can no longer be downloaded | | agb | `sudo $APT build-dep ` | Installs/Removes packages to satisfy the dependencies of a specified build pkg | | agc | `sudo $APT clean` | Clears out the local repository of retrieved package files leaving everything from the lock files | | agd | `sudo $APT dselect-upgrade` | Follows dselect choices for package installation | diff --git a/plugins/vault/_vault b/plugins/vault/_vault index c5338dffa..f6bd3517e 100644 --- a/plugins/vault/_vault +++ b/plugins/vault/_vault @@ -53,7 +53,7 @@ mount_tune_args=( typeset -a mount_args mount_args=( $mount_tune_args - '(-path)-path=-[Mount point for the logical backend. This defauls to the type of the mount.]:path:' + '(-path)-path=-[Mount point for the logical backend. This defaults to the type of the mount.]:path:' '(-description)-description=-[Human-friendly description of the purpose for the mount. This shows up in the mounts command.]:description:' ) @@ -189,7 +189,7 @@ _vault_mounts() { } _vault_mount() { - # to find out how many types of backens are there + # to find out how many types of backends are there _arguments : \ ${general_args[@]} \ ${mount_args[@]} \ diff --git a/plugins/yarn/_yarn b/plugins/yarn/_yarn index 70ed55929..9173eca20 100644 --- a/plugins/yarn/_yarn +++ b/plugins/yarn/_yarn @@ -157,7 +157,7 @@ _yarn() { '(--emoji)--no-emoji[disable emoji in output]' \ '(--disable-pnp)'{--enable-pnp,--pnp}"[enable the Plug'n'Play installation]" \ '--flat[only allow one version of a package]' \ - '--focus[Focus on a single workspace by installing remote copies of its sibiling workspaces]' \ + '--focus[Focus on a single workspace by installing remote copies of its sibling workspaces]' \ '--force[install and build packages even if they were built before, overwrite lockfile]' \ "--frozen-lockfile[don't generate a lockfile and fail if an update is needed]" \ '--global-folder=[modules folder]:folder:_files -/' \ diff --git a/plugins/yum/yum.plugin.zsh b/plugins/yum/yum.plugin.zsh index 69abfc4ce..d36571133 100644 --- a/plugins/yum/yum.plugin.zsh +++ b/plugins/yum/yum.plugin.zsh @@ -7,7 +7,7 @@ alias ygl="yum grouplist" # list package groups alias yli="yum list installed" # print all installed packages alias ymc="yum makecache" # rebuilds the yum package list -alias yu="sudo yum update" # upgrate packages +alias yu="sudo yum update" # upgrade packages alias yi="sudo yum install" # install package alias ygi="sudo yum groupinstall" # install package group alias yr="sudo yum remove" # remove package diff --git a/themes/dallas.zsh-theme b/themes/dallas.zsh-theme index d6c417fc3..4f8be20d3 100644 --- a/themes/dallas.zsh-theme +++ b/themes/dallas.zsh-theme @@ -9,7 +9,7 @@ DALLAS_CURRENT_MACH_="%{$fg[green]%}%m%{$fg[white]%}:%{$reset_color%}" DALLAS_CURRENT_LOCA_="%{$fg[cyan]%}%~\$(git_prompt_info)%{$reset_color%}\$(parse_git_dirty)" # Grab the current username: dallas DALLAS_CURRENT_USER_="%{$fg[red]%}%n%{$reset_color%}" -# Use a % for normal users and a # for privelaged (root) users. +# Use a % for normal users and a # for privileged (root) users. DALLAS_PROMPT_CHAR_="%{$fg[white]%}%(!.#.%%)%{$reset_color%}" # For the git prompt, use a white @ and blue text for the branch name ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[white]%}@%{$fg[blue]%}" diff --git a/themes/essembeh.zsh-theme b/themes/essembeh.zsh-theme index f34f36f8a..43d4093b1 100644 --- a/themes/essembeh.zsh-theme +++ b/themes/essembeh.zsh-theme @@ -39,7 +39,7 @@ elif [[ -r /etc/debian_chroot ]]; then # prefix prompt in case of chroot ZSH_ESSEMBEH_PREFIX="%{$fg[yellow]%}[chroot:$(cat /etc/debian_chroot)]%{$reset_color%} " elif [[ -r /.dockerenv ]]; then - # also prefix prompt inside a docker contrainer + # also prefix prompt inside a docker container ZSH_ESSEMBEH_PREFIX="%{$fg[yellow]%}[docker]%{$reset_color%} " fi if [[ $UID = 0 ]]; then diff --git a/themes/nicoulaj.zsh-theme b/themes/nicoulaj.zsh-theme index 333aa5e70..685cd1ade 100644 --- a/themes/nicoulaj.zsh-theme +++ b/themes/nicoulaj.zsh-theme @@ -6,7 +6,7 @@ # * Only shows the path on the left prompt by default. # * Crops the path to a defined length and only shows the path relative to # the current VCS repository root. -# * Wears a different color wether the last command succeeded/failed. +# * Wears a different color whether the last command succeeded/failed. # * Shows user@hostname if connected through SSH. # * Shows if logged in as root or not. # ------------------------------------------------------------------------------ From aef393bdce523ed5e5754721965fab2da8080119 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 1 Dec 2021 12:18:32 +0100 Subject: [PATCH 252/896] ci: add `check-spelling` GitHub Action --- .github/actions/spelling/README.md | 15 +++++++++++++ .github/actions/spelling/advice.md | 27 +++++++++++++++++++++++ .github/actions/spelling/allow.txt | 0 .github/actions/spelling/excludes.txt | 17 +++++++++++++++ .github/actions/spelling/expect.txt | 2 ++ .github/actions/spelling/patterns.txt | 4 ++++ .github/actions/spelling/reject.txt | 6 ++++++ .github/workflows/spelling.yml | 31 +++++++++++++++++++++++++++ 8 files changed, 102 insertions(+) create mode 100644 .github/actions/spelling/README.md create mode 100644 .github/actions/spelling/advice.md create mode 100644 .github/actions/spelling/allow.txt create mode 100644 .github/actions/spelling/excludes.txt create mode 100644 .github/actions/spelling/expect.txt create mode 100644 .github/actions/spelling/patterns.txt create mode 100644 .github/actions/spelling/reject.txt create mode 100644 .github/workflows/spelling.yml diff --git a/.github/actions/spelling/README.md b/.github/actions/spelling/README.md new file mode 100644 index 000000000..1bd7d4412 --- /dev/null +++ b/.github/actions/spelling/README.md @@ -0,0 +1,15 @@ +# check-spelling/check-spelling configuration + +| File | Purpose | Format | Info | +| -------------------------------- | -------------------------------------------------------------------------------- | --------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | +| [dictionary.txt](dictionary.txt) | Replacement dictionary (creating this file will override the default dictionary) | one word per line | [dictionary](https://github.com/check-spelling/check-spelling/wiki/Configuration#dictionary) | +| [allow.txt](allow.txt) | Add words to the dictionary | one word per line (only letters and `'`s allowed) | [allow](https://github.com/check-spelling/check-spelling/wiki/Configuration#allow) | +| [reject.txt](reject.txt) | Remove words from the dictionary (after allow) | grep pattern matching whole dictionary words | [reject](https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples%3A-reject) | +| [excludes.txt](excludes.txt) | Files to ignore entirely | perl regular expression | [excludes](https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples%3A-excludes) | +| [only.txt](only.txt) | Only check matching files (applied after excludes) | perl regular expression | [only](https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples%3A-only) | +| [patterns.txt](patterns.txt) | Patterns to ignore from checked lines | perl regular expression (order matters, first match wins) | [patterns](https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples%3A-patterns) | +| [expect.txt](expect.txt) | Expected words that aren't in the dictionary | one word per line (sorted, alphabetically) | [expect](https://github.com/check-spelling/check-spelling/wiki/Configuration#expect) | +| [advice.md](advice.md) | Supplement for GitHub comment when unrecognized words are found | GitHub Markdown | [advice](https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples%3A-advice) | + +Note: you can replace any of these files with a directory by the same name (minus the suffix) +and then include multiple files inside that directory (with that suffix) to merge multiple files together. diff --git a/.github/actions/spelling/advice.md b/.github/actions/spelling/advice.md new file mode 100644 index 000000000..2a32b6520 --- /dev/null +++ b/.github/actions/spelling/advice.md @@ -0,0 +1,27 @@ + +
If you see a bunch of garbage + +If it relates to a ... +
well-formed pattern + +See if there's a [pattern](https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples:-patterns) that would match it. + +If not, try writing one and adding it to the `patterns.txt` file. + +Patterns are Perl 5 Regular Expressions - you can [test]( +https://www.regexplanet.com/advanced/perl/) yours before committing to verify it will match your lines. + +Note that patterns can't match multiline strings. +
+
binary-ish string + +Please add a file path to the `excludes.txt` file instead of just accepting the garbage. + +File paths are Perl 5 Regular Expressions - you can [test]( +https://www.regexplanet.com/advanced/perl/) yours before committing to verify it will match your files. + +`^` refers to the file's path from the root of the repository, so `^README\.md$` would exclude [README.md]( +../tree/HEAD/README.md) (on whichever branch you're using). +
+ +
diff --git a/.github/actions/spelling/allow.txt b/.github/actions/spelling/allow.txt new file mode 100644 index 000000000..e69de29bb diff --git a/.github/actions/spelling/excludes.txt b/.github/actions/spelling/excludes.txt new file mode 100644 index 000000000..ce9f3b99a --- /dev/null +++ b/.github/actions/spelling/excludes.txt @@ -0,0 +1,17 @@ +# See https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples:-excludes +(?:^|/)(?i)COPYRIGHT +(?:^|/)(?i)LICEN[CS]E +(?:^|/)package(?:-lock|)\.json$ +(?:^|/)vendor/ +ignore$ +\.avi$ +\.ico$ +\.jpe?g$ +\.lock$ +\.map$ +\.min\. +\.mod$ +\.mp[34]$ +\.png$ +\.wav$ +^\.github/ diff --git a/.github/actions/spelling/expect.txt b/.github/actions/spelling/expect.txt new file mode 100644 index 000000000..d69fa3882 --- /dev/null +++ b/.github/actions/spelling/expect.txt @@ -0,0 +1,2 @@ +ohmyzsh +oh-my-zsh diff --git a/.github/actions/spelling/patterns.txt b/.github/actions/spelling/patterns.txt new file mode 100644 index 000000000..d39d09e97 --- /dev/null +++ b/.github/actions/spelling/patterns.txt @@ -0,0 +1,4 @@ +# See https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples:-patterns + +# ignore long runs of a single character: +\b([A-Za-z])\g{-1}{3,}\b diff --git a/.github/actions/spelling/reject.txt b/.github/actions/spelling/reject.txt new file mode 100644 index 000000000..67e0ad79b --- /dev/null +++ b/.github/actions/spelling/reject.txt @@ -0,0 +1,6 @@ +^attache$ +occurence +Sorce +^[Ss]pae +^untill +^wether diff --git a/.github/workflows/spelling.yml b/.github/workflows/spelling.yml new file mode 100644 index 000000000..06a8b74c9 --- /dev/null +++ b/.github/workflows/spelling.yml @@ -0,0 +1,31 @@ +name: Spell checking +on: + pull_request_target: + push: + issue_comment: + types: [created] + +jobs: + spelling: + name: Spell checking + runs-on: ubuntu-latest + steps: + - name: checkout-merge + if: "contains(github.event_name, 'pull_request')" + uses: actions/checkout@v2 + with: + ref: refs/pull/${{github.event.pull_request.number}}/merge + - name: checkout + if: ${{ github.event_name == 'push' || + ( + contains(github.event.comment.body, '@check-spelling-bot apply') + ) }} + uses: actions/checkout@v2 + - uses: check-spelling/check-spelling@main + id: spelling + if: ${{ github.event_name != 'issue_comment' || + ( + contains(github.event.comment.body, '@check-spelling-bot apply') + ) }} + with: + experimental_apply_changes_via_bot: 1 From e253661a9b3d8bba3acc90bc06c211f14ab8d587 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 1 Dec 2021 12:25:58 +0100 Subject: [PATCH 253/896] Revert "ci: add `check-spelling` GitHub Action" This reverts commit aef393bdce523ed5e5754721965fab2da8080119. --- .github/actions/spelling/README.md | 15 ------------- .github/actions/spelling/advice.md | 27 ----------------------- .github/actions/spelling/allow.txt | 0 .github/actions/spelling/excludes.txt | 17 --------------- .github/actions/spelling/expect.txt | 2 -- .github/actions/spelling/patterns.txt | 4 ---- .github/actions/spelling/reject.txt | 6 ------ .github/workflows/spelling.yml | 31 --------------------------- 8 files changed, 102 deletions(-) delete mode 100644 .github/actions/spelling/README.md delete mode 100644 .github/actions/spelling/advice.md delete mode 100644 .github/actions/spelling/allow.txt delete mode 100644 .github/actions/spelling/excludes.txt delete mode 100644 .github/actions/spelling/expect.txt delete mode 100644 .github/actions/spelling/patterns.txt delete mode 100644 .github/actions/spelling/reject.txt delete mode 100644 .github/workflows/spelling.yml diff --git a/.github/actions/spelling/README.md b/.github/actions/spelling/README.md deleted file mode 100644 index 1bd7d4412..000000000 --- a/.github/actions/spelling/README.md +++ /dev/null @@ -1,15 +0,0 @@ -# check-spelling/check-spelling configuration - -| File | Purpose | Format | Info | -| -------------------------------- | -------------------------------------------------------------------------------- | --------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | -| [dictionary.txt](dictionary.txt) | Replacement dictionary (creating this file will override the default dictionary) | one word per line | [dictionary](https://github.com/check-spelling/check-spelling/wiki/Configuration#dictionary) | -| [allow.txt](allow.txt) | Add words to the dictionary | one word per line (only letters and `'`s allowed) | [allow](https://github.com/check-spelling/check-spelling/wiki/Configuration#allow) | -| [reject.txt](reject.txt) | Remove words from the dictionary (after allow) | grep pattern matching whole dictionary words | [reject](https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples%3A-reject) | -| [excludes.txt](excludes.txt) | Files to ignore entirely | perl regular expression | [excludes](https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples%3A-excludes) | -| [only.txt](only.txt) | Only check matching files (applied after excludes) | perl regular expression | [only](https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples%3A-only) | -| [patterns.txt](patterns.txt) | Patterns to ignore from checked lines | perl regular expression (order matters, first match wins) | [patterns](https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples%3A-patterns) | -| [expect.txt](expect.txt) | Expected words that aren't in the dictionary | one word per line (sorted, alphabetically) | [expect](https://github.com/check-spelling/check-spelling/wiki/Configuration#expect) | -| [advice.md](advice.md) | Supplement for GitHub comment when unrecognized words are found | GitHub Markdown | [advice](https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples%3A-advice) | - -Note: you can replace any of these files with a directory by the same name (minus the suffix) -and then include multiple files inside that directory (with that suffix) to merge multiple files together. diff --git a/.github/actions/spelling/advice.md b/.github/actions/spelling/advice.md deleted file mode 100644 index 2a32b6520..000000000 --- a/.github/actions/spelling/advice.md +++ /dev/null @@ -1,27 +0,0 @@ - -
If you see a bunch of garbage - -If it relates to a ... -
well-formed pattern - -See if there's a [pattern](https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples:-patterns) that would match it. - -If not, try writing one and adding it to the `patterns.txt` file. - -Patterns are Perl 5 Regular Expressions - you can [test]( -https://www.regexplanet.com/advanced/perl/) yours before committing to verify it will match your lines. - -Note that patterns can't match multiline strings. -
-
binary-ish string - -Please add a file path to the `excludes.txt` file instead of just accepting the garbage. - -File paths are Perl 5 Regular Expressions - you can [test]( -https://www.regexplanet.com/advanced/perl/) yours before committing to verify it will match your files. - -`^` refers to the file's path from the root of the repository, so `^README\.md$` would exclude [README.md]( -../tree/HEAD/README.md) (on whichever branch you're using). -
- -
diff --git a/.github/actions/spelling/allow.txt b/.github/actions/spelling/allow.txt deleted file mode 100644 index e69de29bb..000000000 diff --git a/.github/actions/spelling/excludes.txt b/.github/actions/spelling/excludes.txt deleted file mode 100644 index ce9f3b99a..000000000 --- a/.github/actions/spelling/excludes.txt +++ /dev/null @@ -1,17 +0,0 @@ -# See https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples:-excludes -(?:^|/)(?i)COPYRIGHT -(?:^|/)(?i)LICEN[CS]E -(?:^|/)package(?:-lock|)\.json$ -(?:^|/)vendor/ -ignore$ -\.avi$ -\.ico$ -\.jpe?g$ -\.lock$ -\.map$ -\.min\. -\.mod$ -\.mp[34]$ -\.png$ -\.wav$ -^\.github/ diff --git a/.github/actions/spelling/expect.txt b/.github/actions/spelling/expect.txt deleted file mode 100644 index d69fa3882..000000000 --- a/.github/actions/spelling/expect.txt +++ /dev/null @@ -1,2 +0,0 @@ -ohmyzsh -oh-my-zsh diff --git a/.github/actions/spelling/patterns.txt b/.github/actions/spelling/patterns.txt deleted file mode 100644 index d39d09e97..000000000 --- a/.github/actions/spelling/patterns.txt +++ /dev/null @@ -1,4 +0,0 @@ -# See https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples:-patterns - -# ignore long runs of a single character: -\b([A-Za-z])\g{-1}{3,}\b diff --git a/.github/actions/spelling/reject.txt b/.github/actions/spelling/reject.txt deleted file mode 100644 index 67e0ad79b..000000000 --- a/.github/actions/spelling/reject.txt +++ /dev/null @@ -1,6 +0,0 @@ -^attache$ -occurence -Sorce -^[Ss]pae -^untill -^wether diff --git a/.github/workflows/spelling.yml b/.github/workflows/spelling.yml deleted file mode 100644 index 06a8b74c9..000000000 --- a/.github/workflows/spelling.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: Spell checking -on: - pull_request_target: - push: - issue_comment: - types: [created] - -jobs: - spelling: - name: Spell checking - runs-on: ubuntu-latest - steps: - - name: checkout-merge - if: "contains(github.event_name, 'pull_request')" - uses: actions/checkout@v2 - with: - ref: refs/pull/${{github.event.pull_request.number}}/merge - - name: checkout - if: ${{ github.event_name == 'push' || - ( - contains(github.event.comment.body, '@check-spelling-bot apply') - ) }} - uses: actions/checkout@v2 - - uses: check-spelling/check-spelling@main - id: spelling - if: ${{ github.event_name != 'issue_comment' || - ( - contains(github.event.comment.body, '@check-spelling-bot apply') - ) }} - with: - experimental_apply_changes_via_bot: 1 From c66fc00401a8d6a6bd6da39ec890dfdc0e6bd878 Mon Sep 17 00:00:00 2001 From: Nick Aldwin Date: Wed, 1 Dec 2021 06:44:15 -0500 Subject: [PATCH 254/896] feat(updater): show command to update when update skipped (#10465) --- tools/check_for_upgrade.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh index b6625a395..293f48edf 100644 --- a/tools/check_for_upgrade.sh +++ b/tools/check_for_upgrade.sh @@ -160,7 +160,8 @@ function update_ohmyzsh() { [[ "$option" != $'\n' ]] && echo case "$option" in [yY$'\n']) update_ohmyzsh ;; - [nN]) update_last_updated_file ;; + [nN]) update_last_updated_file ;& + *) echo "[oh-my-zsh] You can update manually by running \`omz update\`" ;; esac fi } From 46e63340eef243f25890e2178931919125c58aae Mon Sep 17 00:00:00 2001 From: whoami Date: Wed, 1 Dec 2021 19:49:42 +0300 Subject: [PATCH 255/896] feat(branch): show mercurial bookmarks if used (#9948) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Marc CornellĂ  --- plugins/branch/README.md | 48 +++++++++++++++++++++----------- plugins/branch/branch.plugin.zsh | 44 ++++++++++++++++------------- 2 files changed, 56 insertions(+), 36 deletions(-) diff --git a/plugins/branch/README.md b/plugins/branch/README.md index 56ab8da4b..a15dd22df 100644 --- a/plugins/branch/README.md +++ b/plugins/branch/README.md @@ -1,31 +1,47 @@ -# Branch +# Branch plugin -Displays the current Git or Mercurial branch fast. +This plugin displays the current Git or Mercurial branch, fast. If in a Mercurial repository, +also display the current bookmark, if present. + +To use it, add `branch` to the plugins array in your zshrc file: + +```zsh +plugins=(... branch) +``` ## Speed test -### Mercurial +- `hg branch`: -```shell -$ time hg branch -0.11s user 0.14s system 70% cpu 0.355 total -``` + ```console + $ time hg branch + 0.11s user 0.14s system 70% cpu 0.355 total + ``` -### Branch plugin +- branch plugin: -```shell -$ time zsh /tmp/branch_prompt_info_test.zsh -0.00s user 0.01s system 78% cpu 0.014 total -``` + ```console + $ time zsh /tmp/branch_prompt_info_test.zsh + 0.00s user 0.01s system 78% cpu 0.014 total + ``` ## Usage -Edit your theme file (eg.: `~/.oh-my-zsh/theme/robbyrussell.zsh-theme`) -adding `$(branch_prompt_info)` in your prompt like this: +Copy your theme to `$ZSH_CUSTOM/themes/` and modify it to add `$(branch_prompt_info)` in your prompt. +This example is for the `robbyrussell` theme: ```diff -- PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' -+ PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)$(branch_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' +diff --git a/themes/robbyrussell.zsh-theme b/themes/robbyrussell.zsh-theme +index 2fd5f2cd..9d89a464 100644 +--- a/themes/robbyrussell.zsh-theme ++++ b/themes/robbyrussell.zsh-theme +@@ -1,5 +1,5 @@ + PROMPT="%(?:%{$fg_bold[green]%}âžś :%{$fg_bold[red]%}âžś )" +-PROMPT+=' %{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info)' ++PROMPT+=' %{$fg[cyan]%}%c%{$reset_color%} $(branch_prompt_info)' + + ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}git:(%{$fg[red]%}" + ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} " ``` ## Maintainer diff --git a/plugins/branch/branch.plugin.zsh b/plugins/branch/branch.plugin.zsh index 2e5659bdf..dd5871fdc 100644 --- a/plugins/branch/branch.plugin.zsh +++ b/plugins/branch/branch.plugin.zsh @@ -3,29 +3,33 @@ # Oct 2, 2015 function branch_prompt_info() { - # Defines path as current directory - local current_dir=$PWD - # While current path is not root path - while [[ $current_dir != '/' ]] - do - # Git repository - if [[ -d "${current_dir}/.git" ]] - then - echo '±' ${"$(<"$current_dir/.git/HEAD")"##*/} - return; + # Start checking in current working directory + local branch="" dir="$PWD" + while [[ "$dir" != '/' ]]; do + # Found .git directory + if [[ -d "${dir}/.git" ]]; then + branch="${"$(<"${dir}/.git/HEAD")"##*/}" + echo '±' "${branch:gs/%/%%}" + return fi - # Mercurial repository - if [[ -d "${current_dir}/.hg" ]] - then - if [[ -f "$current_dir/.hg/branch" ]] - then - echo 'âż' $(<"$current_dir/.hg/branch") + + # Found .hg directory + if [[ -d "${dir}/.hg" ]]; then + if [[ -f "${dir}/.hg/branch" ]]; then + branch="$(<"${dir}/.hg/branch")" else - echo 'âż default' + branch="default" fi - return; + + if [[ -f "${dir}/.hg/bookmarks.current" ]]; then + branch="${branch}/$(<"${dir}/.hg/bookmarks.current")" + fi + + echo 'âż' "${branch:gs/%/%%}" + return fi - # Defines path as parent directory and keeps looking for :) - current_dir="${current_dir:h}" + + # Check parent directory + dir="${dir:h}" done } From 841f3cb0bb7663fa1062ffc59acb7b4581dc1d0f Mon Sep 17 00:00:00 2001 From: Josh Soref <2119212+jsoref@users.noreply.github.com> Date: Thu, 2 Dec 2021 06:17:00 -0500 Subject: [PATCH 256/896] ci: add `check-spelling` action (#10470) Co-authored-by: Josh Soref --- .github/actions/spelling/README.md | 15 + .github/actions/spelling/advice.md | 25 + .github/actions/spelling/allow.txt | 0 .github/actions/spelling/excludes.txt | 41 + .github/actions/spelling/expect.txt | 4489 +++++++++++++++++++++++++ .github/actions/spelling/patterns.txt | 73 + .github/actions/spelling/reject.txt | 7 + .github/workflows/spelling.yml | 95 + 8 files changed, 4745 insertions(+) create mode 100644 .github/actions/spelling/README.md create mode 100644 .github/actions/spelling/advice.md create mode 100644 .github/actions/spelling/allow.txt create mode 100644 .github/actions/spelling/excludes.txt create mode 100644 .github/actions/spelling/expect.txt create mode 100644 .github/actions/spelling/patterns.txt create mode 100644 .github/actions/spelling/reject.txt create mode 100644 .github/workflows/spelling.yml diff --git a/.github/actions/spelling/README.md b/.github/actions/spelling/README.md new file mode 100644 index 000000000..dcd237ba2 --- /dev/null +++ b/.github/actions/spelling/README.md @@ -0,0 +1,15 @@ +# check-spelling/check-spelling configuration + +File | Purpose | Format | Info +-|-|-|- +[dictionary.txt](dictionary.txt) | Replacement dictionary (creating this file will override the default dictionary) | one word per line | [dictionary](https://github.com/check-spelling/check-spelling/wiki/Configuration#dictionary) +[allow.txt](allow.txt) | Add words to the dictionary | one word per line (only letters and `'`s allowed) | [allow](https://github.com/check-spelling/check-spelling/wiki/Configuration#allow) +[reject.txt](reject.txt) | Remove words from the dictionary (after allow) | grep pattern matching whole dictionary words | [reject](https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples%3A-reject) +[excludes.txt](excludes.txt) | Files to ignore entirely | perl regular expression | [excludes](https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples%3A-excludes) +[only.txt](only.txt) | Only check matching files (applied after excludes) | perl regular expression | [only](https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples%3A-only) +[patterns.txt](patterns.txt) | Patterns to ignore from checked lines | perl regular expression (order matters, first match wins) | [patterns](https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples%3A-patterns) +[expect.txt](expect.txt) | Expected words that aren't in the dictionary | one word per line (sorted, alphabetically) | [expect](https://github.com/check-spelling/check-spelling/wiki/Configuration#expect) +[advice.md](advice.md) | Supplement for GitHub comment when unrecognized words are found | GitHub Markdown | [advice](https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples%3A-advice) + +Note: you can replace any of these files with a directory by the same name (minus the suffix) +and then include multiple files inside that directory (with that suffix) to merge multiple files together. diff --git a/.github/actions/spelling/advice.md b/.github/actions/spelling/advice.md new file mode 100644 index 000000000..c83423a8e --- /dev/null +++ b/.github/actions/spelling/advice.md @@ -0,0 +1,25 @@ + +
If the flagged items do not appear to be text + +If items relate to a ... +* well-formed pattern. + + If you can write a [pattern](https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples:-patterns) that would match it, + try adding it to the `patterns.txt` file. + + Patterns are Perl 5 Regular Expressions - you can [test]( +https://www.regexplanet.com/advanced/perl/) yours before committing to verify it will match your lines. + + Note that patterns can't match multiline strings. + +* binary file. + + Please add a file path to the `excludes.txt` file matching the containing file. + + File paths are Perl 5 Regular Expressions - you can [test]( +https://www.regexplanet.com/advanced/perl/) yours before committing to verify it will match your files. + + `^` refers to the file's path from the root of the repository, so `^README\.md$` would exclude [README.md]( +../tree/HEAD/README.md) (on whichever branch you're using). + +
diff --git a/.github/actions/spelling/allow.txt b/.github/actions/spelling/allow.txt new file mode 100644 index 000000000..e69de29bb diff --git a/.github/actions/spelling/excludes.txt b/.github/actions/spelling/excludes.txt new file mode 100644 index 000000000..f1cfeefbb --- /dev/null +++ b/.github/actions/spelling/excludes.txt @@ -0,0 +1,41 @@ +# See https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples:-excludes +(?:^|/)(?i)COPYRIGHT +(?:^|/)(?i)LICEN[CS]E +(?:^|/)package(?:-lock|)\.json$ +(?:^|/)vendor/ +ignore$ +\.avi$ +\.ico$ +\.jpe?g$ +\.lock$ +\.map$ +\.min\.. +\.mod$ +\.mp[34]$ +\.png$ +\.wav$ +^\.github/ +^\Qplugins/archlinux/archlinux.plugin.zsh\E$ +^\Qplugins/cp/cp.plugin.zsh\E$ +^\Qplugins/extract/_extract\E$ +^\Qplugins/genpass/genpass.plugin.zsh\E$ +^\Qplugins/gitignore/gitignore.plugin.zsh\E$ +^\Qplugins/gnu-utils/gnu-utils.plugin.zsh\E$ +^\Qplugins/hitchhiker/fortunes/hitchhiker\E$ +^\Qplugins/jhbuild/jhbuild.plugin.zsh\E$ +^\Qplugins/jhbuild/README.md\E$ +^\Qplugins/jruby/jruby.plugin.zsh\E$ +^\Qplugins/kubectl/kubectl.plugin.zsh\E$ +^\Qplugins/lol/lol.plugin.zsh\E$ +^\Qplugins/mosh/mosh.plugin.zsh\E$ +^\Qplugins/npx/npx.plugin.zsh\E$ +^\Qplugins/powder/_powder\E$ +^\Qplugins/suse/suse.plugin.zsh\E$ +^\Qplugins/thor/_thor\E$ +^\Qplugins/universalarchive/_universalarchive\E$ +^\Qplugins/vagrant/vagrant.plugin.zsh\E$ +^\Qplugins/wp-cli/README.md\E$ +^\Qplugins/wp-cli/wp-cli.plugin.zsh\E$ +^\Qthemes/clean.zsh-theme\E$ +^\Qthemes/philips.zsh-theme\E$ +^\Qthemes/tonotdo.zsh-theme\E$ diff --git a/.github/actions/spelling/expect.txt b/.github/actions/spelling/expect.txt new file mode 100644 index 000000000..fc764f57a --- /dev/null +++ b/.github/actions/spelling/expect.txt @@ -0,0 +1,4489 @@ +AAAAC +aac +aar +abcdefghjkmnpqrstvwxyz +ABRT +absorbgitdirs +abspath +abtvfr +acceptorthreads +accessip +ACDIM +acking +ackmate +ackup +ACLs +acon +aconf +acp +acpi +acpitool +acr +acroread +acs +acsc +acsp +actionformats +Adamantium +adb +adbd +adben +addgroups +addhistory +addon +addprincipals +addrport +addrs +addusergroups +addwin +adelcampo +adg +ADK +adminalias +adminport +Admins +adoc +adu +aeiouy +afh +afind +afmagic +afs +afu +agb +agc +agd +agentpath +agi +agignore +agli +aglu +agnoster +agp +agrimaldi +ags +agu +agud +agug +aguu +AHg +ainv +aip +Airbender +ajp +ajs +Akinori +akoenig +alacritty +albers +alberto +alertmanager +alex +alexandre +aliasfiletype +aliaspassword +allexport +alloc +allocstatus +allownoncomponentcallers +allpkgs +alnum +ALRM +altchar +Altoid +alwayz +amanda +amazonaws +amazonec +ambyj +amd +amqp +AMRD +anche +andi +andrewrdwyer +angularjs +anley +anlp +annots +anonymize +anotherfolder +ansible +antrun +anycommand +apexcodefile +apextests +api +apidocs +apiversion +apjanke +apk +apklib +aplaybook +appid +applica +applist +appname +apps +appup +aps +apull +arachnophobia +araxis +ARCHFLAGS +archimport +archlinux +arci +arcizan +ard +ardc +ardnu +ardnupc +ardp +ardpc +ARGC +args +argset +argslist +argu +argv +ARGZERO +arh +arinit +arl +arli +arpa +arquillian +artifactory +asadmin +asc +asciicast +asciidoc +asciidoctor +asciinema +asdeps +asdf +askpass +asm +asmo +asrc +assem +associatewiththread +ASTs +asyncreplication +atlassian +attr +ATTRIBUTENAME +aufs +auin +auinsd +auloc +auls +aulst +aumir +auown +auownloc +auownls +aur +aure +aurem +aurep +aurinsd +aurph +aurrep +authmethods +authorizationdb +authpriv +authrealmname +authz +autoapplyenabled +autoclean +autocomplete +autocompleted +autocompletion +AUTOCONNECT +autocrlf +autodetermine +autodie +autoenv +autohadboverride +autoipd +autojump +autoload +autolock +autolocking +autopep +AUTOQUIT +autoreload +autoreloading +autoremove +autorun +autoscale +autoscaling +autoselect +autoshortened +autosquash +autostart +autostash +autoupdate +auupd +auupg +availabilityenabled +avh +avi +AVIT +avivrosenberg +avneet +avz +avzu +aws +awscli +awslogs +babakks +backend +backendconfig +backtick +backupconfig +backupdir +backupfile +backuptheme +bactrian +baidu +bamshuf +bamtobed +bamtofastq +Barsi +Basecamp +basedir +basedn +basefile +baseurl +basevmdk +bashcompinit +bashdefault +bashrc +batchid +baz +bazel +bazelbuild +bbd +bbdiff +bbedit +BBM +bbpb +bcc +bcdfghjklmnpqrstvwxz +bck +bcn +bcubc +bcubo +beaglidx +becc +bedcov +BEDGRAPH +BEDPE +bedpetobam +bedtobam +bedtools +Belarus +bem +benchmarker +benchmem +benchtime +bento +benwilcock +berks +Bertinelli +bgnotify +bgrewriteeaof +bgsave +binarynights +bindaddress +binded +bindir +bindkey +binpack +binstub +bintray +bip +bira +bisd +bitboxer +bitbucket +bitswap +blkio +blockprofile +blockprofilerate +blod +blog +blogger +blogspot +blpop +bluebox +Bluetooth +bobwilliams +bodycc +Bonetti +bookmarked +booknames +bootclasspath +bootscript +bootsnipp +borland +borrowck +Boudreau +Boushh +Bouvet +BPtmux +bpython +bqr +brainstormr +Brainville +branchformat +branchname +branchrefs +brewp +brewsp +briancarper +bringz +Broadcom +Brodersen +brpop +brpoplpush +btannous +btih +btn +btrestart +btrfs +btw +bubc +bubu +buf +buffersizebytes +buflines +bugfix +bugfixes +bugreport +bugsnag +Buildfile +buildinstance +buildnumber +buildpackage +buildpacks +buildscript +builtins +bundlephobia +bunzip +Burkina +Busybox +bwaht +Bxegedabagacad +bypjyp +bytebuffertype +bytecode +bytewise +byznis +bzip +bzr +cabextract +CACERT +cacertfile +cacheinfo +cachename +caiifr +Cakefile +cakephp +callvim +calmd +calways +caname +caniuse +cano +capath +Capfile +capify +capistrano +capistranorb +capit +CARETCOLOR +caserta +Caskroom +catimg +catserver +catspeak +cbr +ccat +cccmd +ccflags +ccl +ccomp +ccp +cdargs +cdcmd +cdo +CDPATH +cdu +cdx +cdylib +cecho +cehlrtx +celerybeat +celeryev +celerymon +celeryproject +Celso +celsomiranda +certfile +certname +certs +cfa +cfap +cfbpk +cfbs +cfc +cfdel +cfdm +cfdor +cfds +cfe +cfev +cfg +cfgfile +cfhu +cfl +cflg +cflr +cfp +cfpc +cfpm +cfr +cfsc +cfsh +cfsp +cfsrt +cfsrtall +cfstg +cfstp +cfstpall +cft +cfup +cfus +cget +cgi +cgit +cgr +cgrm +cgroup +cgroupns +cgu +changelog +changepassword +changeset +charmap +charset +chaselinks +chcid +chdir +cheatsheet +checkin +checkinit +checkonly +checkports +checkstyle +cheeseshops +Chesal +chiark +childlogdir +chlrtx +chmod +chown +chpwd +chroot +chruby +chrubydirs +chsh +chucknorris +chucknorrisfacts +Chucktatorship +Chucktober +chunker +cidfile +cidr +CIDs +cidv +ciici +cim +cirw +citool +civis +cjk +clamav +classfile +classloaders +classloading +classmap +classname +classpath +CLDR +cleardump +cless +CLICOLOR +clientauthenabled +clientid +clipcmd +clipcopy +clippaste +Clipperton +clj +Clojure +closelim +cloudfoundry +cloudproviders +CLOUDSDK +clrz +clustertype +cmdargs +cmdline +cmds +Cmp +CMR +cms +cmt +cnorm +cobertura +cocoapods +codebase +codeclimate +codecompare +codecoverage +codegen +codepen +coderwall +CODESET +codium +coffeescript +colemak +Colindres +collectstatic +colorbool +colorcoded +colorcoding +colorify +colorized +colorls +colorpair +colorset +colorspec +colourised +Colouriser +colsearch +COMMANDLINE +commandlinefu +committerdate +Comoros +compadd +comparguments +compassdoc +compaudit +compbiome +compcall +compctl +compdef +compdescribe +compdump +compfiles +compfix +compgen +compgroups +compilemessages +compinit +compl +completemarks +completionsdir +complist +componentname +compopt +compquote +COMPREPLY +COMPRESSSPARSESTATE +compset +compstate +comptags +comptry +compvalues +CONDA +CONFG +config +configfile +confighelp +configmap +configstoretype +connectiondefinition +connectionpoolid +conssec +Consts +contacto +containerd +contenttype +contextinitialization +contextroot +contoroll +contreras +controlargs +conventionalcommits +COOKBOOKNAME +cookbookversion +coproc +copybuffer +copydir +copyfile +copypaste +copypasteable +cordova +coreutil +cors +cowsay +cowthink +cpan +cpanm +cpanminus +cpantesters +cpio +cpp +cprint +cprof +cpuprofile +cpuset +cpv +createcachetable +createdlastdays +createsuperuser +createtables +creationretryattempts +creationretryinterval +cription +crlf +crm +crockford +cron +cronjob +crt +cseuckr +cseucpkdfmtjapanese +csh +csibm +csiso +csisolatin +cskoi +csksc +css +cssflow +cssh +csshiftjis +csu +csv +csvfile +ctag +ctl +ctlseqs +ctx +ctype +culater +Cunha +curcontext +curdir +curhistsize +curkeyword +curpath +currentartist +currentdir +currenttrack +cursored +curtheme +Customisation +CUTBUFFER +cvccvc +cvf +cvhs +cvjf +cvs +cvsexportcommit +cvsimport +cvsserver +cvvis +cvzf +cwd +cword +cxx +cya +cycledleft +cycledright +cygpath +cygstart +cygwin +cygwyn +czf +daemonize +daemonized +daemonizing +daemonset +dalias +dango +danielcsgomes +darcs +dartdoc +dartlang +dashdoc +DATABAGNAME +datafieldenc +datasift +datasourceclassname +datastore +datestamp +datetime +daylerees +dbbolton +dbconsole +dbfile +dbhome +dbhost +dbport +dbshell +dbsize +dburl +dbus +dbuser +dbvendor +dbvendorname +dccmd +dcdn +dce +dck +dcl +dclf +dco +dcom +dcommit +dcps +dcpull +dcr +dcrestart +dcrm +dcstart +dcstop +dcup +dcupb +dcupd +ddg +ddl +deadwyler +debian +debman +debuginfo +debuglevel +decr +decrby +DECSCUSR +defaultleasettl +defaultpackagedir +Defaultsfdx +defaultvs +defaultwebmodule +definitionfile +definitionjson +deinit +deinstall +delwin +denable +deno +dependencyfile +deploydir +deployers +deploymentplan +deps +depthfrom +dequote +dequoted +deref +derek +descr +dest +DESTDIR +destroot +desttype +devcenter +devdocs +devfolder +devicehost +devicemapper +deviceport +devlog +devops +devpath +dfa +dffx +dflt +dfmt +dfs +dhcp +dhcpd +dhcpip +dht +dhtrc +dhtt +diagdump +didexit +diffcore +diffmerge +diffs +diffsettings +difftool +digitalocean +diiirrrty +dijcaf +dircolors +dircycle +direnv +dirhistory +dirname +dirpath +dirpersist +dirs +dirstack +DIRSTACKSIZE +dirstat +dirver +disablemasking +disksize +diskutil +displayconfiguration +displayname +distcache +distcheck +distclean +distro +dists +django +djangojs +djangoproject +djangopypi +djview +djvu +dli +dlist +dls +dman +dmatching +dmesg +dmg +dna +dnf +dnfc +dnfgi +dnfgl +dnfgr +dnfi +dnfl +dnfli +dnfmc +dnfp +dnfr +dnfu +dng +dnote +dns +dnsmasq +dnsrr +doap +docck +dockerd +dockerdaemon +dockerenv +Dockerfile +dockerport +dockersearch +docopt +docset +docstring +doctl +doctorjellyface +dogenpunk +doitclient +domaindir +domainname +domainproperties +domterm +Donenfeld +dongweiming +donotwant +dopts +dotall +dotenv +dotest +dotfile +dotnet +doubledash +doublequotes +dowant +dpkg +drca +drcb +drcg +drcj +drcm +drcml +drcr +drct +drcv +drdmp +dren +dreurmail +drf +drfi +drfr +drfra +drfu +Driessen +drif +dris +driverclassname +drn +drnew +droid +dropandcreatetables +dropindexes +droplr +dropreplace +droptables +drpm +drpu +drst +drup +drush +drushrc +drv +drvd +drvg +drw +dsa +dselect +dsl +dssh +dst +dsupport +Dtest +dtrace +dts +duckduckgo +duf +dumpconfig +dumpdata +dumpfiles +duplessis +durationdays +durrheimer +dutchcoders +dvd +dvi +dwim +dwr +dylib +eal +eastermonday +eauth +ebuild +ecd +ecdsa +echotc +echoti +ecma +ecmerge +ecosia +ecto +editorcmd +edu +eecms +eed +eeval +efforted +efile +eframe +egrep +ein +Eisentraut +ejb +ekzsh +Eley +ELGNRCIS +elidable +elif +elim +elisp +elllen +elot +emacs +emacsclient +emacsfun +emacswiki +emails +emberjs +Emelianenko +emoji +emotty +enablesnoop +enacs +endswith +ent +entrypoint +enum +envsubst +envvar +enwom +eocw +EOH +eol +eoq +eow +eoww +eoy +EPOCHREALTIME +epochseconds +eprof +eread +erl +errlog +Errored +esac +escripts +essembeh +etcd +ethanschoonover +ets +etwlogs +euc +EUID +EULAs +eunit +evals +evalstatus +evan +eventlet +eventname +Evernote +Evt +exe +executables +execv +exfxcxdxbxbxbxbxbxbxbx +exfxcxdxbxegedabagacad +existentials +exitcode +exoscale +expandvars +expaning +expireat +expl +explaintypes +explicitouter +expn +expr +exps +exs +extcmd +extdirs +extendedglob +externalid +extmethods +fabfile +facebook +factoryclass +faidx +failconnection +failfast +failurefatal +fakeroot +faqs +fargs +Faroe +fasd +FASTA +fastcgi +fastfile +fastprint +FASTQ +favlist +fbterm +fcap +Fcart +fcgi +Fcrt +fcss +fdfind +fdlimit +feditor +fedoraproject +felipe +felixr +ffls +ffp +ffrm +ffsync +fghijk +fgrep +Fiala +fieldlist +Filemode +filepath +filesize +filestore +filesystem +filetype +filevaultmaster +FILLBAR +filtername +findpeer +findprovs +finetune +firefox +firewalld +firewalls +firstline +fishshell +fitzpatrick +fixmate +fixme +fixperms +FIXTERM +fizsh +fjs +flagstat +flatlist +flattach +flc +fldoc +flget +flickr +flowgraph +flowtype +flr +fluentd +flup +flushall +flushdb +flv +fnd +fnm +fns +Fnv +Folgers +fontello +foodcritic +foqtam +forall +forceoverwrite +forceupgrade +foreach +forrest +fortunecity +forw +fosmid +fotqoh +fpath +fprof +fqn +framep +frecency +frecent +freebsd +freenode +freqs +fri +Friesel +fromaddress +frontend +frontmost +fsc +fscache +fsck +fsl +fsmonitor +FSsh +fstgpy +ftp +fts +fucnul +func +funcsourcetrace +functrace +funtoo +Futuna +futuret +fwl +fwp +fwr +fwrp +fzf +fzfdirs +gaa +gallifrey +gamc +Gamera +gamscp +gapt +gasconfig +Gatorade +gatsbyjs +gav +gba +gbd +gbda +gbk +gbl +gbnm +gbr +gbs +gbsb +gbsg +gbsr +gca +gcam +gcan +gcasm +gcb +gcc +gccd +gccgo +gccgoflags +gcf +gcflags +gch +gcl +gclean +gcloud +gcm +gcmsg +gcn +gco +gcor +gcount +gcp +gcpa +gcpc +gcplogs +gcr +gcs +gcsm +gcssm +gdc +gdca +gdct +gdcw +gdd +gdm +gdnolock +gdt +gdup +gdv +gdw +geca +gecb +gecho +geclup +gecr +geeknote +gegi +geh +gei +geiall +gelcyv +gelf +geli +gemb +gemfile +gemoji +gemp +gemset +gemspec +gemy +generatekey +generatermistubs +genomecov +genpass +genpaths +genzshcomp +geoe +geoff +geoffgarside +getattr +getbit +getcomposer +getdir +geteip +getenv +getfasta +getgb +getip +getline +getln +getopt +getrange +getset +gettext +geun +gevent +Geza +gezalore +gfa +gfg +gfl +gflf +gflff +gflfp +gflfpll +gflh +gflhf +gflhp +gfli +gflr +gflrf +gflrp +gfo +gga +ggf +ggfl +ggl +ggp +ggpnp +ggpull +ggpur +ggpush +ggsup +ggu +ghci +ghf +ghff +ghfh +ghfr +ghfu +ghh +ghostrevery +gignore +gignored +gimmeh +giobi +gistcomment +gitbranch +gitbranchsize +gitcomp +gitcompadd +gitcompappend +gitcompletion +gitdir +gitex +gitfast +gitflow +github +gitignore +gitinfo +gitk +gitmodules +gitpod +GITSS +gitstatus +gitstring +gitweb +givero +gke +gkrellmd +glfsi +glfsls +glfsmi +glfst +glg +glgg +glgga +glgm +glgp +glidenote +glo +globalias +globals +globbing +globsubst +glods +glog +gloga +glol +glola +glp +gls +gma +gmail +gmom +gmtl +gmtlvim +gmum +Gneat +Gniazdowski +gnore +gnupg +goc +godoc +Godzilla +gof +gofa +gofmt +goga +Gohr +golang +gom +GOMAXPROCS +Gomes +Gonz +goodreads +google +googlecode +gop +gopath +gopb +GOROOT +goroutine +gota +gpf +gpg +gpgconf +gplfs +GPLv +gpoat +gpr +gpristine +gpsup +gpu +gpv +gradle +gradlew +graphviz +grb +grba +grbc +grbd +grbi +grbm +grbo +grbom +grc +greenend +greer +grename +grep +grepping +grev +grh +grhh +GRIMALDI +grk +Grlm +grm +grmc +grml +grmv +groh +grok +Grosenbach +groupby +groupinstall +grouplist +groupremove +groupsmap +growlnotify +grrm +grset +grss +grst +grt +gru +gruntfile +grup +grv +gsb +gsd +gsemet +gsh +gsi +gsps +gsr +gss +gst +gsta +gstaa +gstall +gstc +gstd +gstl +gstp +gstu +gsu +gsub +gsw +gswc +gswd +gswm +gtb +gtfo +gtl +gts +gtv +gua +Guake +Guerci +gui +guidovansteen +guitool +gulpfile +gulpjs +gunignore +gunwip +gunzip +gupa +gupav +gupv +gvim +gvimdiff +gwc +gwch +gwip +gwt +Gxfxcxdxbxegedabagacad +gxvx +gyazo +Gyver +gzip +Hackage +Hacktoberfest +hackzor +hacluster +hadouken +hai +haldaemon +Halis +Hamelink +hammertest +hanami +hanamirb +har +hardcoded +hardlinks +hardstatus +harishnarayanan +hashh +Hashicorp +haskell +haskellstack +Hasklig +hawaga +hax +HBAR +hbm +Hcode +hda +hdc +hdd +hdel +hdp +hdrs +hdtp +hdv +hea +healthcheck +healthcheckerinterval +healthcheckertimeout +healthcheckerurl +heduled +heg +Helens +helpmojo +heroku +hexdocs +hexdump +hexists +hga +hgb +hgba +hgbk +hgc +hgca +hgchangeset +hgco +hgd +hged +hget +hgetall +hgi +hgic +hgl +hglg +hglgp +hglr +hgm +hgo +hgoc +hgp +hgrc +hgrep +hgs +hgsl +hgun +hhatto +hhh +hidefiles +highlighter +hincrby +HISTCMD +HISTFILE +HISTNO +historywords +histsize +histsubstrsrch +hitokoto +hkeys +hkscs +hlen +hmget +hmset +Hocevar +hocho +hoeg +Homeboy +homepage +hostip +hostname +hostpath +hotfix +hotfixes +hotlist +hotpink +howto +howtorun +hpodder +href +hrg +hscolour +hscroll +hset +hsetnx +hsi +hsp +hsqldb +htm +html +htmlsingle +htop +htslib +HTT +http +httpd +httpie +httplisteners +httpparams +httpsrouting +httpstatus +hubflow +hukkan +humza +huyy +hvals +hyperlink +hypermedia +hyperv +hypervisor +iam +ian +ianchesal +ibest +icanhas +icanhazip +icba +icbi +icc +icode +icpaa +icpai +icpra +icpri +icra +icri +icrosoft +icrsa +icrsi +idlekeytimeoutseconds +idletimeout +idmv +idx +idxstats +ietf +ifargs +ifconfig +iflist +iglob +ignoredescriptoritem +ignoreerrors +ignorenonexistent +ignorewarnings +igv +ihasbucket +iiop +iiopport +ilikenwf +ilkka +ima +imageshack +imap +imatch +imatches +img +imgur +iminurbase +imnp +imonit +impl +implicits +importpath +inbox +incrby +indexopts +inet +infocmp +ini +initsql +inkytonik +inl +inliner +inlining +inplace +inprogress +Inproper +inputenc +inr +insecureskipverify +insns +inspectdb +inspr +instagram +Installable +installationkey +installationkeybypass +installdeps +installdir +installsuffix +instancealias +instanceport +instanceurl +instaweb +instrs +integ +Intellij +interactivecomments +interdiff +interfacename +interoperability +interp +Intf +inur +invicem +iojs +iokit +ionescu +ionicframework +iops +ioreg +ipa +ipaddr +ipam +ipamdriver +ipapp +ipc +ipcidr +ipe +ipfs +ipld +ipns +IPREFIX +ipsw +iptables +ipv +ipython +irb +irc +IRTY +isconnectvalidatereq +isdefaultprovider +isdeleted +isearch +isfile +isisolationguaranteed +isodate +isodatesec +isolationlevel +isredeploy +istio +ISUFFIX +isundeploy +iterm +itertools +itunes +ivan +Ivoire +ixfuk +izakaya +ize +jacc +jaccard +jaddr +jaischeema +jakefile +jakejs +Janke +japvyz +jarfile +JARIN +jarsigner +javabootclasspath +javac +javadoc +javaextdirs +javamail +javap +javascript +javax +jbm +jboss +jcon +jdbc +jdc +jdcds +jde +jdeps +JDK +jdkinternals +jdl +jdlr +jdm +jdmds +jdwp +jeb +jecdyq +ject +Jedis +jeffmhubbard +jenv +jenvdir +jepgad +jerryling +jestjs +jex +jexec +jfrog +jgitflow +jgpagent +jid +jimhester +jimweirich +jira +jis +jisse +jkc +jkenabled +JLine +jlist +jmc +jmsdbpassword +jmsdest +jmx +jndi +jndilookupname +jnrowe +jobid +jobspec +jobstates +jobtexts +jof +johnhamelink +joly +jonas +jonmosco +jorge +journald +jpeg +jpg +jpo +jprofile +jql +jquery +jra +jraw +jrel +jreld +jrm +jrmds +jrmrel +jrmsas +jrp +jrs +jrspec +jruby +jsa +jsh +jshc +jshm +json +jsonfunc +jsonpath +jsontool +jsp +jspa +jssl +jst +jstj +jsu +jsw +jukie +junegunn +junex +junit +junkbust +JUNKFOOD +Juraj +jvenant +jvm +jvmargs +jvmoptions +jwt +jwtkeyfile +jxr +kajrod +kalsi +kapeli +kapow +kate +Kaving +kbd +kca +kcbt +kccc +kcdc +kcgc +kclean +kcn +kcp +kcsc +kcub +kcuc +kcud +kcuf +kcuu +kdch +kdcj +kdcm +kdd +kde +kdel +kdelcj +kdelcm +kdeld +kdelf +kdeli +kdelno +kdelns +kdelp +kdelpvc +kdelsa +kdelsec +kdelss +kdi +kdialog +kdiff +kdm +kdno +kdns +kdp +kdpvc +kds +kdsa +kdsec +Keanu +kecj +kecm +keds +keepfailedstubs +keepreposdir +keepstate +kei +kepvc +kerndeb +kes +keti +kevinkirkup +kexec +kextload +kextunload +keybindings +keycap +keychain +keyfile +keygen +keymap +keymetrics +keypair +keyring +keyshares +keysize +keyspace +keythreshold +KEYTIMEOUT +keytooloptions +keywordisfresh +keywordmsg +keywordquickly +kga +kgaa +kgcj +kgcm +kgd +kgdsw +kgdw +kgdwide +kgi +kgno +kgns +kgp +kgpl +kgpn +kgpvc +kgpvcw +kgpw +kgpwide +kgrs +kgs +kgsec +kgssw +kgsswide +kgsw +kgswide +Khas +khome +killall +killit +Kindergarteners +Kitts +kiwiirc +kiwish +kjx +klf +Klingberg +knative +kni +knifecmd +knifesubcmd +knp +knu +koenig +Kombat +kompare +konsole +kotlin +kotlintest +kpf +kphoen +kpkg +kpp +kres +krh +Krivitsky +krsd +krsss +kru +ksc +ksd +ksh +ksharrays +kshautoload +kshglob +kshoptionprint +ksshaskpass +ksss +kthxbai +kts +kube +kubeconfig +kubectl +kubectx +kubens +kubeoff +kubeon +kubernetes +kungfoo +Kurapati +kwargs +kypkvcw +Kyrgyzstan +Lacheze +lambdalift +lando +langinfo +laravel +lart +lastcategory +lastcmd +lastfull +lastrun +lastsave +launchctl +lazyconnectionassociation +lazyconnectionenlistment +lazyvals +lbenableallapplications +lbenableallinstances +lbenabled +lblue +lbname +lbpolicy +lbpolicymodule +lbtargets +lbuf +LBUFFER +lbweight +lcmd +ldap +ldflags +ldot +leakreclaim +leaktimeout +leavebrowseropen +lein +leiningen +lemy +len +Lengyel +leonhartx +LESSCLOSE +lesskey +LESSKEYIN +LESSOPEN +letcat +leter +lexduv +lexer +lfs +lho +lhs +libc +libedit +libexec +libnotify +libp +libreadline +libsecret +lifecycle +lighthouseapp +limegreen +lindex +linearizer +linewords +linkcheck +linkname +linsert +linux +linuxcommando +linuxcontainers +linuxmain +liquibase +listeneraddress +listenerport +livecheck +liveserver +llc +LLCORNER +llen +llr +llvm +lmnop +lname +loadconfig +loaddata +loadorder +localhost +localonly +localoptions +localtime +localtraps +lockdown +lockfile +lodash +logcat +logdriver +logentries +logfile +logid +loginurl +loglevel +logname +logreportederrors +logrotate +logtype +lol +lowerip +lpop +lpr +lpush +lpushx +lrange +lrbu +LRCORNER +lrem +lrh +lrp +lrt +lrunzip +lrz +lrzip +lrzuntar +lsa +lsb +lscolors +lset +lsof +lstheme +lstrip +lto +ltrim +lubs +lucentbeing +lvi +lways +lwc +lwd +lxc +lxd +lzcat +lzip +lzma +lzo +lzop +LZW +Maarten +macos +macports +macromates +Maeda +Magento +magerun +magicequalsubst +magick +mailhost +mailinfo +mailmap +mailnull +mailrc +mailsplit +mailuser +mainporcelain +maintail +maintainership +makecache +MAKEFLAGS +makemessages +makemigrations +makewindows +managedreleased +managepy +manni +manpage +manpath +mapcar +mapfile +mappedpassword +mappedusername +markname +markpath +maskfasta +maskray +masq +massimiliano +matchconnections +mathfunc +Mattern +Matth +matthewratzloff +matthr +maxbytes +maxchildren +maxconnectionscount +maxconnectionusagecount +maxdepth +maxleasettl +maxpoolsize +maxqueuesize +maxrank +maxrate +maxrequests +maxspare +maxtasksperchild +maxthreadpoolsize +maxwait +Mayen +Mayra +mbean +mbegin +mbologna +mbox +mboxrd +mbp +mca +mcl +mcm +mco +mcornella +mct +mdapi +mdb +mde +mdi +mdn +mds +meanlife +mediawiki +megazord +meh +Mek +mekanics +memprofile +memprofilerate +memq +menuselect +MENUSIZE +mergetool +mergewebxml +merkledag +Mery +messagebus +messagestoretype +metacpan +metadata +metricscollector +mfa +mfaerevaag +mfs +mget +miam +michelebologna +microk +microsoft +middleware +midsommar +midsommarafton +mikeh +millis +mindepth +minfds +minidisc +minikube +minlogprob +minprocs +minspare +minthreadpoolsize +mirko +mirrorlist +mixin +mkcd +mkdir +mktag +mktemp +mktree +mkv +mkvirtualenv +mla +mldonkey +Mleb +MLH +mli +mlo +mlog +mlp +mls +mlterm +MMA +mmap +mmin +mng +mnt +moar +modded +modifiedlastdays +modulename +Moldova +mongocli +mongodb +monit +monitorable +monokai +Morote +Mosco +mosh +mostfrequent +MOTD +mountpoint +mov +moyai +mozilla +mpa +mpeg +mpileup +mpkg +mplayer +mplex +mpr +mputniorz +mqhost +mqpassword +mqport +mquser +mre +mrp +mset +msetnx +msgnum +msgs +msh +msil +msp +mst +msvs +msw +msys +msysgit +mtime +mtu +Mudkipz +multiaddresses +multibase +multicastaddress +multicastport +multicov +multihashes +multiinter +multiline +multios +multiset +mumpub +munication +MURI +muscato +mutex +muxer +mvim +mvn +mvnag +mvnboot +mvnc +mvncd +mvnce +mvnci +mvncie +mvncini +mvncist +mvncisto +mvncom +mvncp +mvnct +mvncv +mvncvst +mvnd +mvndocs +mvndt +mvne +mvnfmt +mvnjetty +mvnp +mvnqdev +mvnsrc +mvnt +mvntc +mvnw +Mvt +Myanmar +myapp +myargs +myd +mydeb +myers +myfile +myfirstnamemylastname +mygit +myissues +mymark +myns +myprop +mypy +myrole +myserver +mysql +mysqladmin +mysqlrestart +mysqlstart +mysqlstatus +mysqlstop +mytime +myuser +myvalue +myvirtualenv +myzsh +nables +nagios +naliases +nameddirs +namespace +namesys +nanoant +nanoc +Narayanan +Naruto +nativelibrarypath +ncd +ncipe +NCOLOR +ncpu +ncs +ncv +ndjson +NDUw +NEm +nenv +neovim +netbsd +netdump +netloc +netmask +netstat +networkdriver +networklisteners +neuralsandwich +newcons +newpl +newvol +nextgenthemes +nfsnobody +nfunctions +nginx +ngnix +ngth +nhelp +nhistory +nhughes +nicoulaj +Nicoulaud +nixos +nkeywords +nkill +nle +nlinux +nlist +nmap +nmatches +Nmh +Nms +Nmw +noacl +noancestors +noargs +noautonamedirs +noautopushd +noblock +nobootcp +nobreak +nocache +nochunk +nocleanup +nocolor +nocopy +nocorrect +nodaemon +nodedir +nodefaultpolicy +nodegroup +nodehost +nodeid +nodejs +nodense +nodestatus +noexec +noexpand +noglob +noheading +nohelpers +nohup +noinput +nojline +noksh +nomadproject +nomnom +nomz +nonamespace +nondistributable +nongnu +NONINFRINGEMENT +nonomatch +NONSELECTABLE +nontransactionalconnections +nopassword +noposixbuiltins +noprofile +noprompt +nopromptsubst +noptions +nopushdminus +norc +noreload +NORMARG +NORRIS +noshortloops +noshwordsplit +nospace +nosplash +nostatic +nostatus +nostream +notactive +notailcalls +notest +nothreading +notifu +notnull +nounit +noverbose +nowai +nowarn +noword +noyes +NPAGE +npanelize +npm +npmd +npmg +npmi +npmjs +npmrc +npmst +npmt +npr +nproc +npu +npx +nroff +nscd +nsu +nthemes +ntlp +ntp +ntu +nubxa +nuc +nuget +numstat +nvcsformats +nvie +nvimdiff +nvm +nvmrc +Oakv +oanward +oathtool +OAuth +objectname +objectsize +objecttype +obsrun +obtw +octocat +octozen +oden +ofd +ogg +ogm +ohmyz +ohmyzsh +oid +oldp +oldpatmat +OLDPWD +OMITSPARSESTATE +OMMIT +omz +omztemp +onbehalfof +oneline +onlyrepos +onoz +ooanward +oom +openbsd +opendiff +openr +openshift +opensource +openssh +openstack +opensuse +openvpn +openw +OPTARG +optimisations +OPTIND +orderby +orgdir +orgs +oris +ority +orm +ornicar +orss +osascript +osname +osscan +ostype +osver +osx +oth +otp +otpcode +Ouellet +oug +outfh +outfile +outfilebase +outfilename +outlog +outputdir +outputtedto +Outputters +pacac +pacaur +pacdisowned +pacfiles +pacfileupg +pacin +pacinsd +packagecreaterequestid +packageid +packagekitd +packagename +packageobjects +packagephobia +packagetype +packageversionid +paclist +pacloc +pacls +paclsorphans +pacman +pacmanallkeys +pacmansignkeys +pacmir +pacoc +pacown +pacre +pacrem +pacrep +pacrmorphans +pacupd +pacupg +pacweb +pagage +pagename +painsd +pairtobed +pairtopair +paloc +palst +pamc +pame +pamf +pamfa +pamir +pamj +paml +pamm +pamn +pamp +pampp +pamr +pamt +panelize +paorph +paperclips +paqf +paqft +paql +paqr +paqt +paqw +paralint +params +parem +parep +PARGON +parhaat +paroc +parseable +parseopt +parwok +passivepopup +passphrase +passthrough +passthru +passwd +passwordstore +pastebin +pasu +patchformat +pathspec +patmat +patshead +paupd +paupg +pausedservices +pavic +paypal +paypalobjects +pbcopy +pbi +pbl +pbo +pbpaste +pbs +pbu +pcap +pch +pchk +pcl +pcmode +pcpu +PCR +pcre +pdf +PDoc +peb +peepcode +peerid +pem +percol +perflog +perl +perlbrew +perldoc +permset +permsetname +petere +peterhoeg +Pfenniger +pfs +pgp +pgpkeys +pgr +pgrep +pgs +phab +phing +phome +php +phx +pid +pidev +pidfile +pidof +pigz +pipenv +pipestatus +pipfile +pipir +piplist +pipreq +pipunall +pipupall +Pitcairn +pjdb +pjo +PKGBUILD +pkgfile +plaetinck +planetargon +playlists +playpause +ple +pleted +plist +Plug'n +plugin +pluginsdir +plz +pmat +pmd +pmin +pmset +png +pnp +podfile +podspec +policyconfigfactoryclass +policyproviderclass +polipo +polkitd +poo +poolname +poolresize +Poorter +popd +Popen +porcheron +portbase +portdir +Portfile +portlist +portname +posix +possen +posteo +posterasure +postgres +postinstallurl +posva +powd +powed +Powerline +poweroff +powershell +powify +powit +PPAGE +ppap +ppid +ppy +precache +precaire +precmd +precompilejsp +precompilewait +predef +preexec +prefetching +prefiltered +prefork +preload +premajor +preminor +prepatch +prepends +prepopulate +prettylist +previewer +prevword +pri +princ +principalsmap +printenv +printf +printflags +printprompt +privhist +privoxy +procfs +procs +prodlog +progfile +projectname +PROMPTCOLOR +PROMPTPREFIX +promptsize +promptsubst +promptvars +propget +proplist +protobuf +providertype +prun +pscpu +pseudoword +psgrep +psh +psmem +psprint +pstadler +pstree +psu +psubscribe +psy +psykorebase +pthree +ptot +ptree +pubgrub +publishwait +pubsub +puni +punsubscribe +puo +pushd +pushdefault +pushdf +pushdignoredups +pushdminus +pushdsilent +pushln +pushremote +pushurl +Putniorz +pvc +pvenv +pvm +pwd +PWDCASECORRECT +PWDLEN +pwdsize +pwdx +pwgen +pwh +pwned +pxd +pxy +pybundles +pyc +pycache +pyclean +pyenv +pyenvdirs +pyfind +pygmentize +pygments +pygrep +pylint +pypa +pypi +pytb +pytest +pythonhosted +pythonpath +pythonrc +PYTHONSTARTUP +PYTHONUSERBASE +pyuserpaths +Qdt +qiqmiq +qkey +qlmanage +qpwd +Qql +Qqo +qqq +qqwtzgejwgqve +Qtdq +quarkus +quicklisp +quickstart +quiltimport +qunit +qunitjs +quotationspage +quotedir +quu +quux +qwant +qwerty +qxtm +qyjti +rabin +rackspace +rackup +radvd +raek +Rakefile +raname +randomkey +rangepos +rar +ratijas +rawurldecode +rawurlencode +rbenv +rbenvdirs +rbfu +RBUFFER +rcfile +Rchive +rcs +rdargument +rdb +rdc +rdd +rdependents +rdeps +rdm +rdmd +rdmr +rdmtc +rdmu +rdoc +rdp +rdr +rds +rdsl +rdtc +rdtp +reactjs +readline +readlink +readme +readonly +readthedocs +readtimeoutmillis +Reagle +realcmd +reauthor +rebased +rebases +rebasing +receivepack +reddit +redirectport +redis +rediscli +redistrubute +redzone +reencode +reexec +refactor +refchecks +reflogs +refmap +refname +refspec +regex +regexes +regexn +regexp +reheader +reintializes +Reitsma +rej +reldates +reldist +releasenotesurl +releaseversion +relid +reloadinterval +reloadpost +reltool +remco +remoteonly +remotetestdir +removegroups +removeprincipals +removeusergroups +renamenx +rephorm +replacetokens +repow +reprovider +requestauthrecipient +requestauthsource +requestid +rerere +resetstat +resolv +resolvemsg +responseauthrecipient +responseauthsource +responsetimeout +restartpost +restype +resultformat +retcode +retlog +retrievefile +retrievetargetdir +returncode +RETVAL +revdeps +revlist +rfa +rfakeroot +rfap +rfbu +rfc +RFh +rfind +rgm +rhash +rinass +rinf +ripgrep +riseup +RIXIUS +rlc +Rli +rlib +Rlvi +rmacs +rmcup +rmd +rmdir +rmdsstore +rmdup +rmi +rmkx +rnand +rnatv +rnaw +rnios +rniosse +rniosx +rniosxr +rniosxsm +rnipad +rnipada +rnipadm +rnipadp +rnipadr +rnland +rnlink +rnlios +rns +robby +robbyrussell +ROLENAME +rollbackonerror +rootdir +rosrc +roswell +ROSWELLPATH +roundhoused +routecookie +rpath +rpc +rpcuser +rpmpackage +rpms +rpo +rpop +rpoplpush +rprompt +rpush +rpushx +rra +rrg +rsa +rsb +rsd +rset +rsh +rsp +rspec +rsrra +rst +rsto +rstrip +rsync +rtfm +rtkit +rtorrent +rts +rubocop +rubygems +rubyonrails +rubyprompt +rubypromptsize +rubyversion +Rudkin +rulz +runfcgi +runningservers +runningservices +runpy +runserver +runtests +runtfile +runtimes +RUNZSH +Ruslan +ruslanspivak +rustc +rustup +Rvi +rvm +rvmprompt +rvmpromptsize +rxvt +saas +sadd +salesforce +samtools +sandboxed +SAVEHIST +savelogin +savemasterpassword +sba +sbc +sbcc +sbcln +sbco +sbcp +sbcq +sbd +sbdc +sbdi +sbgi +sbin +sbp +sbpl +sbr +sbrake +sbrm +sbt +sbu +sbx +scalac +scaladoc +scalatest +scaleway +scandeps +scard +scd +scdalias +scdaliases +scdhistory +scdignore +scgi +sched +scheduledrundatetime +Schlatow +scm +scmpublish +scorpius +scottkidder +scp +screencast +screenshot +SCTP +scu +scutil +scw +scwsearch +sdiff +sdiffstore +sdist +sdk +sdkman +Sdl +sdurrheimer +Seagal +searchterm +seccomp +securityenabled +securitymap +securitytype +segfault +selectables +selectionkeyhandler +selectiveanf +selectivecps +selectorpolltimeoutmillis +selfupdate +selinux +semver +sendemail +sendperiod +serialfile +serialno +serverlist +servername +serverurl +serviceproperties +serviceuser +servlet +setab +setaf +setalias +setapp +setbit +setdefaultdevhubusername +setdefaulttimeout +setdefaultusername +setenv +setex +setnx +setopt +setprompt +setrange +sfcl +sfcontainer +sfcw +sfdc +sfdev +sfdx +sfdxcli +sfdxurl +sfdxurlfile +sfffe +sfgb +sfgc +sfgcom +sfge +sfn +sfprod +sfroute +SFSB +sfsr +sfsu +sftp +sfx +sgem +sgr +sgrep +sgtatham +shasum +sheerun +shellcheck +shellinit +shellperson +shitload +SHLVL +shm +Shohei +shopt +shortlist +shortlog +shortname +shortstat +SHOWCOLORHINTS +showcurrentpatch +showdeprecated +SHOWDIRTYSTATE +showfiles +showformat +showmigrations +showpkg +SHOWSTASHSTATE +showsubclasses +SHOWUNTRACKEDFILES +showupstream +shpotify +shuf +shunit +Shyamshankar +sid +sidekiq +sideload +SIGINT +SIGKILL +sigs +SIMBL +Sindre +sindresorhus +singlechar +singlepackage +Sint +sinterstore +sirech +sismember +sitecookbooks +sitesearch +sjis +skintone +skiptraceflag +skitch +slaveof +slicehost +sln +slogin +slp +smacs +smartlist +smartsync +smcup +smembers +smerge +smkx +Smood +smove +smt +smtp +Smurf +snapshotname +snowboarder +sobject +sobjectid +sobjecttreefiles +sobjecttype +sobjecttypecategory +socio +socw +softlayer +solaris +som +soq +soql +Sorhus +sorin +sortconip +sortcons +sortnr +sortr +sourceapiversion +sourced +sourcedir +sourcefile +sourceforge +sourceorg +sourcepath +sourcetype +sourcing +soww +soyc +spacewander +spam +spd +spearce +speartail +spf +spi +Spivak +splitbrain +splitlines +splunk +spock +spop +spork +spotify +springframework +sprintf +sprunge +spu +spx +sql +sqlall +sqlc +sqlclear +sqlcustom +sqldropindexes +sqlflush +sqlindexes +sqlinitialdata +sqlq +sqlsan +sqlsequencereset +sqltracelisteners +squashmigrations +srake +srandmember +src +srem +ssh +sshd +sshkey +sshkeyfile +sshkeypassphrase +sshpassword +sshport +sshpublickeyfile +sshuser +ssl +sslproxyhost +sslproxyport +ssm +sso +sst +sstat +stackoverflow +stacktrace +stagedstr +standalone +standaloneonly +startapp +startpage +startpost +startproject +startswith +startus +statd +statedb +statefile +statefulset +statelist +statementcachesize +statementleakreclaim +statementleaktimeout +statementtimeout +STATESEPARATOR +staticlib +statuspost +stderr +stdin +stdio +stdlayout +stdlib +stdout +steadypoolsize +stedolan +steeef +sterr +stevelosh +stgit +stil +STITLE +stn +stoppedservers +stoppedservices +stoppost +stopwait +storeprotocol +storeprotocolclass +stp +strfile +strftime +stringification +stringified +stringify +stripspace +strlen +strverscmp +Strzelecki +sts +stt +stty +stu +stylesheets +subcmds +subdigital +subdir +subdomain +subfolder +Subhaditya +subl +sublimemerge +sublimetext +subm +subnut +subpage +subpath +subscriberfile +subscriberorg +subservices +subshells +subspec +substr +subsubcmds +Subsubcommands +Subsubsubcommands +sudo +sudoedit +SUFIX +suitenames +sunaku +sunion +sunionstore +supad +superaccessors +supervisorctl +supervisord +suppresscc +suprl +suprm +suprr +suprs +supso +supsr +supu +Suraj +surryhill +suse +svcat +svg +svm +svn +svnsync +svntrunk +swiftc +swiftpm +sxa +sxc +sxd +sxf +sxfn +sxm +sxn +sxp +sxu +sxw +sxy +sykora +symfony +symkinds +symlink +Symlinking +symref +syms +syncdb +SYNOPSYS +syns +syohex +sys +sysadmins +sysctl +syslog +sysread +sysroot +systemadmin +systemctl +systemd +systeminfo +systemproperties +Syu +Syua +Syy +Tabone +tagname +tailcalls +Tajikistan +takedir +takegit +takeurl +tanabata +tarball +tarfile +targetcut +targetdevhubusername +targetprotocol +targetted +targetusername +Tasche +Tascii +taskwarrior +Tassilo +tatooine +tavric +tbz +tcl +tcp +tcpdump +tcpip +tcpnodelay +tcsh +tdiff +tdiffstr +tempdir +tempfile +tempfilename +TEMPLATENAME +terday +termcap +termcolor +Termfile +terminalapp +terminfo +terminitor +termsupport +termux +TERMWIDTH +terraform +terremark +testflag +testfunc +testlevel +testlog +testname +testng +testrb +testrunid +testrunner +testserver +textastic +textasticapp +textconv +textfile +textmate +tformat +tfstate +tftp +tfvars +tgz +thedir +thefuck +themeisfresh +thememsg +there're +thibault +thisfcn +Thoumie +threadpool +threadpoolid +thu +tif +timeoutmsec +timeremaining +timetolive +timewait +timothybasanov +tion +titlebar +tjkirch +tkachenko +tkdiff +tkss +tksv +tldr +Tlp +tls +tlscacert +tlscert +tlsciphers +tlsenabled +tlskey +tlsrollbackenabled +tlsverify +tlz +tmp +tmpdir +tmpfile +tmpfs +tmux +tmuxinator +tne +tnn +tobed +todo +Tokenise +tokenized +tolower +tomee +tonotdo +toolchain +toolcp +toplevel +Toponce +torrez +torromeo +tortoisemerge +totp +totpkey +Touron +tput +traceroute +trackball +transactionlogdir +transactionsupport +transferencoding +transprotocol +transprotocolclass +trapd +trconf +triggerevents +triggername +trins +trinsd +trizen +trloc +trlst +trmir +Troiae +Trojanowski +trorph +trre +trrem +trrep +trsu +trunc +trupd +trupg +tsdh +tsl +ttl +ttr +ttyctl +ttys +tview +twohead +txl +txn +txo +txs +txz +tycho +typechecking +typescriptlang +typesetsilent +typespec +typoes +tzst +uapprox +uberjar +Ubfksu +ubuntu +udp +uescape +UFE +ufw +uid +ukpog +ULCORNER +ulimit +Ullrich +ultiple +umask +umd +umich +unace +unalias +uname +unarchive +Uncomment +uncommit +uncompress +uncurry +undelete +undeploy +unedit +unescape +unexport +unexpose +unfunction +unhash +unheap +unhost +unicode +unidiff +unindex +uninst +uninstall +uninstalling +unionbedg +uniq +uniqid +uniquetablenames +unittest +universalarchive +unixfs +unixstamp +unlimit +unlzma +unmark +unmatch +unmonitor +unmute +unpause +unrar +unreachability +unsetopt +unshallow +unshare +unstagedstr +unstartup +unsubscribe +untag +unversioned +unwatch +unwip +unxz +unzstd +updatedb +updateonsave +updatestartuptty +upgr +upgradable +upgradetype +uploadpack +upperip +upsert +urandom +URCORNER +uri +url +urldecode +urlencode +urllib +urlmatch +urlonly +urlparse +urlstring +urltools +urxvt +usb +usbmux +usejavacp +uselimit +usemasterpassword +usergroups +userguide +userland +username +userns +userpass +userpassword +usetoolingapi +usetty +usr +utc +utf +utils +utm +uucp +UUID +Vagrantfile +vagrantup +valentinbud +validateatmostonceperiod +validateddeployrequestid +validateschema +validationclassname +validationmethod +validationtable +Valodim +vals +varargs +vared +varkey +varname +vaultproject +vba +vbl +vbm +vbo +vbox +vbqs +vbr +vbu +vcf +vcmp +vcs +vcsa +vdf +vectorize +Venant +vendored +venv +Verhoef +Verma +VERSINFO +versioncomp +versiondescription +versioned +versioning +versionname +versionnumber +versiontagprefix +verstr +vfs +vgi +vgrepping +vgs +vguerci +vhost +vhsp +vicmd +viewtopic +viins +vimdiff +vimgrep +vimrc +violenz +viopp +virtenv +virtualbox +virtualenv +virtualenvwrapper +virtualizing +virtualservers +virumque +visitpage +visualforce +visualstudio +VMDK +VMs +vmwarefusion +vmwarevcloudair +vmwarevsphere +vnc +vncviewer +vnd +voggom +Voldemort +volumedriver +vonnegut +Vop +vopts +vpaivatorres +vpc +vpli +vpll +vplu +vplun +vpr +vrdp +vre +vrp +vsc +vsca +vscd +vscde +vscg +vscie +vscl +vscn +vscode +vscodium +vscr +vscu +vscue +vscv +vscw +vsh +vsix +vsp +vsplit +vssh +vsshc +vssp +vst +VTE +vterm +Vue +vuejs +vulns +vulscan +vundle +vup +vvsp +vvv +vwxyz +vydpig +waittime +wakeonlan +walle +wantlist +warpdir +warprc +wav +wclip +wcomp +Webchat +weblog +webm +webrick +webscr +webserver +website +webtraffic +Wegner +Weiming +Weirich +Wez +wfilter +wget +whatchanged +whatisthor +whatthecommit +whatwg +whitespacelist +whl +whoami +wiki +wikipedia +wil +willmendesneto +wincmd +windowid +windowsdomain +windowspassword +windowsuser +wip +wjst +wks +wlne +wolframalpha +womens +wordbits +WORDBREAKS +WORDCHARS +wordlist +wordpress +workaround +workdir +workflow +workon +workpass +workqueues +workspaces +worktree +would've +wrapjdbcobjects +writetimeoutmillis +WSL +wslpath +wtf +wtfpl +www +wwwrun +Wzf +xargs +xcb +xcconfig +xcdd +xchm +xclick +xclip +xcode +xcodebuild +xcodeproj +xcp +xcsel +xcselv +xcworkspace +XDCHDSBDSDG +xdg +xdvi +xfn +xfree +xfs +xit +XIVIEWER +xjnmahqewy +xkcd +Xkten +XLBUFFER +xlbuflines +xml +xnode +xontab +xor +Xout +xperl +xphp +xpi +xpm +xpowered +xprop +xpython +XRBUFFER +xrbuflines +xruby +xsel +xshell +xstrat +xterm +XTRACE +xudmec +xunit +xvf +xvjf +xxd +xxdiff +Xxjn +xzcat +yaconf +yain +yainsd +yaloc +yalst +yamir +yaml +yandex +yandsearch +Yanovich +yaorph +yarem +yarep +yarnpkg +yarnrc +yasu +yaupd +yaupg +ybalrid +ycc +yesorno +yga +ygi +ygl +ygr +ygrm +ygu +yii +yiic +yiiframework +yireo +yleo +ylep +yli +yln +ylnf +yls +ymc +yml +yolo +Yonchu +YOSHIDA +yout +youtube +yrl +yrm +yrun +yst +ytc +yuc +yui +yuil +yuyuchu +yws +yyy +yzf +zadd +zake +zal +zall +zas +zbell +ZCA +zcard +zcl +zcompcache +zcompdump +zcompile +Zconvey +zcount +zcu +zcurses +zdbc +zdbcm +zdbm +zdbmigrate +zdbr +zdbreset +ZDgw +zdharma +zdirs +zdotdir +zdup +zenerate +zenmap +zerver +zfs +zgen +zgrep +zhimingwang +zhse +zic +zif +zin +zincrby +zinit +zinr +zinterstore +zipalign +zipfile +zkat +zle +zleparameter +zlicenses +zll +zlogin +zlogout +zlp +zlr +zls +zlu +zma +zmodload +zmr +zms +znr +znt +zocmez +zonsole +zoxide +zpa +zparseopts +zpatch +zpattern +zpch +zpchk +zpd +zplg +zplug +zplugin +zproduct +zprofile +zps +zpt +zrake +zrange +zrangebyscore +zrank +zref +zregexparse +zrem +zremrangebyrank +zremrangebyscore +zrevrange +zrevrangebyscore +zrevrank +zrl +zrm +zrn +zrr +zrs +zscore +zse +zsh'ed +zsh +zshaddhistory +zshcmd +zshcommands +zshcompfunc +zshconfig +zshell +zshenv +zshexpn +zshids +zshrc +zshtheme +zshwiki +zshzle +zsi +zsocket +Zsolt +zsource +zspec +zsr +zsrc +zst +Zstandard +zstat +zstd +zstdcat +zstyle +zsw +ztart +ztos +zucumber +zunctional +zunionstore +zunits +zunner +zup +zutil +zvcmp +zve +zweep +zwip +ZWJ +zwp +zxvf +zyg +zypper +zzz diff --git a/.github/actions/spelling/patterns.txt b/.github/actions/spelling/patterns.txt new file mode 100644 index 000000000..93dfa201c --- /dev/null +++ b/.github/actions/spelling/patterns.txt @@ -0,0 +1,73 @@ +# See https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples:-patterns + +# YouTube +https?://(?:(?:www\.|)youtube\.com|youtu.be)/(?:channel/|embed/|playlist\?list=|watch\?v=|v/|)[-a-zA-Z0-9?&=_]* +<\s*youtube\s+id=['"][-a-zA-Z0-9?_]*['"] +\bimg\.youtube\.com/vi/[-a-zA-Z0-9?&=_]* +# Google Analytics +\bgoogle-analytics\.com/collect.[-0-9a-zA-Z?%=&_.~]* +# Google APIs +\bgoogleapis\.com/[a-z]+/v\d+/[a-z]+/[@./?=\w]+ +\b[-a-zA-Z0-9.]*\bstorage\d*\.googleapis\.com(?:/\S*|) +# Google Calendar +\bcalendar\.google\.com/calendar(?:/u/\d+|)/embed\?src=[@./?=\w&%]+ +\w+\@group\.calendar\.google\.com\b +# Google DataStudio +\bdatastudio\.google\.com/(?:(?:c/|)u/\d+/|)(?:embed/|)(?:open|reporting|datasources|s)/[-0-9a-zA-Z]+(?:/page/[-0-9a-zA-Z]+|) +# The leading `/` here is as opposed to the `\b` above +# ... a short way to match `https://` or `http://` since most urls have one of those prefixes +# Google Docs +/docs\.google\.com/[a-z]+/d/(?:e/|)[0-9a-zA-Z_-]+/? +# Google Drive +\bdrive\.google\.com/file/d/[0-9a-zA-Z_?=]* +# Google Groups +\bgroups\.google\.com/(?:forum/#!|d/)(?:msg|topic)/[^/]+/[a-zA-Z0-9]+(?:/[a-zA-Z0-9]+|) +# Google themes +themes\.googleusercontent\.com/static/fonts/[^/]+/v\d+/[^.]+. +# Google CDN +\bclients2\.google(?:usercontent|)\.com[-0-9a-zA-Z/.]* +# Goo.gl +/goo\.gl/[a-zA-Z0-9]+ +# Google Chrome Store +\bchrome\.google\.com/webstore/detail/\w*(?:/\w*|) +# Google Books +\bbooks\.google\.(?:\w{2,4})/books\?[-\w\d=&#.]* +# Google Fonts +\bfonts\.(?:googleapis|gstatic)\.com/[-/?=:;+&0-9a-zA-Z]* + +# GitHub SHAs +\bapi.github\.com/repos/[^/]+/[^/]+/[^/]+/[0-9a-f]+\b +(?:\[[0-9a-f]+\]\(https:/|)/(?:www\.|)github\.com/[^/]+/[^/]+(?:/[^/]+/[0-9a-f]+(?:[-0-9a-zA-Z/#.]*|)\b|) +\bgithub\.com/[^/]+/[^/]+[@#][0-9a-f]+\b +# githubusercontent +/[-a-z0-9]+\.githubusercontent\.com/[-a-zA-Z0-9?&=_\/.]* +# gist github +/gist\.github\.com/[^/]+/[0-9a-f]+ +# git.io +\bgit\.io/[0-9a-zA-Z]+ +# GitHub JSON +"node_id": "[-a-zA-Z=;:/0-9+]*" +# Contributor +\[[^\]]+]\(https://github\.com/[^/]+\) +# GHSA +GHSA(?:-[0-9a-z]{4}){3} + +LS_COLORS=(["']).*?\g{-1} + +(\\?)%[a-zA-Z]+\g{-1}(?!%) + +# URL escaped characters +\%[0-9A-F]{2} +# hex digits including css/html color classes: +(?:[\\0][xX]|\\u|[uU]\+|#x?|\%23)[0-9a-fA-FgGrR_]{2,}(?:[uU]?[lL]{0,2}|u\d+)\b + +# https://www.gnu.org/software/groff/manual/groff.html +# man troff content +\\f[BCIPR] + +# Compiler flags +[\t "'`=]-[LPWXY] +[\t "'`=]-D(?!ebian) + +# ignore long runs of a single character: +\b([A-Za-z])\g{-1}{3,}\b diff --git a/.github/actions/spelling/reject.txt b/.github/actions/spelling/reject.txt new file mode 100644 index 000000000..a5ba6f639 --- /dev/null +++ b/.github/actions/spelling/reject.txt @@ -0,0 +1,7 @@ +^attache$ +benefitting +occurence +Sorce +^[Ss]pae +^untill +^wether diff --git a/.github/workflows/spelling.yml b/.github/workflows/spelling.yml new file mode 100644 index 000000000..18a302e3c --- /dev/null +++ b/.github/workflows/spelling.yml @@ -0,0 +1,95 @@ +name: Spell checking +on: + push: + branches: ["**"] + tags-ignore: ["**"] + pull_request_target: + issue_comment: + types: [created] + +jobs: + spelling: + name: Spell checking + permissions: + contents: read + pull-requests: read + outputs: + internal_state_directory: ${{ steps.spelling.outputs.internal_state_directory }} + runs-on: ubuntu-latest + if: "contains(github.event_name, 'pull_request') || github.event_name == 'push'" + concurrency: + group: spelling-${{ github.event.pull_request.number || github.ref }} + # note: If you use only_check_changed_files, you do not want cancel-in-progress + cancel-in-progress: true + steps: + - name: checkout-merge + if: "contains(github.event_name, 'pull_request')" + uses: actions/checkout@v2 + with: + ref: refs/pull/${{github.event.pull_request.number}}/merge + - name: checkout + if: github.event_name == 'push' + uses: actions/checkout@v2 + - name: check-spelling + id: spelling + uses: check-spelling/check-spelling@prerelease + with: + experimental_apply_changes_via_bot: 1 + suppress_push_for_open_pull_request: 1 + post_comment: 0 + - name: store-comment + if: failure() + uses: actions/upload-artifact@v2 + with: + retention-days: 1 + name: "check-spelling-comment-${{ github.run_id }}" + path: | + ${{ steps.spelling.outputs.internal_state_directory }} + + comment: + name: Comment + runs-on: ubuntu-latest + needs: spelling + permissions: + contents: write + pull-requests: write + if: always() && needs.spelling.result == 'failure' && needs.spelling.outputs.internal_state_directory + steps: + - name: checkout + uses: actions/checkout@v2 + - name: set up + run: | + mkdir /tmp/data + - name: retrieve-comment + uses: actions/download-artifact@v2 + with: + name: "check-spelling-comment-${{ github.run_id }}" + path: /tmp/data + - name: comment + uses: check-spelling/check-spelling@prerelease + with: + experimental_apply_changes_via_bot: 1 + custom_task: comment + internal_state_directory: /tmp/data + + update: + name: Update PR + permissions: + contents: write + pull-requests: write + runs-on: ubuntu-latest + if: ${{ + github.event_name == 'issue_comment' && + github.event.issue.pull_request && + contains(github.event.comment.body, '@check-spelling-bot apply') + }} + concurrency: + group: spelling-update-${{ github.event.issue.number }} + cancel-in-progress: false + steps: + - name: checkout + uses: actions/checkout@v2 + - name: check-spelling + uses: check-spelling/check-spelling@prerelease + with: + experimental_apply_changes_via_bot: 1 From 29b344a7102a2fe427d5ea6bcde4044898be1112 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 7 Dec 2021 18:04:33 +0100 Subject: [PATCH 257/896] chore: update security docs and link to huntr.dev --- README.md | 1 + SECURITY.md | 12 +++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 5712c1701..310283e92 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ To learn more, visit [ohmyz.sh](https://ohmyz.sh), follow [@ohmyzsh](https://twi [![Follow @ohmyzsh](https://img.shields.io/twitter/follow/ohmyzsh?label=Follow+@ohmyzsh&style=flat)](https://twitter.com/intent/follow?screen_name=ohmyzsh) [![Discord server](https://img.shields.io/discord/642496866407284746)](https://discord.gg/ohmyzsh) [![Gitpod ready](https://img.shields.io/badge/Gitpod-ready-blue?logo=gitpod)](https://gitpod.io/#https://github.com/ohmyzsh/ohmyzsh) +[![huntr.dev](https://cdn.huntr.dev/huntr_security_badge_mono.svg)](https://huntr.dev/bounties/disclose/?utm_campaign=ohmyzsh%2Fohmyzsh&utm_medium=social&utm_source=github&target=https%3A%2F%2Fgithub.com%2Fohmyzsh%2Fohmyzsh) ## Getting Started diff --git a/SECURITY.md b/SECURITY.md index cda53379f..7e5c8eed0 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -3,7 +3,8 @@ ## Supported Versions At the moment Oh My Zsh only considers the very latest commit to be supported. -We combine that with our fast response to incidents, so risk is minimized. +We combine that with our fast response to incidents and the automated updates +to minimize the time between vulnerability publication and patch release. | Version | Supported | |:-------------- |:------------------ | @@ -14,9 +15,10 @@ In the near future we will introduce versioning, so expect this section to chang ## Reporting a Vulnerability -If you find a vulnerability, email all the maintainers directly at: +**Do not submit an issue or pull request**: this might reveal the vulnerability. -- Robby: robby [at] planetargon.com -- Marc: hello [at] mcornella.com +Instead, you should email the maintainers directly at: [**security@ohmyz.sh**](mailto:security@ohmyz.sh). -**Do not open an issue or Pull Request directly**, because it might reveal the vulnerability. +We will deal with the vulnerability privately and submit a patch as soon as possible. + +You can also submit your vulnerability report to [huntr.dev](https://huntr.dev/bounties/disclose/?utm_campaign=ohmyzsh%2Fohmyzsh&utm_medium=social&utm_source=github&target=https%3A%2F%2Fgithub.com%2Fohmyzsh%2Fohmyzsh) and see if you can get a bounty reward. From 44d8edea05d940ceb593a025e27466e7c8727f03 Mon Sep 17 00:00:00 2001 From: Josh Soref <2119212+jsoref@users.noreply.github.com> Date: Tue, 7 Dec 2021 12:09:34 -0500 Subject: [PATCH 258/896] ci(spelling): automatically accept aliased commands (#10475) Co-authored-by: Josh Soref --- .github/actions/spelling/expect.txt | 3 +++ .github/workflows/spelling.yml | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/.github/actions/spelling/expect.txt b/.github/actions/spelling/expect.txt index fc764f57a..76e9fdf31 100644 --- a/.github/actions/spelling/expect.txt +++ b/.github/actions/spelling/expect.txt @@ -22,6 +22,7 @@ acr acroread acs acsc +acss acsp actionformats Adamantium @@ -1459,6 +1460,7 @@ gpr gpristine gpsup gpu +gpus gpv gradle gradlew @@ -2396,6 +2398,7 @@ mirrorlist mixin mkcd mkdir +mkdirs mktag mktemp mktree diff --git a/.github/workflows/spelling.yml b/.github/workflows/spelling.yml index 18a302e3c..946d411d1 100644 --- a/.github/workflows/spelling.yml +++ b/.github/workflows/spelling.yml @@ -30,6 +30,14 @@ jobs: - name: checkout if: github.event_name == 'push' uses: actions/checkout@v2 + - name: find aliases + run: | + for a in $(git ls-files|grep '\.zsh$'); do + echo "-- $a" + if [ -s "$a" ]; then + perl -ne 'next unless s/^alias ([A-Za-z]{3,})=.*/$1/;print' "$a" | tee -a .github/actions/spelling/allow.txt + fi + done; - name: check-spelling id: spelling uses: check-spelling/check-spelling@prerelease From 90e53bcc6aba67e9e27c4e6961cb4a0eec34d436 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 7 Dec 2021 19:37:28 +0100 Subject: [PATCH 259/896] ci(spelling): turn off check-spelling action temporarily --- .github/workflows/spelling.yml | 103 --------------------------------- 1 file changed, 103 deletions(-) delete mode 100644 .github/workflows/spelling.yml diff --git a/.github/workflows/spelling.yml b/.github/workflows/spelling.yml deleted file mode 100644 index 946d411d1..000000000 --- a/.github/workflows/spelling.yml +++ /dev/null @@ -1,103 +0,0 @@ -name: Spell checking -on: - push: - branches: ["**"] - tags-ignore: ["**"] - pull_request_target: - issue_comment: - types: [created] - -jobs: - spelling: - name: Spell checking - permissions: - contents: read - pull-requests: read - outputs: - internal_state_directory: ${{ steps.spelling.outputs.internal_state_directory }} - runs-on: ubuntu-latest - if: "contains(github.event_name, 'pull_request') || github.event_name == 'push'" - concurrency: - group: spelling-${{ github.event.pull_request.number || github.ref }} - # note: If you use only_check_changed_files, you do not want cancel-in-progress - cancel-in-progress: true - steps: - - name: checkout-merge - if: "contains(github.event_name, 'pull_request')" - uses: actions/checkout@v2 - with: - ref: refs/pull/${{github.event.pull_request.number}}/merge - - name: checkout - if: github.event_name == 'push' - uses: actions/checkout@v2 - - name: find aliases - run: | - for a in $(git ls-files|grep '\.zsh$'); do - echo "-- $a" - if [ -s "$a" ]; then - perl -ne 'next unless s/^alias ([A-Za-z]{3,})=.*/$1/;print' "$a" | tee -a .github/actions/spelling/allow.txt - fi - done; - - name: check-spelling - id: spelling - uses: check-spelling/check-spelling@prerelease - with: - experimental_apply_changes_via_bot: 1 - suppress_push_for_open_pull_request: 1 - post_comment: 0 - - name: store-comment - if: failure() - uses: actions/upload-artifact@v2 - with: - retention-days: 1 - name: "check-spelling-comment-${{ github.run_id }}" - path: | - ${{ steps.spelling.outputs.internal_state_directory }} - - comment: - name: Comment - runs-on: ubuntu-latest - needs: spelling - permissions: - contents: write - pull-requests: write - if: always() && needs.spelling.result == 'failure' && needs.spelling.outputs.internal_state_directory - steps: - - name: checkout - uses: actions/checkout@v2 - - name: set up - run: | - mkdir /tmp/data - - name: retrieve-comment - uses: actions/download-artifact@v2 - with: - name: "check-spelling-comment-${{ github.run_id }}" - path: /tmp/data - - name: comment - uses: check-spelling/check-spelling@prerelease - with: - experimental_apply_changes_via_bot: 1 - custom_task: comment - internal_state_directory: /tmp/data - - update: - name: Update PR - permissions: - contents: write - pull-requests: write - runs-on: ubuntu-latest - if: ${{ - github.event_name == 'issue_comment' && - github.event.issue.pull_request && - contains(github.event.comment.body, '@check-spelling-bot apply') - }} - concurrency: - group: spelling-update-${{ github.event.issue.number }} - cancel-in-progress: false - steps: - - name: checkout - uses: actions/checkout@v2 - - name: check-spelling - uses: check-spelling/check-spelling@prerelease - with: - experimental_apply_changes_via_bot: 1 From 5b987e59d0fce1a74bcfd51750c6f52d7c29c647 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 7 Dec 2021 20:15:38 +0100 Subject: [PATCH 260/896] chore: add ohmyzsh GitHub Sponsors to FUNDING.yml --- .github/FUNDING.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index c44bb2475..484a8cf53 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,2 +1,2 @@ -github: [robbyrussell, mcornella, larson-carter] +github: [ohmyzsh, robbyrussell, mcornella, larson-carter] open_collective: ohmyzsh From dcf12ba8f3b31eead602c530a9fbfd5579c64630 Mon Sep 17 00:00:00 2001 From: Nicolas Cavigneaux Date: Fri, 16 Jan 2015 15:59:52 +0100 Subject: [PATCH 261/896] fix(mercurial): show author name in `hgsl` alias log alias (#3500) Closes #3500 --- plugins/mercurial/README.md | 43 +++++++++++++------------- plugins/mercurial/mercurial.plugin.zsh | 2 +- 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/plugins/mercurial/README.md b/plugins/mercurial/README.md index 4beee0a95..a362de4ce 100644 --- a/plugins/mercurial/README.md +++ b/plugins/mercurial/README.md @@ -11,27 +11,28 @@ plugins=(... mercurial) ## Aliases -| Alias | Command | -|--------|-------------------------------------------------------------------------------------------------------------| -| `hga` | `hg add` | -| `hgc` | `hg commit` | -| `hgca` | `hg commit --amend` | -| `hgb` | `hg branch` | -| `hgba` | `hg branches` | -| `hgbk` | `hg bookmarks` | -| `hgco` | `hg checkout` | -| `hgd` | `hg diff` | -| `hged` | `hg diffmerge` | -| `hgp` | `hg push` | -| `hgs` | `hg status` | -| `hgsl` | `hg log --limit 20 --template "{node|short} | {date|isodatesec} | {author|user}: {desc|strip|firstline}\n"` | -| `hgun` | `hg resolve --list` | -| `hgi` | `hg incoming` | -| `hgl` | `hg pull -u` | -| `hglr` | `hg pull --rebase` | -| `hgo` | `hg outgoing` | -| `hglg` | `hg log --stat -v` | -| `hglgp`| `hg log --stat -p -v` | +| Alias | Command | +| ------- | ------------------------------------------- | +| `hga` | `hg add` | +| `hgc` | `hg commit` | +| `hgca` | `hg commit --amend` | +| `hgb` | `hg branch` | +| `hgba` | `hg branches` | +| `hgbk` | `hg bookmarks` | +| `hgco` | `hg checkout` | +| `hgd` | `hg diff` | +| `hged` | `hg diffmerge` | +| `hgp` | `hg push` | +| `hgs` | `hg status` | +| `hgsl` | `hg log --limit 20 --template "