about summary refs log blame commit diff stats
path: root/tools/treeshake_translate
blob: 36fcf7c66dfe6d9c00b73d5d80f1f988ed42997c (plain) (tree)
#!/bin/sh
# Translate SubX into minified ELF binaries for Linux.

set -e

grep -vh '^\s*#\|^\s*$' $*  > a.in
cat a.in  |tools/treeshake  > a.treeshake
./translate_subx a.treeshake
"$1";; *) printf "%s\n" "$PWD/$1";; esac } function listfiles { find -L "$(dirname "$target")" -maxdepth 1 -type f -iregex \ '.*\(jpe?g\|bmp\|png\|gif\)$' -print0 | sort -z } target="$(abspath $1)" count="$(listfiles | grep -m 1 -Zznx "$target" | cut -d: -f1)" if [ -n "$count" ]; then listfiles | xargs -0 sxiv -n "$count" -- else sxiv -- "$@" # fallback fi