31 lines
760 B
Ruby
Raw Normal View History

2024-03-21 08:31:45 -07:00
# typed: strict
# frozen_string_literal: true
2024-03-21 08:31:45 -07:00
require "abstract_command"
2017-02-07 23:25:02 -08:00
require "formula"
module Homebrew
2024-03-21 08:31:45 -07:00
module DevCmd
class FormulaCmd < AbstractCommand
cmd_args do
description <<~EOS
Display the path where <formula> is located.
EOS
2020-07-30 18:40:10 +02:00
2024-03-21 08:31:45 -07:00
named_args :formula, min: 1, without_api: true
end
2024-03-21 08:31:45 -07:00
sig { override.void }
def run
formula_paths = args.named.to_paths(only: :formula).select(&:exist?)
if formula_paths.blank? && args.named
.to_paths(only: :cask)
.any?(&:exist?)
odie "Found casks but did not find formulae!"
end
formula_paths.each { puts _1 }
end
end
2017-02-07 23:25:02 -08:00
end
end