lib/friends/commands/list.rb in friends-0.29 vs lib/friends/commands/list.rb in friends-0.30

- old
+ new

@@ -10,11 +10,12 @@ type: Stripped list_friends.flag [:tagged], arg_name: "@TAG", desc: "List only friends with the given tag", - type: Tag + type: Tag, + multiple: true list_friends.switch [:verbose], negatable: false, desc: "Output friend nicknames, locations, and tags" @@ -36,21 +37,23 @@ type: Integer list_activities.flag [:with], arg_name: "NAME", desc: "List only activities with the given friend", - type: Stripped + type: Stripped, + multiple: true list_activities.flag [:in], arg_name: "LOCATION", desc: "List only activities in the given location", type: Stripped list_activities.flag [:tagged], arg_name: "@TAG", desc: "List only activities with the given tag", - type: Tag + type: Tag, + multiple: true list_activities.flag [:since], arg_name: "DATE", desc: "List only activities on or after the given date", type: InputDate @@ -99,22 +102,11 @@ desc: "The number of friends to return", default_value: 10, type: Integer list_favorite_friends.action do |_, options| - favorites = @introvert.list_favorite_friends(limit: options[:limit]) - - if options[:limit] == 1 - puts "Your best friend is #{favorites.first}" - else - puts "Your favorite friends:" - - num_str_size = favorites.size.to_s.size + 1 - favorites.each.with_index(1) do |name, rank| - puts "#{"#{rank}.".ljust(num_str_size)} #{name}" - end - end + @introvert.list_favorite_friends(limit: options[:limit]) end end list_favorite.desc "List favorite locations" list_favorite.command :locations do |list_favorite_locations| @@ -123,21 +115,10 @@ desc: "The number of locations to return", default_value: 10, type: Integer list_favorite_locations.action do |_, options| - favorites = @introvert.list_favorite_locations(limit: options[:limit]) - - if options[:limit] == 1 - puts "Your favorite location is #{favorites.first}" - else - puts "Your favorite locations:" - - num_str_size = favorites.size.to_s.size + 1 - favorites.each.with_index(1) do |name, rank| - puts "#{"#{rank}.".ljust(num_str_size)} #{name}" - end - end + @introvert.list_favorite_locations(limit: options[:limit]) end end end end