Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/check-linux.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: 🐧 Check (Linux)
name: Check (Linux)
on:
push:
branches: [main]
Expand Down Expand Up @@ -30,7 +30,7 @@ jobs:
timeout-minutes: 10
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: ☑️ ShellCheck
uses: ludeeus/action-shellcheck@00cae500b08a931fb5698e11e79bfbd38e612a38 # 2.0.0
with:
Expand All @@ -42,7 +42,7 @@ jobs:
needs: [shellcheck]
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: ⚙️ Prepare dependencies
run: |
sudo apt-get update
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/check-macos.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: 🍎 Check (MacOS)
name: Check (macOS)

on:
push:
Expand Down Expand Up @@ -31,7 +31,7 @@ jobs:
timeout-minutes: 10
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: ☑️ ShellCheck
uses: ludeeus/action-shellcheck@00cae500b08a931fb5698e11e79bfbd38e612a38 # 2.0.0
with:
Expand All @@ -43,7 +43,7 @@ jobs:
needs: [shellcheck]
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: ⚙️ Prepare dependencies
run: |
brew install zsh
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/checksum.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: "🆗 Checksum"
name: Checksum
on:
push:
paths:
Expand All @@ -23,7 +23,7 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: "🆗 Generate checksum"
uses: jmgilman/actions-generate-checksum@3ea6dc9bf8eecf28e2ecc982fab683484a1a8561 # v1.0.1
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deploy-gh-pages.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: "🚀 GitHub Pages"
name: GitHub Pages

on:
workflow_dispatch:
Expand All @@ -26,7 +26,7 @@ jobs:
timeout-minutes: 15
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: "🏷 Prepare deployment metadata"
id: prepare_deploy
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/rclone-action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: "🔄 Rclone"
name: Rclone
on:
push:
branches: [gh-pages]
Expand All @@ -22,7 +22,7 @@ jobs:
remote_path: "r2:r2-store/src"
steps:
- name: "⤵️ Check out code from GitHub"
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: "⏫ Run rclone/r2-store"
uses: z-shell/.github/actions/rclone@3222f53692e448ed6e2caf8b8722e74fb2ca2461 # v1.1.1
with:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/win-install.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: ⚙️ Windows Install
name: Windows Install

on:
pull_request:
Expand Down Expand Up @@ -28,7 +28,7 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: ☑️ ShellCheck
uses: ludeeus/action-shellcheck@00cae500b08a931fb5698e11e79bfbd38e612a38 # 2.0.0
with:
Expand All @@ -42,7 +42,7 @@ jobs:
run: |
git config --global core.autocrlf input
git config --global --add safe.directory /cygdrive/d/a/src/src
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: 🪟 Dependencies (Windows)
uses: egor-tensin/setup-cygwin@fca9069f92361187d4abfaa5d8a7490e435d8349 # v4.0.2
with:
Expand Down
8 changes: 4 additions & 4 deletions public/checksum.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
348b78e992d28ecebd23940d06944629ef7f8f9d93c17ef3469cd6eebd288451 public/sh/install_zpmod.sh
7408a1045f330a6e73bda55c6c7b48be7873a4e7f1fb00d7db989827cc9224a9 public/sh/install.sh
f8519bf7e3e42ad67cc9cff6d82a8367641611fc687b2f6793e26bd55dbbb553 public/sh/sync-init.sh
98f54a779985719e390b3e4559b7b0ac22101caac91d0569d41cd9229a05c6de public/zsh/init.zsh
0140801e80b2d8767e95d215850b6feab3642ee2b6fd70fbf4aab09afcfe7fca public/sh/install_zpmod.sh
0cca0bb9f95101b4bf392d6aa3c23123602d99a7cbb0decacaa72973e016d89d public/sh/install.sh
08cc893ceb982fc99d17db1966c6c30790cc571e16e4f5392352d995f5252952 public/sh/sync-init.sh
5c7af31d7fc848d80f9fedf69c75e6844503f550a3d5e020bc7cdfdaca624763 public/zsh/init.zsh
2 changes: 1 addition & 1 deletion public/sh/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

set -eu

WORKDIR="$(mktemp -d)" || exit 1
WORKDIR="$(mktemp -d "${TMPDIR:-/tmp}/zi-install.XXXXXX")" || exit 1
trap 'rm -rf "${WORKDIR:?}"' EXIT INT TERM
ZOPT=""
AOPT=""
Expand Down
2 changes: 1 addition & 1 deletion public/sh/install_zpmod.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

set -eu

WORKDIR="$(mktemp -d)" || exit 1
WORKDIR="$(mktemp -d "${TMPDIR:-/tmp}/zi-zpmod.XXXXXX")" || exit 1
trap 'rm -rf "${WORKDIR:?}"' EXIT INT TERM

# Returns 0 if version $1 >= version $2 (dot-separated integers)
Expand Down
28 changes: 14 additions & 14 deletions public/sh/sync-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

set -eu

WORKDIR="$(mktemp -d)" || exit 1
WORKDIR="$(mktemp -d "${TMPDIR:-/tmp}/zi-sync.XXXXXX")" || exit 1
trap 'rm -rf "${WORKDIR:?}"' EXIT INT TERM

SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
Expand Down Expand Up @@ -70,7 +70,7 @@ _fetch_url() {
elif command -v wget >/dev/null 2>&1; then
command wget -qO- "${_url}"
else
printf '%s\n' "[1;31m▓▒░[0m No curl or wget available." >&2
printf '%b\n' "▓▒░ No curl or wget available." >&2
return 1
fi
}
Expand Down Expand Up @@ -114,14 +114,14 @@ _fetch() {
return 0
fi
fi
printf '%s\n' "[1;31m▓▒░[0m Failed to fetch: ${_src}" >&2
printf '%b\n' "▓▒░ Failed to fetch: ${_src}" >&2
return 1
;;
*)
if [ -r "${_src}" ]; then
command cat "${_src}"
else
printf '%s\n' "[1;31m▓▒░[0m Cannot read local path: ${_src}" >&2
printf '%b\n' "▓▒░ Cannot read local path: ${_src}" >&2
return 1
fi
;;
Expand All @@ -136,7 +136,7 @@ _sha256() {
elif command -v shasum >/dev/null 2>&1; then
shasum -a 256 "${_file}" | command awk '{print $1}'
else
printf '%s\n' "[1;31m▓▒░[0m No sha256sum or shasum available." >&2
printf '%b\n' "▓▒░ No sha256sum or shasum available." >&2
return 1
fi
}
Expand Down Expand Up @@ -191,8 +191,8 @@ done
# ── Validate Inputs ───────────────────────────────────────────────────────────

if [ ! -f "${OPT_LOCAL}" ] && [ "${OPT_WRITE}" -eq 0 ]; then
printf '%s\n' "[1;31m▓▒░[0m Local file not found: ${OPT_LOCAL}" >&2
printf '%s\n' "[1;33m▓▒░[0m Use --write to create it from remote." >&2
printf '%b\n' "▓▒░ Local file not found: ${OPT_LOCAL}" >&2
printf '%b\n' "▓▒░ Use --write to create it from remote." >&2
exit 1
fi

Expand All @@ -202,7 +202,7 @@ REMOTE_FILE="${WORKDIR}/remote-init.zsh"
printf '%s\n' "▓▒░ Fetching remote: ${OPT_REMOTE}"
# shellcheck disable=SC2310
if ! _fetch "${OPT_REMOTE}" >"${REMOTE_FILE}"; then
printf '%s\n' "[1;31m▓▒░[0m Failed to fetch remote file." >&2
printf '%b\n' "▓▒░ Failed to fetch remote file." >&2
exit 1
fi

Expand All @@ -213,19 +213,19 @@ if [ "${OPT_NO_CHECKSUM}" -eq 0 ]; then
printf '%s\n' "▓▒░ Fetching checksum: ${OPT_CHECKSUM_URL}"
# shellcheck disable=SC2310
if ! _fetch "${OPT_CHECKSUM_URL}" >"${CHECKSUM_FILE}"; then
printf '%s\n' "[1;31m▓▒░[0m Failed to fetch checksum file." >&2
printf '%b\n' "▓▒░ Failed to fetch checksum file." >&2
exit 1
fi

EXPECTED_HASH="$(grep "${CHECKSUM_KEY}" "${CHECKSUM_FILE}" | command awk '{print $1}')"
if [ -z "${EXPECTED_HASH}" ]; then
printf '%s\n' "[1;31m▓▒░[0m No checksum entry for '${CHECKSUM_KEY}' in checksum.txt." >&2
printf '%b\n' "▓▒░ No checksum entry for '${CHECKSUM_KEY}' in checksum.txt." >&2
exit 1
fi

REMOTE_HASH="$(_sha256 "${REMOTE_FILE}")"
if [ "${REMOTE_HASH}" != "${EXPECTED_HASH}" ]; then
printf '%s\n' "[1;31m▓▒░[0m Remote checksum mismatch!" >&2
printf '%b\n' "▓▒░ Remote checksum mismatch!" >&2
printf '%s\n' " expected : ${EXPECTED_HASH}" >&2
printf '%s\n' " got : ${REMOTE_HASH}" >&2
exit 1
Expand All @@ -245,13 +245,13 @@ else
fi

if [ "${LOCAL_HASH}" = "${REMOTE_HASH}" ]; then
printf '%s\n' "[1;32m▓▒░[0m Local file matches remote. No sync needed."
printf '%b\n' "▓▒░ Local file matches remote. No sync needed."
printf '%s\n' " hash : ${LOCAL_HASH}"
printf '%s\n' " path : ${OPT_LOCAL}"
exit 0
fi

printf '%s\n' "[1;33m▓▒░[0m Local and remote differ."
printf '%b\n' "▓▒░ Local and remote differ."
printf '%s\n' " local : ${LOCAL_HASH}"
printf '%s\n' " remote : ${REMOTE_HASH}"
printf '%s\n' " source : ${OPT_REMOTE}"
Expand Down Expand Up @@ -286,7 +286,7 @@ fi
command mv "${TMP_TARGET}" "${OPT_LOCAL}"

NEW_HASH="$(_sha256 "${OPT_LOCAL}")"
printf '%s\n' "[1;32m▓▒░[0m Sync complete."
printf '%b\n' "▓▒░ Sync complete."
printf '%s\n' " before : ${LOCAL_HASH}"
printf '%s\n' " after : ${NEW_HASH}"
printf '%s\n' " path : ${OPT_LOCAL}"
4 changes: 2 additions & 2 deletions public/zsh/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ _zi_pmod() {
# Register Zi completion if the completion system is active.
_zi_comps() {
builtin emulate -L zsh
if (( ${+_comps} )) && [[ -f "${ZI[BIN_DIR]}/lib/_zi" ]]; then
(( ${+_comps[zi]} )) || _comps[zi]="${ZI[BIN_DIR]}/lib/_zi"
if (( ${+_comps} )); then
(( ${+_comps[zi]} )) || _comps[zi]=_zi
fi
return 0
}
Expand Down
2 changes: 0 additions & 2 deletions public/zsh/snippets/color.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
# Source: https://github.com/molovo/color
# License: MIT — Copyright (c) 2015 Joe Letchford
# Maintained by z-shell/src — https://github.com/z-shell/src
#
#!/usr/bin/env zsh

function color() {
local color=$1 style=$2 b=0
Expand Down
16 changes: 9 additions & 7 deletions public/zsh/snippets/revolver
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env zsh

# Source: https://github.com/molovo/revolver
# License: MIT — Copyright (c) 2016 Joe Letchford
# Maintained by z-shell/src — https://github.com/z-shell/src
#

local -A _revolver_spinners
_revolver_spinners=(
Expand Down Expand Up @@ -79,7 +79,7 @@ function _revolver_usage() {
echo " start <message> Start the spinner"
echo " update <message> Update the message"
echo " stop Stop the spinner"
echo " demo Display an demo of each style"
echo " demo Display a demo of each style"
}

###
Expand All @@ -88,6 +88,10 @@ function _revolver_usage() {
function _revolver_process() {
local dir statefile state msg pid="$1" spinner_index=0

if [[ -z $pid || $pid != <-> ]]; then
exit 1
fi

# Find the directory and load the statefile
dir=${REVOLVER_DIR:-"${ZDOTDIR:-$HOME}/.revolver"}
statefile="$dir/$pid"
Expand All @@ -107,11 +111,9 @@ function _revolver_process() {
fi

# Check for the existence of the parent process
$(kill -s 0 $pid 2&>/dev/null)

# If process doesn't exist, exit the script
# to prevent it from being orphaned
if [[ $? -ne 0 ]]; then
# and exit if process doesn't exist to prevent
# the spinner from being orphaned
if ! kill -s 0 "$pid" 2>/dev/null; then
exit 1
fi

Expand Down
Loading
Loading