shellcheck zzexe to reduce errors, qb improve

This commit is contained in:
Phantop 2022-01-18 12:25:01 -05:00
parent 39d94bb10d
commit e08ada07da
2 changed files with 20 additions and 21 deletions

View File

@ -3,7 +3,7 @@ alias a 'alias -s'
a aliases 'v (which aliases); command aliases'
a all2jxl 'fd -e{png,jpg} -x cjxl -e 8 -d 0 {} {.}.jxl && fd -e{png,jpg} -x rm'
a ao3 'grep epub $argv | cut -d\" -f2 | parallel aria2c "https://ao3.org{}" -dao3;rm'
a ao3 'grep epub $argv | cut -d\" -f4 | parallel aria2c "https://ao3.org{}" -dao3;rm'
a base64d 'echo (echo $argv | base64 -d 2>/dev/null);:'
a bax 'source (which bax) && bax'
a catbox 'curl https://catbox.moe/user/api.php -F reqtype=fileupload -F fileToUpload=@$argv;:'
@ -52,7 +52,6 @@ a wallp 'gsettings set org.gnome.desktop.background picture-uri file://(realpath
a wm 'startx (which $argv[1]) $argv[2..-1]'
a ydl 'while not yt-dlp $argv; end;:'
a 7zstd '7z a -m0=zstd -mx22 -mmt=8 -mfb=273 -md=256m -ms=on (realpath $argv[1]).7z'
a compress '7z a -m0=flzma2 -mx9 -mmt=8 -mfb=273 -md=256m -ms=on (realpath $argv[1]).7z'
a dwarf 'mkdwarfs -i . -o $PWD.dwarfs'
@ -63,7 +62,7 @@ a squash 'mksquashfs . $PWD.squashfs -comp zstd -b 1M -Xcompression-level 22'
a undwarfs 'mkdir dwarfs-root; dwarfsextract -o dwarfs-root -i'
for i in (cat ~/.config/qutebrowser/quickmarks | cut -d ' ' -f1)
a $i "qb / \":quickmark-load $i\""
a $i "qb \":open -t $i\""
end
for i in getnative mcross nsz scdl spleeter thonny

View File

@ -1,32 +1,32 @@
#!/bin/sh
if [ "$1" == "-d" ]; then
if [ "$1" = "-d" ]; then
shift
tail -n +11 "$@" | zstd -do "$@"~ &&
mv "$@"~ "$@"
chmod +x "$@"
tail -n +11 "$1" | zstd -do "$1"~ &&
mv "$1"~ "$1"
chmod +x "$1"
else
if [ "$1" == "-p" ]; then
if [ "$1" = "-p" ]; then
shift
prefix="$1 "
shift
fi
cat > "$@"~ << 'EOF'
cat > "$1"~ << 'EOF'
#!/bin/sh
dir=`dirname $0`
dir=`dirname "$0"`
out=`mktemp -t .zzXXXX`
tail -n +11 $0 | zstd -cd > $out
chmod +x $out
ln -s $out $dir
tail -n +11 "$0" | zstd -cd > "$out"
chmod +x "$out"
ln -s "$out" "$dir"
trap "res=$?" 0 1 2 3 5 10 13 15
EOF
echo $prefix'$dir/`basename $out` $@' >> "$@"~
cat >> "$@"~ << 'EOF'
rm $out $dir/`basename $out`
echo $prefix'$dir/`basename $out` $@' >> "$1"~
cat >> "$1"~ << 'EOF'
rm "$out" "$dir"/`basename $out`
exit $res
EOF
zstd --ultra -22 "$@"
rm "$@"
cat "$@"~ "$@".zst > "$@"
rm "$@".zst "$@~"
chmod +x "$@"
zstd --ultra -22 "$1"
rm "$1"
cat "$1"~ "$1".zst > "$1"
rm "$1".zst "$1~"
chmod +x "$1"
fi