2024-03-21 08:31:45 -07:00
|
|
|
# typed: strict
|
2019-04-19 15:38:03 +09:00
|
|
|
# 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
|
2018-04-01 16:47:30 +05:30
|
|
|
|
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
|
2021-10-13 10:27:12 -06:00
|
|
|
end
|
2017-02-07 23:25:02 -08:00
|
|
|
end
|
|
|
|
end
|