Compare commits

...

3 Commits

Author SHA1 Message Date
Lockszmith (kateryna) f3bd0e804d Add load-webi 2024-09-21 12:55:51 -04:00
Lockszmith (kateryna) bf1b14d7d4 Check chezmoi tmp cache first for zellij 2024-09-21 12:44:39 -04:00
Lockszmith (kateryna) c29866a6d1 Add bash-preexec and zellij as externals 2024-09-21 12:42:19 -04:00
3 changed files with 58 additions and 1 deletions

View File

@ -1,5 +1,20 @@
# https://www.chezmoi.io/reference/special-files-and-directories/chezmoiexternal-format/
#
# type string none External type (file, archive, archive-file, or git-repo)
# refreshPeriod duration 0 Refresh period (Examples: one day (24h), one week (168h), or four weeks (672h))
".config/sz.env/lib/ble.sh.curl":
type: "archive"
url: "https://github.com/akinomyoga/ble.sh/releases/download/nightly/ble-nightly.tar.xz"
refreshPeriod: "168h"
".config/sz.env/lib/bash-preexec/bash-preexec.sh":
type: "file"
url: "https://raw.githubusercontent.com/rcaloras/bash-preexec/master/bash-preexec.sh"
refreshPeriod: "168h"
".cache/chezmoi/tmp/zellij":
type: "archive"
url: "https://github.com/zellij-org/zellij/releases/download/v0.40.1/zellij-x86_64-unknown-linux-musl.tar.gz"
refreshPeriod: "168h"

View File

@ -0,0 +1,40 @@
#! /usr/bin/env bash
# Helper function
is_sourced() {
if [ -n "$ZSH_VERSION" ]; then
case $ZSH_EVAL_CONTEXT in *:file:*) return 0;; esac
else # Add additional POSIX-compatible shell names here, if needed.
case ${0##*/} in dash|-dash|bash|-bash|ksh|-ksh|sh|-sh) return 0;; esac
fi
return 1; # NOT sourced.
}
BASE_0=${BASE_0:-$0}
BASE_SHELL=$(basename "$SHELL")
if is_sourced; then
webi() {
if [[ ! -x "${HOME}/.local/bin/webi" ]]; then
printf '%s\n' \
"webi isn't installed, install by running:" \
" curl -sS https://webi.sh/webi | sh"
return
fi
${HOME}/.local/bin/webi "${@}"
}
if is_cmd webi; then
webi
fi
elif [[ "$1" == '-' ]]; then
cat "${BASH_SOURCE[0]}"
else
SCRIPT_NAME="$BASE_0"
printf '%s\n' \
"It seems $SCRIPT_NAME was invoked as a script. It should be sourced instead." \
'The easiest way is to call it like this:' \
" $ . <( $SCRIPT_NAME - ) # Note the '-' after the script's name" \
''
fi

View File

@ -22,7 +22,9 @@ if is_sourced; then
}
zellij() {
if [[ ! -x ~/bin/zellij ]]; then
if [[ ! -x /tmp/zellij/bootstrap/zellij ]]; then
if [[ -r $HOME/.cache/chezmoi/tmp/zellij/zellij ]]; then
ln --symbolic --relative $HOME/.cache/chezmoi/tmp/zellij/zellij ~/bin
elif [[ ! -x /tmp/zellij/bootstrap/zellij ]]; then
bash <(curl -sL zellij.dev/launch) "${@}" && return
fi
fi