commit 5d76aacdbc6a4c73e39af31c063d38b7acd216c8 parent 805d64dd36710d59a5db4c69cfe87088327e3a1d Author: Claudio Alessi <smoppy@gmail.com> Date: Wed, 5 Sep 2018 23:37:05 +0200 [txthole] Public host as mandatory parameter Diffstat:
M | src/txthole | | | 17 | ++++++++++------- |
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/src/txthole b/src/txthole @@ -9,6 +9,7 @@ pastes="/tmp/pastes" fifo="/tmp/txthole.fifo" port="2023" +pubhost="" run() { paste="$1" @@ -19,16 +20,18 @@ run() { if [ -f "$p" ]; then cat "$p" else - if [ -n "$TXTHOLE_PUBHOST" ]; then - echo "http://$TXTHOLE_PUBHOST/$label" - echo "echo $label | nc $TXTHOLE_PUBHOST $port" - else - echo "$label" - fi + echo "$pubhost/$label" fi } main() { + pubhost="$1" + + if [ -z "$pubhost" ]; then + echo "Usage: $(basename "$0") <pubhost>" + exit 1 + fi + mkdir -pm 0740 "$pastes" rm -f "$fifo" mkfifo "$fifo" @@ -41,4 +44,4 @@ main() { rm -f "$fifo" } -main +main $@