<commit_before>module Heroku::Command
	class Addons < BaseWithApp
		def index
			installed = heroku.installed_addons(app)
			if installed.empty?
				display "No addons installed"
			else
				installed.each do |addon|
					display addon['name']
				end
			end
		end

		def info
			addons = heroku.addons
			if addons.empty?
				display "No addons available currently"
			else
				addons.each do |addon|
					display addon['name'].ljust(34) + (addon['url'] || '')
				end
			end
		end

		def add
			addon = args.shift
			config = {}
			args.each do |arg|
				key, value = arg.strip.split('=', 2)
				if value.nil?
					addon_error("Non-config value \"#{arg}\".  Everything after the addon name should be a key=value pair.")
					exit 1
				else
					config[key] = value
				end
			end

			display "Adding #{addon} to #{app}...", false
			display addon_run { heroku.install_addon(app, addon, config) }
		end

		def remove
			args.each do |name|
				display "Removing #{name} from #{app}...", false
				display addon_run { heroku.uninstall_addon(app, name) }
			end
		end

		def clear
			heroku.installed_addons(app).each do |addon|
				display "Removing #{addon['description']} from #{app}...", false
				display addon_run { heroku.uninstall_addon(app, addon['name']) }
			end
		end

		def confirm_billing
			display("This action will cause your account to be billed at the end of the month")
			display("Are you sure you want to do this? (y/n) ", false)
			if ask.downcase == 'y'
				heroku.confirm_billing
				return true
			end
		end

		private
			def addon_run
				yield
				'Done.'
			rescue RestClient::ResourceNotFound => e
				addon_error("no addon by that name")
			rescue RestClient::RequestFailed => e
				if e.http_code == 402
					confirm_billing ? retry : 'Canceled'
				else
					error = Heroku::Command.extract_error(e.http_body)
					addon_error(error)
				end
			end

			def addon_error(message)
				"FAILED\n" + message.split("\n").map { |line| '!    ' + line }.join("\n")
			end
	end
end<commit_msg>cosmetics - addons messages<commit_after>module Heroku::Command
	class Addons < BaseWithApp
		def index
			installed = heroku.installed_addons(app)
			if installed.empty?
				display "No addons installed"
			else
				installed.each do |addon|
					display addon['name']
				end
			end
		end

		def info
			addons = heroku.addons
			if addons.empty?
				display "No addons available currently"
			else
				addons.each do |addon|
					display addon['name'].ljust(34) + (addon['url'] || '')
				end
			end
		end

		def add
			addon = args.shift
			config = {}
			args.each do |arg|
				key, value = arg.strip.split('=', 2)
				if value.nil?
					addon_error("Non-config value \"#{arg}\".  Everything after the addon name should be a key=value pair.")
					exit 1
				else
					config[key] = value
				end
			end

			display "Adding #{addon} to #{app}... ", false
			display addon_run { heroku.install_addon(app, addon, config) }
		end

		def remove
			args.each do |name|
				display "Removing #{name} from #{app}... ", false
				display addon_run { heroku.uninstall_addon(app, name) }
			end
		end

		def clear
			heroku.installed_addons(app).each do |addon|
				display "Removing #{addon['description']} from #{app}... ", false
				display addon_run { heroku.uninstall_addon(app, addon['name']) }
			end
		end

		def confirm_billing
			display("This action will cause your account to be billed at the end of the month")
			display("Are you sure you want to do this? (y/n) ", false)
			if ask.downcase == 'y'
				heroku.confirm_billing
				return true
			end
		end

		private
			def addon_run
				yield
				'done'
			rescue RestClient::ResourceNotFound => e
				addon_error("no addon by that name")
			rescue RestClient::RequestFailed => e
				if e.http_code == 402
					confirm_billing ? retry : 'canceled'
				else
					error = Heroku::Command.extract_error(e.http_body)
					addon_error(error)
				end
			end

			def addon_error(message)
				"FAILED\n" + message.split("\n").map { |line| ' !   ' + line }.join("\n")
			end
	end
end
{'fraction_non_alphanumeric': 0.11610671936758893, 'fraction_numerical': 0.003458498023715415, 'mean_word_length': 2.8090310442144872, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2108751', 'n_tokens_mistral': 1745, 'n_tokens_neox': 1367, 'n_words': 397}