lib/t/list.rb in t-2.8.0 vs lib/t/list.rb in t-2.9.0
- old
+ new
@@ -21,11 +21,11 @@
@rcfile = T::RCFile.instance
super
end
desc 'add LIST USER [USER...]', 'Add members to a list.'
- method_option 'id', :aliases => '-i', :type => :boolean, :desc => 'Specify input as Twitter user IDs instead of screen names.'
+ method_option 'id', aliases: '-i', type: :boolean, desc: 'Specify input as Twitter user IDs instead of screen names.'
def add(list_name, user, *users)
added_users, number = fetch_users(users.unshift(user), options) do |users_to_add|
client.add_list_members(list_name, users_to_add)
users_to_add
end
@@ -37,20 +37,20 @@
say "Run `#{File.basename($PROGRAM_NAME)} list remove #{list_name} #{added_users.collect { |added_user| "@#{added_user}" }.join(' ')}` to undo."
end
end
desc 'create LIST [DESCRIPTION]', 'Create a new list.'
- method_option 'private', :aliases => '-p', :type => :boolean
+ method_option 'private', aliases: '-p', type: :boolean
def create(list_name, description = nil)
- opts = description ? {:description => description} : {}
- opts.merge!(:mode => 'private') if options['private']
+ opts = description ? {description: description} : {}
+ opts.merge!(mode: 'private') if options['private']
client.create_list(list_name, opts)
say "@#{@rcfile.active_profile[0]} created the list \"#{list_name}\"."
end
desc 'information [USER/]LIST', 'Retrieves detailed information about a Twitter list.'
- method_option 'csv', :aliases => '-c', :type => :boolean, :desc => 'Output in CSV format.'
+ method_option 'csv', aliases: '-c', type: :boolean, desc: 'Output in CSV format.'
def information(user_list)
owner, list_name = extract_owner(user_list, options)
list = client.list(owner, list_name)
if options['csv']
require 'csv'
@@ -69,27 +69,27 @@
array << ['Mode', list.mode]
array << ['URL', list.uri]
print_table(array)
end
end
- map %w[details] => :information
+ map %w(details) => :information
desc 'members [USER/]LIST', 'Returns the members of a Twitter list.'
- method_option 'csv', :aliases => '-c', :type => :boolean, :desc => 'Output in CSV format.'
- method_option 'id', :aliases => '-i', :type => :boolean, :desc => 'Specify user via ID instead of screen name.'
- method_option 'long', :aliases => '-l', :type => :boolean, :desc => 'Output in long format.'
- method_option 'reverse', :aliases => '-r', :type => :boolean, :desc => 'Reverse the order of the sort.'
- method_option 'sort', :aliases => '-s', :type => :string, :enum => %w[favorites followers friends listed screen_name since tweets tweeted], :default => 'screen_name', :desc => 'Specify the order of the results.', :banner => 'ORDER'
- method_option 'unsorted', :aliases => '-u', :type => :boolean, :desc => 'Output is not sorted.'
+ method_option 'csv', aliases: '-c', type: :boolean, desc: 'Output in CSV format.'
+ method_option 'id', aliases: '-i', type: :boolean, desc: 'Specify user via ID instead of screen name.'
+ method_option 'long', aliases: '-l', type: :boolean, desc: 'Output in long format.'
+ method_option 'reverse', aliases: '-r', type: :boolean, desc: 'Reverse the order of the sort.'
+ method_option 'sort', aliases: '-s', type: :string, enum: %w(favorites followers friends listed screen_name since tweets tweeted), default: 'screen_name', desc: 'Specify the order of the results.', banner: 'ORDER'
+ method_option 'unsorted', aliases: '-u', type: :boolean, desc: 'Output is not sorted.'
def members(user_list)
owner, list_name = extract_owner(user_list, options)
users = client.list_members(owner, list_name).to_a
print_users(users)
end
desc 'remove LIST USER [USER...]', 'Remove members from a list.'
- method_option 'id', :aliases => '-i', :type => :boolean, :desc => 'Specify input as Twitter user IDs instead of screen names.'
+ method_option 'id', aliases: '-i', type: :boolean, desc: 'Specify input as Twitter user IDs instead of screen names.'
def remove(list_name, user, *users)
removed_users, number = fetch_users(users.unshift(user), options) do |users_to_remove|
client.remove_list_members(list_name, users_to_remove)
users_to_remove
end
@@ -101,25 +101,25 @@
say "Run `#{File.basename($PROGRAM_NAME)} list add #{list_name} #{removed_users.collect { |removed_user| "@#{removed_user}" }.join(' ')}` to undo."
end
end
desc 'timeline [USER/]LIST', 'Show tweet timeline for members of the specified list.'
- 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.'
- method_option 'id', :aliases => '-i', :type => :boolean, :desc => 'Specify user via ID instead of screen name.'
- method_option 'long', :aliases => '-l', :type => :boolean, :desc => 'Output in long format.'
- method_option 'number', :aliases => '-n', :type => :numeric, :default => DEFAULT_NUM_RESULTS, :desc => 'Limit the number of results.'
- method_option 'relative_dates', :aliases => '-a', :type => :boolean, :desc => 'Show relative dates.'
- method_option 'reverse', :aliases => '-r', :type => :boolean, :desc => 'Reverse the order of the sort.'
+ 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.'
+ method_option 'id', aliases: '-i', type: :boolean, desc: 'Specify user via ID instead of screen name.'
+ method_option 'long', aliases: '-l', type: :boolean, desc: 'Output in long format.'
+ method_option 'number', aliases: '-n', type: :numeric, default: DEFAULT_NUM_RESULTS, desc: 'Limit the number of results.'
+ method_option 'relative_dates', aliases: '-a', type: :boolean, desc: 'Show relative dates.'
+ method_option 'reverse', aliases: '-r', type: :boolean, desc: 'Reverse the order of the sort.'
def timeline(user_list)
owner, list_name = extract_owner(user_list, options)
count = options['number'] || DEFAULT_NUM_RESULTS
opts = {}
opts[:include_entities] = !!options['decode_uris']
tweets = collect_with_count(count) do |count_opts|
client.list_timeline(owner, list_name, count_opts.merge(opts))
end
print_tweets(tweets)
end
- map %w[tl] => :timeline
+ map %w(tl) => :timeline
end
end