# frozen_string_literal: true require 'thor' module Dri module Commands class Fetch < Thor namespace :fetch desc 'featureflags', 'Display feature flag changes for today' method_option :help, aliases: '-h', type: :boolean, desc: 'Display usage information' def featureflags(*) if options[:help] invoke :help, ['featureflags'] else require_relative 'fetch/featureflags' Dri::Commands::Fetch::FeatureFlags.new(options).execute end end desc 'triaged', 'Display triaged failures' method_option :help, aliases: '-h', type: :boolean, desc: 'Display usage information' def triaged(*) if options[:help] invoke :help, ['triaged'] else require_relative 'fetch/triaged' Dri::Commands::Fetch::Triaged.new(options).execute end end desc 'testcases', 'Display failing testcases' method_option :help, aliases: '-h', type: :boolean, desc: 'Display usage information' method_option :filter_pipelines, type: :boolean, desc: 'Filter by pipeline' def testcases(*) if options[:help] invoke :help, ['testcases'] else require_relative 'fetch/testcases' Dri::Commands::Fetch::Testcases.new(options).execute end end desc 'failures', 'Display failures opened on a given period.' method_option :help, aliases: '-h', type: :boolean, desc: 'Display usage information' method_option :sort_by, type: :string, desc: 'Shows failures in specified order' method_option :start_date, type: :string, desc: 'Fetch failures created after this date (YYYY-MM-DD)' method_option :end_date, type: :string, desc: 'Fetch failures created before this date (YYYY-MM-DD)' method_option :cutoff, type: :string, desc: 'Fetch failures created after this time (HH:MM)' def failures(*) if options[:help] invoke :help, ['failures'] else require_relative 'fetch/failures' Dri::Commands::Fetch::Failures.new(options).execute end end desc 'pipelines', 'Display status of pipelines' method_option :help, aliases: '-h', type: :boolean, desc: 'Display pipelines usage information' method_option :full_runs_only, type: :boolean, desc: 'Displays full pipeline runs only' def pipelines(*) return invoke :help, %w[pipelines] if options[:help] require_relative 'fetch/pipelines' Dri::Commands::Fetch::Pipelines.new(options).execute end desc 'runbooks', 'Fetch runbooks' method_option :help, aliases: '-h', type: :boolean, desc: 'Display usage information' def runbooks(*args) return invoke :help, %w[runbooks] if options[:help] require_relative 'fetch/runbooks' Dri::Commands::Fetch::Runbooks.new(options).execute(folder: args.first) end end end end