From eee3c9c1662914cd2a7f30139396bf96d0200521 Mon Sep 17 00:00:00 2001 From: Kaleb Elwert Date: Thu, 13 Dec 2018 10:51:56 -0800 Subject: [PATCH 1/8] git: add documentation for new aliases --- modules/git/README.md | 4 ++++ modules/git/alias.zsh | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/git/README.md b/modules/git/README.md index a497826..b5de9f6 100644 --- a/modules/git/README.md +++ b/modules/git/README.md @@ -81,6 +81,7 @@ zstyle ':prezto:module:git:alias' skip 'yes' commits. - `gcR` removes the *HEAD* commit. - `gcs` displays various types of objects. + - `gcsS` displays commits with GPG signature. - `gcl` lists lost commits. - `gcy` displays commits yet to be applied to upstream in the short format. - `gcY` displays commits yet to be applied to upstream. @@ -220,6 +221,7 @@ zstyle ':prezto:module:git:alias' skip 'yes' - `glg` displays the graph log. - `glb` displays the brief commit log. - `glc` displays the commit count for each contributor in descending order. + - `glS` displays the log and checks the validity of signed commits. ### Merge @@ -295,6 +297,8 @@ zstyle ':prezto:module:git:alias' skip 'yes' - `gt` lists tags or creates tag. - `gtl` lists tags matching pattern. + - `gts` creates a signed tag. + - `gtv` validate a signed tag. ### Working directory diff --git a/modules/git/alias.zsh b/modules/git/alias.zsh index 4e4f482..89ba558 100644 --- a/modules/git/alias.zsh +++ b/modules/git/alias.zsh @@ -68,11 +68,11 @@ if ! zstyle -t ':prezto:module:git:alias' skip 'yes'; then alias gcr='git revert' alias gcR='git reset "HEAD^"' alias gcs='git show' - alias gpS='git show --pretty=short --show-signature' + alias gcsS='git show --pretty=short --show-signature' alias gcl='git-commit-lost' alias gcy='git cherry -v --abbrev' alias gcY='git cherry -v' - + # Conflict (C) alias gCl='git --no-pager diff --name-only --diff-filter=U' alias gCa='git add $(gCl)' From 54dff31b63ea04705cc95200e53dd4e7a67232d6 Mon Sep 17 00:00:00 2001 From: Indrajit Raychaudhuri Date: Thu, 13 Dec 2018 01:14:59 -0600 Subject: [PATCH 2/8] archive: Enhance 'archive' helper to support multi file archive We now allow multiple paths (files/directories) to be archived in one shot. Validation of the target path(s) is now delegated to the actual archive helper. --- modules/archive/functions/archive | 32 +++++++++++++------------------ 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/modules/archive/functions/archive b/modules/archive/functions/archive index 0e3bb61..fab409e 100644 --- a/modules/archive/functions/archive +++ b/modules/archive/functions/archive @@ -8,11 +8,11 @@ # function archive { -local archive_name dir_to_archive _gzip_bin _bzip2_bin +local archive_name path_to_archive _gzip_bin _bzip2_bin -if (( $# != 2 )); then +if (( $# < 2 )); then cat >&2 <&2 - return 1 -fi +# let paths be handled by actual archive helper +path_to_archive="${@:2}" # here, we check for dropin/multi-threaded replacements # this should eventually be moved to modules/archive/init.zsh @@ -53,14 +47,14 @@ else fi case "${archive_name}" in - (*.tar.gz|*.tgz) tar -cvf "${archive_name}" --use-compress-program="${_gzip_bin}" "${dir_to_archive}" ;; - (*.tar.bz2|*.tbz|*.tbz2) tar -cvf "${archive_name}" --use-compress-program="${_bzip2_bin}" "${dir_to_archive}" ;; - (*.tar.xz|*.txz) tar -cvJf "${archive_name}" "${dir_to_archive}" ;; - (*.tar.lzma|*.tlz) tar -cvf "${archive_name}" --lzma "${dir_to_archive}" ;; - (*.tar) tar -cvf "${archive_name}" "${dir_to_archive}" ;; - (*.zip|*.jar) zip -r "${archive_name}" "${dir_to_archive}" ;; - (*.rar) rar a "${archive_name}" "${dir_to_archive}" ;; - (*.7z) 7za a "${archive_name}" "${dir_to_archive}" ;; + (*.tar.gz|*.tgz) tar -cvf "${archive_name}" --use-compress-program="${_gzip_bin}" "${=path_to_archive}" ;; + (*.tar.bz2|*.tbz|*.tbz2) tar -cvf "${archive_name}" --use-compress-program="${_bzip2_bin}" "${=path_to_archive}" ;; + (*.tar.xz|*.txz) tar -cvJf "${archive_name}" "${=path_to_archive}" ;; + (*.tar.lzma|*.tlz) tar -cvf "${archive_name}" --lzma "${=path_to_archive}" ;; + (*.tar) tar -cvf "${archive_name}" "${=path_to_archive}" ;; + (*.zip|*.jar) zip -r "${archive_name}" "${=path_to_archive}" ;; + (*.rar) rar a "${archive_name}" "${=path_to_archive}" ;; + (*.7z) 7za a "${archive_name}" "${=path_to_archive}" ;; (*.gz) print "\n.gz is only useful for single files, and does not capture permissions. Use .tar.gz" ;; (*.bz2) print "\n.bzip2 is only useful for single files, and does not capture permissions. Use .tar.bz2" ;; (*.xz) print "\n.xz is only useful for single files, and does not capture permissions. Use .tar.xz" ;; From 11184084bcd0d67838c420bdd18f3c7922ad4993 Mon Sep 17 00:00:00 2001 From: Indrajit Raychaudhuri Date: Fri, 14 Dec 2018 15:34:42 -0600 Subject: [PATCH 3/8] homebrew: Simplify array assignment No need for nesting array assignment only to flatten it later. --- modules/homebrew/init.zsh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/modules/homebrew/init.zsh b/modules/homebrew/init.zsh index d078b7a..b449bac 100644 --- a/modules/homebrew/init.zsh +++ b/modules/homebrew/init.zsh @@ -45,12 +45,11 @@ alias casks='hb_deprecated brew cask search' alias caskx='brew cask uninstall' function hb_deprecated { - local cmd="${argv[3]}" - local cmd_args=( ${(@)argv:4} ) + local cmd="${@[3]}" + local cmd_args="${@:4}" printf "'brew cask %s' has been deprecated, " "${cmd}" printf "using 'brew %s' instead\n" "${cmd}" - cmd_args=( ${(@)argv:4} ) - command brew "${cmd}" ${(@)cmd_args} + command brew "${cmd}" "${=cmd_args}" } From 3093f1b966985c834fb698dabbe9a0af805ef940 Mon Sep 17 00:00:00 2001 From: Indrajit Raychaudhuri Date: Fri, 14 Dec 2018 15:40:59 -0600 Subject: [PATCH 4/8] homebrew: Load 'HOMEBREW_' prefixed variables only Load 'HOMEBREW_' prefixed variables only. Avoid loading 'PATH' related variables as they are already handled in standard zsh configuration. --- modules/homebrew/init.zsh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/homebrew/init.zsh b/modules/homebrew/init.zsh index b449bac..056f1fb 100644 --- a/modules/homebrew/init.zsh +++ b/modules/homebrew/init.zsh @@ -14,10 +14,11 @@ fi # Variables # -# Load standard Homebrew shellenv into the shell session. -# `brew shellenv` is relatively new, guard for legacy Homebrew. +# Load standard Homebrew shellenv into the shell session. +# Load 'HOMEBREW_' prefixed variables only. Avoid loading 'PATH' related +# variables as they are already handled in standard zsh configuration. if (( $+commands[brew] )); then - eval "$(brew shellenv 2> /dev/null)" + eval "${(@M)${(f)"$(brew shellenv 2> /dev/null)"}:#export HOMEBREW*}" fi # From dc8e168d5fab038bc2bd39f97984c111abf5258c Mon Sep 17 00:00:00 2001 From: Indrajit Raychaudhuri Date: Fri, 14 Dec 2018 20:57:10 -0600 Subject: [PATCH 5/8] command-not-found: Minor reformatting --- modules/command-not-found/init.zsh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/command-not-found/init.zsh b/modules/command-not-found/init.zsh index bcb0dea..f3d7ea6 100644 --- a/modules/command-not-found/init.zsh +++ b/modules/command-not-found/init.zsh @@ -17,7 +17,9 @@ elif [[ -s '/usr/share/doc/pkgfile/command-not-found.zsh' ]]; then # lookup mechanism (viz., `brew command command-not-found-init`) and instead # `find` it ourselves from `TAP_DIRECTORY` defined internally in Homebrew. elif (( $+commands[brew] )); then - cnf_command=("$(brew --repository 2> /dev/null)"/Library/Taps/*/*/cmd/brew-command-not-found-init(|.rb)(.NL+0)) + cnf_command=( + "$(brew --repository 2> /dev/null)"/Library/Taps/*/*/cmd/brew-command-not-found-init(|.rb)(.N) + ) if (( $#cnf_command )); then cache_file="${TMPDIR:-/tmp}/prezto-brew-command-not-found-cache.$UID.zsh" From 9d3e2f0204f2de5a0f04da1e0cdcf63e8afe5add Mon Sep 17 00:00:00 2001 From: Indrajit Raychaudhuri Date: Fri, 14 Dec 2018 21:32:10 -0600 Subject: [PATCH 6/8] python: Expand compctl matches for pip variants Expand `sed` match for more variants of 'pip*' (pip, pip2, pip3, pip2.7, pip3.7 etc.) for `compctl` assignment --- modules/python/init.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/python/init.zsh b/modules/python/init.zsh index d61488e..a8e00b3 100644 --- a/modules/python/init.zsh +++ b/modules/python/init.zsh @@ -160,7 +160,7 @@ if (( $#commands[(i)pip(|[23])] )); then || ! -s "$cache_file" ]]; then # pip is slow; cache its output. And also support 'pip2', 'pip3' variants $pip_command completion --zsh \ - | sed -e "s|\(compctl -K [-_[:alnum:]]*\) pip.*|\1 pip pip2 pip3|" >! "$cache_file" 2> /dev/null + | sed -e "s/\(compctl -K [-_[:alnum:]]*\) pip.*/\1 pip(|[23](|.[0-9]))/" >! "$cache_file" 2> /dev/null fi source "$cache_file" From 0e6429da97876c7ce0868966e8a812c29bcba0b3 Mon Sep 17 00:00:00 2001 From: Diego Rabatone Oliveira Date: Mon, 17 Dec 2018 16:22:33 -0200 Subject: [PATCH 7/8] Remove duplicated information from git module README (#1657) --- modules/git/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/git/README.md b/modules/git/README.md index b5de9f6..e4425fa 100644 --- a/modules/git/README.md +++ b/modules/git/README.md @@ -67,7 +67,7 @@ zstyle ':prezto:module:git:alias' skip 'yes' - `gcm` records changes to the repository with the given message. - `gcS` records changes to the repository. (Signed) - `gcSa` stages all modified and deleted files. (Signed) - - `gcSm` records changes to the repository with the given message. (Signed) - `gco` checks out a branch or paths to work tree. + - `gcSm` records changes to the repository with the given message. (Signed) - `gcam` stages all modified and deleted files, and records changes to the repository with the given message. - `gco` checks out a branch or paths to work tree. - `gcO` checks out hunks from the index or the tree interactively. From a338cba805f63f770e9078925bc5c46129e28bde Mon Sep 17 00:00:00 2001 From: Indrajit Raychaudhuri Date: Mon, 17 Dec 2018 14:10:51 -0600 Subject: [PATCH 8/8] python: Use brace expansion for pip compctl match Just use brace expansion only (and not a mix of brace expansion and path expansion) to expand `sed` match for more variants of 'pip*' (pip, pip2, pip3, pip2.7, pip3.7 etc.) in `compctl` assignment --- modules/python/init.zsh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/python/init.zsh b/modules/python/init.zsh index a8e00b3..44043f1 100644 --- a/modules/python/init.zsh +++ b/modules/python/init.zsh @@ -160,7 +160,9 @@ if (( $#commands[(i)pip(|[23])] )); then || ! -s "$cache_file" ]]; then # pip is slow; cache its output. And also support 'pip2', 'pip3' variants $pip_command completion --zsh \ - | sed -e "s/\(compctl -K [-_[:alnum:]]*\) pip.*/\1 pip(|[23](|.[0-9]))/" >! "$cache_file" 2> /dev/null + | sed -e "s/\(compctl -K [-_[:alnum:]]* pip\).*/\1{,2,3}{,.{0..9}}/" \ + >! "$cache_file" \ + 2> /dev/null fi source "$cache_file"