Sha256: 4db65bcaeaff32fc915a0e49a8d51bf12f2794c482bbccf3bdcf0f8070d8f128

Contents?: true

Size: 1.06 KB

Versions: 3

Compression:

Stored size: 1.06 KB

Contents

# frozen_string_literal: true

require "thor"

require_relative "../base"

module Neetob
  class CLI
    module Github
      module Labels
        class Delete < Base
          attr_accessor :apps, :sandbox, :labels

          def initialize(apps, labels, sandbox = false)
            super()
            @labels = labels
            @apps = apps
            @sandbox = sandbox
          end

          def run
            matching_apps = find_all_matching_apps(apps, :github, sandbox)
            matching_apps.each do |app|
              ui.info("\n Deleting labels from #{app} repo \n")
              labels.each do |label|
                delete_label(app, label)
              end
            end
          end

          private

            def delete_label(app, label)
              if client.delete_label!(app, label)
                ui.success("The \"#{label}\" label deleted successfully")
              else
                ui.error("The \"#{label}\" label can't be deleted. Please check and try again")
              end
            end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
neetob-0.1.2 lib/neetob/cli/github/labels/delete.rb
neetob-0.1.1 lib/neetob/cli/github/labels/delete.rb
neetob-0.1.0 lib/neetob/cli/github/labels/delete.rb