#!/bin/shell
#
# This is a script to build and send a tweet using A2osx httpget facility.
#
# Copyright 2018. A2osx. All righs reserved. Released under GNU GPL 2.0
# license. See LICENSE file for more informaion.
#
# Writted by Patrick Kloepfer.  12-06-2018
#
echo "\f\n                      A2osX Tweeter
IF [ $# -GT 0 ] 
  ECHO "\n\n    Tweeter is a interactive program and takes
  ECHO "    no command line arguments. \n
  EXIT
FI
set kf = "IFTTT.KEY"
IF [ -f $kf ]
else
  echo "\n\n    KEY file not found.  Cannot continue.\n
  exit
FI
#set tmp = ${ROOT}tmp/
IF [ -d ${ROOT}tmp/ ] 
ELSE
  echo "\n\n    ${ROOT}tmp/ directory not found.  Cannot continue.\n
  exit
FI
set fn = ${ROOT}tmp/tweet
cat TT > ${fn}
echo -N "httpget maker.ifttt.com -U trigger/tweet/with/key/" >> ${fn}
cat ${kf} >> ${fn}
echo -N "?value1=" >> ${fn}
echo "\n\n     Enter tweet on multiple lines, they will be sent as 1 tweet.
echo "\n     Press return on a blank line to send Tweet.
echo -N "\n Tweet: "
READ Line1
echo -N "${Line1}\%20" >> ${fn}
ECHO "Sent\%20via\%20A2osX" >> ${fn}
$fn
