d2ffe8306a7a901569764979be917384d7e97f0f

Author
Carlo Sala <carlosalag@protonmail.com>
Committer
Carlo Sala <carlosalag@protonmail.com>
Date

Message

feat(history-substring-search): use new dependencies updater

Diff

This diff is truncated to protect this page.

  1diff --git a/.github/dependencies.yml b/.github/dependencies.yml
  2index 6d138736ca27afa27ec65c798ad90d0a86293b0d..be46a79734d43bd55490695ef02e757e943c17f7 100644
  3--- a/.github/dependencies.yml
  4+++ b/.github/dependencies.yml
  5@@ -18,3 +18,10 @@ dependencies:
  6       set -e
  7       test -e _zshz && mv -f _zshz _z
  8       test -e zsh-z.plugin.zsh && mv -f zsh-z.plugin.zsh z.plugin.zsh
  9+  plugins/history-substring-search:
 10+    repo: zsh-users/zsh-history-substring-search
 11+    branch: master
 12+    version: 8f5d8a5aa9942da7b2a764c7fa79e0f36ba802f7
 13+    precopy: |
 14+      set -e
 15+      test -e zsh-history-substring-search.plugin.zsh && mv zsh-history-substring-search.plugin.zsh history-substring-search.plugin.zsh
 16diff --git a/plugins/history-substring-search/update-from-upstream.zsh b/plugins/history-substring-search/update-from-upstream.zsh
 17deleted file mode 100755
 18index 81e1942a508e3358c63354be658c56ef0ba2c2ef..0000000000000000000000000000000000000000
 19--- a/plugins/history-substring-search/update-from-upstream.zsh
 20+++ /dev/null
 21@@ -1,129 +0,0 @@
 22-#!/usr/bin/env zsh
 23-#
 24-# update-from-upstream.zsh
 25-#
 26-# This script updates the Oh My Zsh version of the zsh-history-substring-search
 27-# plugin from the independent upstream repo. This is to be run by OMZ developers
 28-# when they want to pull in new changes from upstream to OMZ. It is not run
 29-# during normal use of the plugin.
 30-#
 31-# The official upstream repo is zsh-users/zsh-history-substring-search
 32-# https://github.com/zsh-users/zsh-history-substring-search
 33-#
 34-# This is a zsh script, not a function. Call it with `zsh update-from-upstream.zsh`
 35-# from the command line, running it from within the plugin directory.
 36-#
 37-# You can set the environment variable REPO_PATH to point it at an upstream
 38-# repo you have already prepared. Otherwise, it will do a clean checkout of
 39-# upstream's HEAD to a temporary local repo and use that.
 40-
 41-
 42-# Just bail on any error so we don't have to do extra checking.
 43-# This is a developer-use script, so terse output like that should
 44-# be fine.
 45-set -e
 46-
 47-
 48-upstream_basename=zsh-history-substring-search
 49-plugin_basename=history-substring-search
 50-UPSTREAM_REPO=zsh-users/$upstream_basename
 51-need_repo_cleanup=false
 52-upstream_github_url="https://github.com/$UPSTREAM_REPO"
 53-
 54-if [[ -z "$UPSTREAM_REPO_PATH" ]]; then
 55-  # Do a clean checkout
 56-  my_tempdir=$(mktemp -d -t omz-update-histsubstrsrch)
 57-  UPSTREAM_REPO_PATH="$my_tempdir/$upstream_basename"
 58-  git clone "$upstream_github_url" "$UPSTREAM_REPO_PATH"
 59-  need_repo_cleanup=true
 60-  print "Checked out upstream repo to $UPSTREAM_REPO_PATH"
 61-else
 62-	print "Using existing $upstream_basename repo at $UPSTREAM_REPO_PATH"
 63-fi
 64-
 65-upstream="$UPSTREAM_REPO_PATH"
 66-
 67-# Figure out what we're pulling in
 68-upstream_sha=$(cd $upstream && git rev-parse HEAD)
 69-upstream_commit_date=$(cd $upstream && git log  -1 --pretty=format:%ci)
 70-upstream_just_date=${${=upstream_commit_date}[1]}
 71-print "upstream SHA:         $upstream_sha"
 72-print "upstream commit time: $upstream_commit_date"
 73-print "upstream commit date: $upstream_just_date"
 74-print
 75-
 76-# Copy the files over, using the OMZ plugin's names where needed
 77-cp -v "$upstream"/* .
 78-mv -v zsh-history-substring-search.zsh $plugin_basename.zsh
 79-mv -v zsh-history-substring-search.plugin.zsh $plugin_basename.plugin.zsh
 80-
 81-if [[ $need_repo_cleanup == true ]]; then
 82-	print "Removing temporary repo at $my_tempdir"
 83-	rm -rf "$my_tempdir"
 84-fi
 85-
 86-# Do OMZ-specific edits
 87-
 88-print
 89-print "Updating files with OMZ-specific stuff"
 90-print
 91-
 92-# OMZ binds the keys as part of the plugin loading
 93-
 94-cat >> $plugin_basename.plugin.zsh <<EOF
 95-
 96-
 97-# Bind terminal-specific up and down keys
 98-
 99-if [[ -n "\$terminfo[kcuu1]" ]]; then
100-  bindkey -M emacs "\$terminfo[kcuu1]" history-substring-search-up
101-  bindkey -M viins "\$terminfo[kcuu1]" history-substring-search-up
102-fi
103-if [[ -n "\$terminfo[kcud1]" ]]; then
104-  bindkey -M emacs "\$terminfo[kcud1]" history-substring-search-down
105-  bindkey -M viins "\$terminfo[kcud1]" history-substring-search-down
106-fi
107-
108-EOF
109-
110-# Tack OMZ-specific notes on to readme
111-
112-thin_line="------------------------------------------------------------------------------"
113-cat >> README.md <<EOF
114-
115-$thin_line
116-Oh My Zsh Distribution Notes
117-$thin_line
118-
119-What you are looking at now is Oh My Zsh's repackaging of zsh-history-substring-search 
120-as an OMZ module inside the Oh My Zsh distribution.