Commit ab43df5
xxwhirlpool
·
2026-09-27 16:41:02 -0400 EDT
parent c2b178f
add support for different file exts in paste.rb
1 files changed,
+5,
-1
+5,
-1
| ... | ... | @@ -2,8 +2,12 @@ | |
| 2 | 2 | ||
| 3 | 3 | require "tempfile" | |
| 4 | 4 | ||
| 5 | + | # provide file ext thru arg | |
| 6 | + | # if not provided it's .txt | |
| 7 | + | ext = ARGV[0] || "txt" | |
| 8 | + | ||
| 5 | 9 | # define tmpfile | |
| 6 | - | tmp = Tempfile.create("pico-pastes-") | |
| 10 | + | tmp = Tempfile.create(["pico-pastes-", ".#{ext}"]) | |
| 7 | 11 | tmpfp = tmp.path | |
| 8 | 12 | ||
| 9 | 13 | # use $EDITOR, if empty use `nano` |