NOTICKET: Upgrade Justfile
Some checks failed
Quality Check / QS Backend (push) Successful in 20s
Quality Check / QS Frontend (push) Failing after 37s
Quality Check / QS Mixed (push) Successful in 35s

This commit is contained in:
Snoweuph 2024-07-19 16:24:43 +02:00
parent 6df6115d92
commit 1e48fe13c9
Signed by: Snoweuph
GPG key ID: 0021ADF278B2F49B
2 changed files with 16 additions and 3 deletions

1
app/bin/just/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
.cache/

View file

@ -9,9 +9,9 @@ function preview() {
if [[ -z "$recipe" ]] || echo $recipe | grep -q "^\["; then if [[ -z "$recipe" ]] || echo $recipe | grep -q "^\["; then
printf "${RED_FG}Select this to Exit${CLEAR}" printf "${RED_FG}Select this to Exit${CLEAR}"
elif [[ "$content" == *" ..." ]]; then elif [[ "$content" == *" ..." ]]; then
just_wrapper --list $recipe | highlight --out-format xterm256 --syntax conf hash_highlight "$(just_wrapper --list $recipe)" "conf"
else else
just_wrapper --show $recipe | highlight --out-format xterm256 --syntax sh hash_highlight "$(just_wrapper --show $recipe)" "sh"
fi fi
} }
@ -33,7 +33,19 @@ function choose_truncate() {
function choose_list() { function choose_list() {
just_wrapper -l --no-aliases --list-heading="" | awk '{$1=$1};1' just_wrapper -l --no-aliases --list-heading="" | awk '{$1=$1};1'
} }
function hash_highlight() {
cache_dir="$(dirname ${BASH_SOURCE[0]})/.cache"
hash=$(echo $1 | md5sum | cut -d ' ' -f1)
file="$cache_dir/$hash"
if [[ -e $file ]]; then
cat $file
else
mkdir -p $cache_dir
data=$(printf "$1" | highlight --out-format xterm256 --syntax "$2")
printf "$data"
printf "$data" > $file
fi
}
case "$action" in case "$action" in
*choose) choose;; *choose) choose;;
*preview) preview;; *preview) preview;;