1
0
Fork 0
mirror of https://github.com/notwa/rc synced 2024-04-28 02:13:23 -07:00

use cursed code style

This commit is contained in:
Connor Olding 2022-09-30 17:17:15 -07:00
parent b531274a13
commit cb705df268
2 changed files with 22 additions and 21 deletions

View File

@ -33,14 +33,14 @@ _temporary_scope_() {
# this doesn't work for all scripts at the moment, but # this doesn't work for all scripts at the moment, but
ADDPATH "$HOME/sh" ADDPATH "$HOME/sh"
( # combine everything matching "YES_BASH" in ~/sh/ into ~/.sh-bash.
# combine everything matching "YES_BASH" in ~/sh/ into ~/.sh-bash. # unlike zsh, we do not check the sha1sum of the output.
# unlike zsh, we do not check the sha1sum of the output. (: \
cd ~/sh \ && cd ~/sh \
&& printf '%s\n' '#!/usr/bin/env false' '[ -n "$preload" ] || exit 1' '' \ && printf '%s\n' '#!/usr/bin/env false' '[ -n "$preload" ] || exit 1' '' \
| cat - $(grep -lF YES_BASH -- $(find ~/sh/ -maxdepth 1 -type f '!' -name '*.bak')) \ | cat - > ~/.sh-bash \
> ~/.sh-bash $(grep -lF YES_BASH -- $(find ~/sh/ -maxdepth 1 -type f '!' -name '*.bak')) \
) ;)
dummy() { :; } ### @- return 0, ignoring arguments. dummy() { :; } ### @- return 0, ignoring arguments.
preload=dummy preload=dummy

View File

@ -58,22 +58,23 @@ autoload edit-command-line
autoload history-search-end autoload history-search-end
zmodload zsh/mathfunc zmodload zsh/mathfunc
function { # combine everything matching "YES_ZSH" in ~/sh/ into ~/.sh,
local a= b= # but only recompile the output if the sha1sum has changed.
function
# combine everything matching "YES_ZSH" in ~/sh/ into ~/.sh, {: \
# but only recompile the output if the sha1sum has changed. && local a= b= \
[ -s ~/.sh.sha1 ] && read -r b _ < ~/.sh.sha1 && { [ ! -s ~/.sh.sha1 ] || read -r b _ < ~/.sh.sha1 ;} \
( cd ~/sh \ && (: \
&& cd ~/sh \
&& print -l '#!/usr/bin/env false' '[ -n "$preload" ] || exit 1' '' \ && print -l '#!/usr/bin/env false' '[ -n "$preload" ] || exit 1' '' \
| cat - $(grep -lF YES_ZSH -- *~*.bak(.)) \ | cat - $(grep -lF YES_ZSH -- *~*.bak(.)) \
| tee ~/.sh \ | tee ~/.sh \
) | sha1sum - \ ;) \
| tee ~/.sh.sha1 \ | sha1sum - \
| read -r a _ | tee ~/.sh.sha1 \
| read -r a _ \
[ "$a" = "$b" ] && touch ~/.sh.zwc || zrecompile -p ~/.sh && { [ "$a" = "$b" ] && touch ~/.sh.zwc || zrecompile -p ~/.sh ;} \
} ;}
dummy() : ### @- return 0, ignoring arguments. dummy() : ### @- return 0, ignoring arguments.
preload=dummy preload=dummy