Sha256: a58a6f8a5606ea17fdd5206d7f657901357ec0d27608829cc325180558d7bc95

Contents?: true

Size: 1.03 KB

Versions: 2

Compression:

Stored size: 1.03 KB

Contents

# frozen_string_literal: true

require_relative 'export'

module Githuh
  module CLI
    module Commands
      module Issue
        class ExportPaginated < Export
          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
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
githuh-0.3.0 lib/githuh/cli/commands/issue/export_paginated.rb
githuh-0.2.1 lib/githuh/cli/commands/issue/export_paginated.rb