some n00b posted how to tweet from the command-line. I'm going to out-n00b them and add bash completion to command-line twitter so that I can autocomplete peoples' nicks that I've twot before.
twit() {
twitfile="${HOME}/.twits"
url="https://twitter.com/statuses/update.xml"
__add() {
grep -q $1 ${twitfile} || echo $1 >> ${twitfile}
}
for word in $*; do
[ '@' = "${word/[^@]*/}" ] && __add ${word}
done
output=$(curl -v -n -d status="$*" ${url} 2>&1)
[ $? != 0 ] && echo ${output}
}
complete_twit() {
local cur=${COMP_WORDS[COMP_CWORD]}
COMPREPLY=( $( grep -i ${cur} ${HOME}/.twits ) )
}
complete -F complete_twit twit