Sha256: ed261f4de924d160be1c80062024322252157131521aa29f51381a3f9b3e9d00
Contents?: true
Size: 961 Bytes
Versions: 2
Compression:
Stored size: 961 Bytes
Contents
#!/usr/bin/env ruby # Trap interrupts to quit cleanly. See # https://twitter.com/mitchellh/status/283014103189053442 Signal.trap("INT") { exit 1 } require 'oauth' require 't' require 'twitter' # Output message to $stderr, prefixed with the program name def pute(*args) args.first.insert(0, "#{$0}: ") $stderr.puts(*args) end begin T::CLI.start(ARGV) rescue Interrupt pute "Quitting..." exit 1 rescue OAuth::Unauthorized pute "Authorization failed" exit 1 rescue Twitter::Error::TooManyRequests => error pute error.message, "The rate limit for this request will reset in #{error.rate_limit.reset_in} seconds.", "While you wait, consider making a polite request for Twitter to increase the API rate limit at https://dev.twitter.com/discussions/10644" exit 1 rescue Twitter::Error::Unauthorized => error pute error.message, "Run `t authorize` to authorize." exit 1 rescue Twitter::Error => error pute error.message exit 1 end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
t-1.7.1 | bin/t |
t-1.7.0 | bin/t |