Class: Githuh::CLI::Commands::Issue::ExportPaginated

Inherits:
Export
  • Object
show all
Defined in:
lib/githuh/cli/commands/issue/export_paginated.rb

Constant Summary

Constants inherited from Export

Githuh::CLI::Commands::Issue::Export::CSV_HEADER, Githuh::CLI::Commands::Issue::Export::CSV_MAP, Githuh::CLI::Commands::Issue::Export::DEFAULT_FORMAT, Githuh::CLI::Commands::Issue::Export::DEFAULT_OUTPUT_FORMAT, Githuh::CLI::Commands::Issue::Export::FORMATS, Githuh::CLI::Commands::Issue::Export::LABEL_ESTIMATES

Instance Attribute Summary

Attributes inherited from Export

#file, #filename, #format, #issues, #output, #record_count, #repo

Attributes inherited from Base

#box, #client, #context, #info, #per_page, #token, #verbose

Instance Method Summary collapse

Methods inherited from Export

#bar_size, #call, #default_options, #filter_issues, find_user, issue_labels, #render_as_csv, #render_as_json

Methods inherited from Base

#call, inherited

Instance Method Details

#fetch_issuesObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/githuh/cli/commands/issue/export_paginated.rb', line 10

def fetch_issues
  page = 0
  bar  = nil

  [].tap do |issue_list|
    loop do
      options = default_options.merge({
                                        page:     page,
                                        per_page: per_page,
                                      })

      puts "page: #{page}"
      issues_page = client.issues(repo, **options)

      break if issues_page.nil? || issues_page.empty?

      issue_list.concat(issues_page)

      bar("#{repo} Issues Export")&.advance
      page              += 1
      self.record_count += issues_page.size
    end

    bar&.finish; puts

    issue_list << issues
  end.flatten
end