aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2026-04-10 21:09:05 -0300
committerEuAndreh <eu@euandre.org>2026-04-10 21:11:44 -0300
commit66e72411a4d249187edde51ee1c99cc992c49d82 (patch)
tree257b75afae80c3bc76bec442470ae663ca795742 /bin
parentbin/with-{one,two}-monitor{,s}: Update to new setup (diff)
downloaddotfiles-66e72411a4d249187edde51ee1c99cc992c49d82.tar.gz
dotfiles-66e72411a4d249187edde51ee1c99cc992c49d82.tar.xz
bin/plop: Add new working utilityHEADmain
Diffstat (limited to 'bin')
-rwxr-xr-xbin/plop39
1 files changed, 39 insertions, 0 deletions
diff --git a/bin/plop b/bin/plop
new file mode 100755
index 0000000..33a1b05
--- /dev/null
+++ b/bin/plop
@@ -0,0 +1,39 @@
+#!/bin/sh
+set -euo pipefail
+
+usage() {
+ cat <<-'EOF'
+ Usage:
+ plop [-m MODE] FILE
+ EOF
+}
+
+MODE=
+while getopts 'm:' flag; do
+ case "$flag" in
+ (m)
+ MODE="$OPTARG"
+ ;;
+ (*)
+ usage >&2
+ exit 2
+ ;;
+ esac
+done
+shift $((OPTIND - 1))
+
+
+FILE="${1:-}"
+
+eval "$(assert-arg -- "$FILE" 'FILE')"
+
+
+
+tmp="${FILE}.plop.$$"
+trap "rm -f '$tmp'" EXIT
+
+cat > "$tmp"
+if [ -n "$MODE" ]; then
+ chmod "$MODE" "$tmp"
+fi
+mv "$tmp" "$FILE"