1
0
Fork 0
mirror of https://github.com/notwa/rc synced 2024-06-28 18:17:11 -07:00
rc/sh/scropt

20 lines
547 B
Bash
Executable File

#!/usr/bin/env bash
# YES_ZSH
scropt() { ### @-
### run `scrot` through `optipng` and save the result to `~/play/$(now).png`.
###
### ```
### $ ~/sh/sc $(~/sh/scropt -s -d0.5)
### ```
local now=$(now)
[ $? -eq 0 ] || return $?
local fn="$HOME/play/$now.png"
scrot "$fn" -e "optipng -quiet \$f" "$@"
[ $? -eq 0 ] && echo "$fn" || return $?
}
preload() { local preload='set -- $@'; while [ $# -gt 0 ]; do . ~/sh/$1 || exit 2; shift; done; }
eval ${preload:-preload} now
[ -n "${preload+-}" ] || scropt "$@"