lib/dri/commands/fetch/failures.rb in dri-0.2.0 vs lib/dri/commands/fetch/failures.rb in dri-0.3.0

- old
+ new

@@ -8,10 +8,17 @@ class Fetch class Failures < Dri::Command include Dri::Utils::Table using Refinements + SORT_BY_OPTIONS = { + title: 0, + triaged: 1, + author: 2, + url: 3 + }.freeze + def initialize(options) @options = options @today_iso_format = Time.now.strftime('%Y-%m-%dT00:00:00Z') end @@ -63,9 +70,11 @@ end end end failures << [title, triaged, author, url] + + failures.sort_by! { |e| e[SORT_BY_OPTIONS[@options[:sort_by].to_sym]] } if @options[:sort_by] end end if @options[:urgent] print_table(labels, urgent, alignments: [:left, :center, :center, :left])