summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xnixup2
-rwxr-xr-xrecord18
-rwxr-xr-xsnapshot4
3 files changed, 15 insertions, 9 deletions
diff --git a/nixup b/nixup
index 4db0a8f..62e8878 100755
--- a/nixup
+++ b/nixup
@@ -13,7 +13,9 @@ if [ ! "$(find . -maxdepth 0 -name 'flake.nix')" ] &&
exit 1
fi
+# By default build the configuration on the remote host.
BUILD_LOCAL=false
+
while getopts ":hl" arg; do
case "$arg" in
l) BUILD_LOCAL=true ;;
diff --git a/record b/record
index 051765d..1430df2 100755
--- a/record
+++ b/record
@@ -1,17 +1,19 @@
#!/bin/sh
# record: Record an mp4 video using ffmpeg. By default it will output the
-# video to './out.mp4'. Requires ffmpeg to be built with Xcb support on NixOS.
-# Screen resolution can be specified, but defaults to 1080p.
+# video to './out.mp4' at 1080p. On NixOS, ffmpeg requires Xcb support.
-die() { echo "$0: $*" >&2; exit 1; }
-try() { "$@" || die "cannot $*"; }
+set -eu
while getopts ":r:h" args; do
case "$args" in
r) RESOLUTION="$OPTARG" ;;
- h) die "record [-r RESOLUTION] FILE" ;;
- *) die "-$OPTARG is not an option." ;;
+ h) echo "Usage: record [-r RESOLUTION] FILE" >&2
+ exit 1
+ ;;
+ *) printf "Invalid option: -%s\nSee '-h' for usage\n" "$OPTARG" >&2
+ exit 1
+ ;;
esac
done
shift $((OPTIND - 1))
@@ -19,5 +21,5 @@ shift $((OPTIND - 1))
FILE="${1:-out}"
: "${RESOLUTION:=1920x1080}"
-try ffmpeg -y -f x11grab -s "$RESOLUTION" -framerate 60 -i :0.0 -f alsa \
- -i default -nostats -hide_banner -loglevel quiet "${FILE}.mp4"
+ffmpeg -y -f x11grab -s "$RESOLUTION" -framerate 60 -i :0.0 -f alsa \
+ -i default -nostats -hide_banner -loglevel quiet "${FILE}.mp4"
diff --git a/snapshot b/snapshot
index 380051a..c105225 100755
--- a/snapshot
+++ b/snapshot
@@ -32,6 +32,8 @@ full() {
while getopts ":f" arg; do
case "$arg" in
f) full ;;
- *) printf "Invalid option: -%s\n" "$OPTARG" >&2 && exit 1 ;;
+ *) printf "Invalid option: -%s\n" "$OPTARG" >&2
+ exit 1
+ ;;
esac
done