initial commit master
initial commit

file:b/.gitignore (new)
--- /dev/null
+++ b/.gitignore
@@ -1,1 +1,2 @@
+/config
 

file:b/config.sample (new)
--- /dev/null
+++ b/config.sample
@@ -1,1 +1,4 @@
+export PUSHOVER_APP_TOKEN=""
+export PUSHOVER_USER_KEY=""
 
+

file:b/send (new)
--- /dev/null
+++ b/send
@@ -1,1 +1,29 @@
+CONFIG=$(dirname $0)/config
 
+if [ -f ${CONFIG} ]; then
+    . ${CONFIG}
+fi
+
+if [ $# -eq 4 ]; then
+        APP_TOKEN=${1}
+        USER_KEY=${2}
+        TITLE=${3}
+        MESSAGE=${4}
+elif [ $# -eq 2 ] && [ -n ${PUSHOVER_APP_TOKEN} ] && [ -n ${PUSHOVER_USER_KEY} ]; then
+	APP_TOKEN=${PUSHOVER_APP_TOKEN}
+	USER_KEY=${PUSHOVER_USER_KEY}
+	TITLE=${1}
+	MESSAGE=${2}
+else
+	echo "usage 1: if you defined environment variables PUSHOVER_APP_TOKEN and PUSHOVER_USER_KEY use ./send \"title\" \"message\""
+	echo "usage 2: ./send \"APP_TOKEN\" \"USER_KEY\" \"title\" \"message\""
+	exit 1
+fi
+
+curl -s \
+  --form-string "token=${APP_TOKEN}" \
+  --form-string "user=${USER_KEY}" \
+  --form-string "title=${TITLE}" \
+  --form-string "message=${MESSAGE}" \
+  https://api.pushover.net/1/messages.json
+

comments