1
0
mirror of https://github.com/danbee/dotfiles-local synced 2025-03-04 08:49:07 +00:00
dotfiles-local/bin/tools_lib/tools.rb
2021-12-16 16:09:07 -06:00

33 lines
562 B
Ruby

require_relative "tools_file"
require_relative "tool_icons"
class Tools
include ToolIcons
attr_reader :tools
def initialize
@tools = ToolsFile.new.tools
end
def list_tools
tools.sort.each do |tool, version|
if available_tools.include? tool
puts "#{tool_icon(tool)}#{tool.ljust(max_length)} #{version}"
end
end
end
def max_length
@max_length ||= installed_tools.max_by(&:length).length
end
def installed_tools
tools.keys & available_tools
end
def available_tools
TOOL_ICONS.keys
end
end