Sha256: 0b4c303271402b0a100649dbbd05b84c95c48fe64fe2b36aeeaff0800356539b
Contents?: true
Size: 1.62 KB
Versions: 1
Compression:
Stored size: 1.62 KB
Contents
require_relative '../../command' require 'tty-table' module Dri module Commands class Fetch class Triaged < Dri::Command def initialize(options) @options = options end def execute(input: $stdin, output: $stdout) verify_config_exists title = add_color('Title', :bright_yellow) url = add_color('URL', :bright_yellow) type_label = add_color('Type', :bright_yellow) table_labels = [ title, url, type_label ] failures_triaged = [] logger.info "Fetching your triaged failures..." spinner.start response = api_client.fetch_triaged_failures(emoji: emoji, state: 'opened') if response.empty? logger.info "There are no failures triaged yet with #{add_color(emoji, :black, :on_white)}." exit 0 end response.each do |triaged| title = truncate(triaged["title"], 90) url = triaged["web_url"] labels = triaged["labels"] type = "" labels.each do |label| type = label.gsub!('failure::', ' ').to_s if label.include? "failure::" end labels = triaged["labels"] failures_triaged << [title, url, type] end spinner.stop table = TTY::Table.new(table_labels,failures_triaged) puts table.render(:ascii, resize: true, alignments: [:center, :center, :center]) end private def truncate(string, max) string.length > max ? "#{string[0...max]}..." : string end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dri-0.1.1 | lib/dri/commands/fetch/triaged.rb |