brew/Library/Homebrew/bundle/whalebrew_dumper.rb
Mike McQuaid bdeca530ff
Migrate Homebrew/bundle to Homebrew/brew
Co-authored-by: Bo Anderson <mail@boanderson.me>
2025-03-19 06:47:01 +00:00

28 lines
701 B
Ruby

# typed: true # rubocop:todo Sorbet/StrictSigil
# frozen_string_literal: true
module Homebrew
module Bundle
module WhalebrewDumper
module_function
def reset!
@images = nil
end
def images
return [] unless Bundle.whalebrew_installed?
@images ||= `whalebrew list 2>/dev/null`.split("\n")
.reject { |line| line.start_with?("COMMAND ") }
.map { |line| line.split(/\s+/).last }
.uniq
end
def dump
images.map { |image| "whalebrew \"#{image}\"" }.join("\n")
end
end
end
end