Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;;; tweet.clj
- ;;;
- ;;; Run this when you want to tweet
- ;;;
- ;;; -h for usage
- ;;;
- ;;; Written and maintained by Stephen Ramsay
- ;;;
- ;;; Last Modified: Wed Mar 17 23:44:42 CDT 2010
- (ns gropius.sramsay.nth
- (:use clojure.contrib.command-line))
- (load-file "auth.clj")
- ;;
- ;; Parse the command line and go
- ;;
- (with-command-line
- *command-line-args*
- "Usage: tweet [-D username] message."
- [[direct? D? "Direct message" false]]
- (let [tweet (apply str (interpose " " *command-line-args*)) ; Awkward
- length (.length tweet)] ; check length ; way to get a
- (if (<= length 140) ; string.
- (do
- (.updateStatus (get-auth) tweet)) ; Tweet!
- (do
- (println length)
- (printf "\nSorry, you lost me at:\n\n%s\n" (apply str (take 140 tweet)))
- (printf "\nYou need to get rid of %d characters.\n" (- length 140))))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement