Commit c2b178f
xxwhirlpool
·
2026-09-27 14:43:41 -0400 EDT
parent d3e2c4d
wrapper script to upload tmpfiles to pico.sh pastes
1 files changed,
+24,
-0
+24,
-0
1@@ -0,0 +1,24 @@
2+#!/usr/bin/env ruby
3+
4+require "tempfile"
5+
6+# define tmpfile
7+tmp = Tempfile.create("pico-pastes-")
8+tmpfp = tmp.path
9+
10+# use $EDITOR, if empty use `nano`
11+editor = ENV["EDITOR"] ||= "nano"
12+
13+# open tmpfile in editor
14+system("#{editor} #{tmpfp}")
15+
16+# check if tmpfile exists or is empty
17+# if one or the other, exit here
18+if !File.exist?("#{tmpfp}") || File.empty?("#{tmpfp}")
19+ puts "ERROR: #{tmpfp} does not exist or is empty"
20+ exit 1
21+end
22+
23+# send to pastes.sh
24+cmd = "rsync #{tmpfp} pastes.sh:/"
25+system(cmd)