aboutsummaryrefslogtreecommitdiffstats
path: root/util/hz
blob: baa5bfb5540c538515ca6b3bf3aaf4a2e33168fb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash

# Simple, minimalist command line tool to post status to hubzilla via the API. Requires curl.
# Put it in your path, and sneeze your statuses to the zot network from your shell.

CONF=${HOME}/.hubzilla

usage () {
echo "usage: hz [conffile]"
echo "Create a conf file, either in .hubzilla in your home directory, or supplied as an arg"
echo " USER=youruserame "
echo " PASS=yourpass"
echo " HUB=your.hub.domain.org"
echo
echo "Type \"hz\" (with or without a conf file as an arg), then enter your message. Hit ENTER to send."

}

CUR=`which curl`

[ "$CUR" ] || { echo "curl is not installed or on your path"; usage; exit 1; }

[ "$1" ] && CONF="$1"


. ${CONF}

[ "$USER" ] || { echo "no USER"; usage; exit 1; }
[ "$PASS" ] || { echo "no PASS"; usage; exit 1; }
[ "$HUB" ] || { echo "no HUB"; usage; exit 1; }

echo "enter your message to be posted as $USER @ $HUB, then hit ENTER to send:"

(read MSG; curl -ssl -u${USER}:${PASS} --data-urlencode "status=${MSG}" https://${HUB}/api/statuses/update )