fix: vim modelines & zsdoc pdf rendering

Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
This commit is contained in:
Vladislav Doster 2022-12-15 22:21:49 -06:00
parent 0e45493e36
commit 2b460a74f2
12 changed files with 35868 additions and 36194 deletions

File diff suppressed because it is too large Load diff

Binary file not shown.

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,81 +0,0 @@
#!/usr/bin/env bash
build() {
cd "$(
cd "$(dirname "$0")" > /dev/null 2>&1
pwd -P
)" || exit 9
local image_name="${1:-zinit}"
local tag="${2:-latest}"
local zsh_version="${3}"
shift 3
local dockerfile="../docker/Dockerfile"
if [[ -n $zsh_version ]]; then
tag="zsh${zsh_version}-${tag}"
fi
echo -e "\e[34mBuilding image: ${image_name}\e[0m" >&2
local -a args
[[ -n $NO_CACHE ]] && args+=(--no-cache "$@")
if docker build \
--build-arg "PUSERNAME=$(id -u -n)" \
--build-arg "PUID=$(id -u)" \
--build-arg "PGID=$(id -g)" \
--build-arg "TERM=${TERM:-xterm-256color}" \
--build-arg "ZINIT_ZSH_VERSION=${zsh_version}" \
--file "$dockerfile" \
--tag "${image_name}:${tag}" \
"${args[@]}" \
"$(realpath ..)"; then
{
echo -e "\e[34mTo use this image for zunit tests run: \e[0m"
echo -e "\e[34mexport CONTAINER_IMAGE=\"${image_name}\" CONTAINER_TAG=\"${tag}\"\e[0m"
echo -e "\e[34mzunit run --verbose\e[0m"
} >&2
else
echo -e "\e[31m❌ Container failed to build.\e[0m" >&2
return 1
fi
}
if [[ ${BASH_SOURCE[0]} == "${0}" ]]; then
BUILD_ZSH_VERSION="${BUILD_ZSH_VERSION:-}"
CONTAINER_IMAGE="${CONTAINER_IMAGE:-ghcr.io/zdharma-continuum/zinit}"
CONTAINER_TAG="${CONTAINER_TAG:-latest}"
NO_CACHE="${NO_CACHE:-}"
while [[ -n $* ]]; do
case "$1" in
--image | -i)
CONTAINER_IMAGE="$2"
shift 2
;;
--no-cache | -N)
NO_CACHE=1
shift
;;
--zsh-version | -zv | --zv)
BUILD_ZSH_VERSION="${2}"
shift 2
;;
*)
break
;;
esac
done
build "${CONTAINER_IMAGE}" "${CONTAINER_TAG}" "${BUILD_ZSH_VERSION}" "$@"
fi
# Local Variables:
# mode: Shell-Script
# sh-indentation: 2
# indent-tabs-mode: nil
# sh-basic-offset: 2
# End:
# vim: ft=bash sw=2 ts=2 et

View file

@ -1,260 +0,0 @@
#!/usr/bin/env bash
parent_process() {
local ppid pcmd
ppid="$(ps -o ppid= -p "$$" | awk '{ print $1 }')"
if [[ -z $ppid ]]; then
echo "Failed to determine parent process" >&2
return 1
fi
if pcmd="$(ps -o cmd= -p "$ppid")"; then
echo "$pcmd"
return
fi
return 1
}
running_interactively() {
if [[ -n $CI ]]; then
return 1
fi
if ! [[ -t 1 ]]; then
# return false if running non-interactively, unless run with zunit
parent_process | grep -q zunit
fi
}
create_init_config_file() {
local tempfile
if [[ -z $* ]]; then
return 1
fi
tempfile="$(mktemp)"
echo "$*" > "$tempfile"
# DIRTYFIX perms...
chmod 666 "$tempfile"
echo "$tempfile"
}
run() {
local image="${CONTAINER_IMAGE:-ghcr.io/zdharma-continuum/zinit}"
local tag="${CONTAINER_TAG:-latest}"
local init_config="$1"
shift
local -a args=(--rm)
local cruntime=docker
local sudo_cmd
if [[ -z $CI ]] && command -v podman > /dev/null 2>&1; then
cruntime=podman
# rootless containers are a PITA
# https://www.tutorialworks.com/podman-rootless-volumes/
sudo_cmd=sudo
fi
if running_interactively; then
args+=(--tty=true --interactive=true)
fi
if [[ -n $init_config ]]; then
if [[ -r $init_config ]]; then
args+=(--volume "${init_config}:/init.zsh")
else
echo "❌ Init config file is not readable" >&2
return 1
fi
fi
if [[ -n $CONTAINER_WORKDIR ]]; then
args+=(--workdir "$CONTAINER_WORKDIR")
fi
# Inherit TERM
if [[ -n $TERM ]]; then
args+=(--env "TERM=${TERM}")
fi
if [[ -n ${CONTAINER_ENV[*]} ]]; then
local e
for e in "${CONTAINER_ENV[@]}"; do
args+=(--env "${e}")
done
fi
if [[ -n ${CONTAINER_VOLUMES[*]} ]]; then
local vol
for vol in "${CONTAINER_VOLUMES[@]}"; do
# shellcheck disable=2076
if [[ ! " ${args[*]} " =~ " --volume ${vol} " ]]; then
args+=(--volume "${vol}")
fi
done
fi
local -a cmd=("$@")
if [[ -n $WRAP_CMD ]]; then
local zsh_opts="ilsc"
[[ -n $ZSH_DEBUG ]] && zsh_opts="x${zsh_opts}"
cmd=(zsh "-${zsh_opts}" "${cmd[*]}")
fi
if [[ -n $DEBUG ]]; then
{
# The @Q below is necessary to keep the quotes intact
# https://stackoverflow.com/a/12985353/1872036
echo -e "🚀 \e[35mRunning command"
echo -e "\$ ${cruntime} run ${args[*]} ${image}:${tag} ${cmd[*]@Q}\e[0m"
} >&2
fi
${sudo_cmd} "${cruntime}" run "${args[@]}" "${image}:${tag}" "${cmd[@]}"
}
if [[ ${BASH_SOURCE[0]} == "${0}" ]]; then
CONTAINER_ENV=()
CONTAINER_IMAGE="${CONTAINER_IMAGE:-ghcr.io/zdharma-continuum/zinit}"
CONTAINER_TAG="${CONTAINER_TAG:-latest}"
CONTAINER_VOLUMES=()
CONTAINER_WORKDIR="${CONTAINER_WORKDIR:-}"
DEBUG="${DEBUG:-}"
INIT_CONFIG_VAL="${INIT_CONFIG_VAL:-}"
PRESET="${PRESET:-}"
WRAP_CMD="${WRAP_CMD:-}"
ZSH_DEBUG="${ZSH_DEBUG:-}"
while [[ -n $* ]]; do
case "$1" in
# Fetch init config from clipboard (Linux only)
--xsel | -b)
INIT_CONFIG_VAL="$(xsel -b)"
shift
;;
-c | --config | --init-config | --init)
INIT_CONFIG_VAL="$2"
shift 2
;;
-f | --config-file | --init-config-file | --file)
if ! [[ -r $2 ]]; then
echo "Unable to read from file: $2" >&2
exit 2
fi
INIT_CONFIG_VAL="$(cat "$2")"
shift 2
;;
-d | --debug)
DEBUG=1
shift
;;
-D | --dev | --devel)
DEVEL=1
shift
;;
--docs)
PRESET=docs
shift
;;
-i | --image)
CONTAINER_IMAGE="$2"
shift 2
;;
-t | --tag)
CONTAINER_TAG="$2"
shift 2
;;
# Additional container env vars
-e | --env | --environment)
CONTAINER_ENV+=("$2")
shift 2
;;
# Additional container volumes
-v | --volume)
CONTAINER_VOLUMES+=("$2")
shift 2
;;
# Whether to wrap the command in zsh -silc
-w | --wrap)
WRAP_CMD=1
shift
;;
--tests | --zunit | -z)
PRESET=zunit
shift
;;
# Whether to enable debug tracing of zinit (zsh -x)
# Only applies to wrapped commands (--w|--wrap)
--zsh-debug | -x | -Z)
ZSH_DEBUG=1
shift
;;
*)
break
;;
esac
done
GIT_ROOT_DIR="$(git rev-parse --show-toplevel)"
CMD=("$@")
case "$PRESET" in
zunit)
# Mount root of the repo to /src
# Mount /tmp/zunit-zinit to /data
CONTAINER_VOLUMES+=(
"${GIT_ROOT_DIR}:/src"
"${TMPDIR:-/tmp}/zunit-zinit:/data"
)
CONTAINER_ENV+=(
"QUIET=1"
"NOTHING_FANCY=1"
)
;;
docs)
# Mount root of the repo to /src
CONTAINER_VOLUMES+=(
"${GIT_ROOT_DIR}:/src"
)
CONTAINER_ENV+=(
"QUIET=1"
"NOTHING_FANCY=1"
"LC_ALL=en_US.UTF-8"
)
CONTAINER_WORKDIR=/src
# shellcheck disable=2016
INIT_CONFIG_VAL='zinit nocompile make'\''PREFIX=$ZPFX install'\'' for zdharma-continuum/zshelldoc'
# shellcheck disable=2016
CMD=(zsh -ilsc
'sudo chown -R "$(id -u):$(id -g)" /src &&
@zi::scheduler burst &&
sudo apk add tree &&
make -C /src doc')
;;
esac
if INIT_CONFIG="$(create_init_config_file "$INIT_CONFIG_VAL")"; then
trap 'rm -vf $INIT_CONFIG' EXIT INT
fi
if [[ -n $DEVEL ]]; then
# Mount root of the repo to /src
CONTAINER_VOLUMES+=(
"${GIT_ROOT_DIR}:/src"
)
fi
run "$INIT_CONFIG" "${CMD[@]}"
fi
# Local Variables:
# mode: Shell-Script
# sh-indentation: 2
# indent-tabs-mode: nil
# sh-basic-offset: 2
# End:
# vim: ft=bash sw=2 ts=2 et

View file

@ -76,7 +76,6 @@ zi::service() {
builtin read -t 1 ___tmp <>"${___fle:r}.fifo2"
done >>! "$ZSRV_WORK_DIR/$ZSRV_ID".log 2>&1
} # ]]]
# FUNCTION: zi::wrap-track-functions [[[
zi::wrap-track-functions() {
local user="$1" plugin="$2" id_as="$3" f
@ -104,6 +103,11 @@ function $f {
# Dtrace
#
# FUNCTION: zi::clear-debug-report [[[
# Forgets dtrace repport gathered up to this moment.
zi::clear-debug-report() {
zi::clear-report-for _dtrace/_dtrace
} # ]]]
# FUNCTION: zi::debug-start [[[
# Starts Dtrace, i.e. session tracking for changes in Zsh state.
zi::debug-start() {
@ -130,11 +134,6 @@ zi::debug-stop() {
# Gather end data now, for diffing later
zi::diff _dtrace/_dtrace end
} # ]]]
# FUNCTION: zi::clear-debug-report [[[
# Forgets dtrace repport gathered up to this moment.
zi::clear-debug-report() {
zi::clear-report-for _dtrace/_dtrace
} # ]]]
# FUNCTION: zi::debug-unload [[[
# Reverts changes detected by dtrace run.
zi::debug-unload() {
@ -146,4 +145,4 @@ zi::debug-unload() {
fi
} # ]]]
# vim: set fenc=utf8 ffs=unix foldmarker=[[[,]]] foldmethod=marker ft=zsh list noet sw=2 ts=2 tw=72 :
# vim: set fenc=utf8 ffs=unix foldmarker=[[[,]]] foldmethod=marker ft=zsh list noet sw=2 ts=2 tw=72:

File diff suppressed because it is too large Load diff

View file

@ -1282,6 +1282,7 @@ zi::prepare-home() {
command cp -f $ZINIT[BIN_DIR]/doc/zinit.1 $ZINIT[MAN_DIR]/man1
}
} # ]]]
# FUNCTION: zi::load-object [[[
zi::load-object() {
local ___type="$1" ___id=$2
@ -1296,8 +1297,8 @@ zi::load-object() {
___retval+=$?
return __retval
}
# ]]]
} # ]]]
# FUNCTION: zi::set-m-func [[[
# Sets and withdraws the temporary, atclone/atpull time function `m`.
zi::set-m-func() {