def status(status_id)
status_id = status_id.strip_commas
status = client.status(status_id.to_i, :include_my_retweet => false)
location = if status.place
if status.place.name && status.place.attributes && status.place.attributes['street_address'] && status.place.attributes['locality'] && status.place.attributes['region'] && status.place.country
[status.place.name, status.place.attributes['street_address'], status.place.attributes['locality'], status.place.attributes['region'], status.place.country].join(", ")
elsif status.place.name && status.place.attributes && status.place.attributes['locality'] && status.place.attributes['region'] && status.place.country
[status.place.name, status.place.attributes['locality'], status.place.attributes['region'], status.place.country].join(", ")
elsif status.place.full_name && status.place.attributes && status.place.attributes['region'] && status.place.country
[status.place.full_name, status.place.attributes['region'], status.place.country].join(", ")
elsif status.place.full_name && status.place.country
[status.place.full_name, status.place.country].join(", ")
elsif status.place.full_name
status.place.full_name
else
status.place.name
end
elsif status.geo
reverse_geocode(status.geo)
end
if options['csv']
say ["ID", "Text", "Screen name", "Posted at", "Location", "Retweets", "Source", "URL"].to_csv
say [status.id, HTMLEntities.new.decode(status.text), status.from_user, csv_formatted_time(status), location, status.retweet_count, strip_tags(status.source), "https://twitter.com/#{status.from_user}/status/#{status.id}"].to_csv
else
array = []
array << ["ID", status.id.to_s]
array << ["Text", HTMLEntities.new.decode(status.text).gsub(/\n+/, ' ')]
array << ["Screen name", "@#{status.from_user}"]
array << ["Posted at", "#{ls_formatted_time(status)} (#{time_ago_in_words(status.created_at)} ago)"]
array << ["Location", location] unless location.nil?
array << ["Retweets", number_with_delimiter(status.retweet_count)]
array << ["Source", strip_tags(status.source)]
array << ["URL", "https://twitter.com/#{status.from_user}/status/#{status.id}"]
print_table(array)
end
end