Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to show conversation (in reply to) for a tweet #274

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion lib/t/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -745,8 +745,34 @@ def status(status_id) # rubocop:disable CyclomaticComplexity
array << ['Location', location] unless location.nil?
print_table(array)
end
end

# showing information about conversation
if status.in_reply_to_status_id?
# print new line preparing for the thread tweet
print "\n";
print "In reply to ...\n\n"

# create an array in order to supply it to print_tweets
statusArray = Array.new

# if this tweet is a reply to the upper-in-level tweet, then also show that information out too
while status.in_reply_to_status_id?do
# get tweet, use the same options to get tweet supplied as parameter to this def
status = client.status(status.in_reply_to_status_id.to_i, opts)

# add status to array
statusArray.push(status)
end

# if array is not empty then print tweets out with respect to the options sending in
unless statusArray.empty?
# print tweet
# adhere to options sending in
print_tweets(statusArray)
end
end
end

desc 'timeline [USER]', "Returns the #{DEFAULT_NUM_RESULTS} most recent Tweets posted by a user."
method_option 'csv', aliases: '-c', type: :boolean, desc: 'Output in CSV format.'
method_option 'decode_uris', aliases: '-d', type: :boolean, desc: 'Decodes t.co URLs into their original form.'
Expand Down