diff --git a/Library/Homebrew/cmd/--caskroom.rb b/Library/Homebrew/cmd/--caskroom.rb index df2dcb34d3..a9debf878a 100644 --- a/Library/Homebrew/cmd/--caskroom.rb +++ b/Library/Homebrew/cmd/--caskroom.rb @@ -6,7 +6,6 @@ require "abstract_command" module Homebrew module Cmd class Caskroom < AbstractCommand - sig { override.returns(String) } def self.command_name = "--caskroom" diff --git a/Library/Homebrew/cmd/--cellar.rb b/Library/Homebrew/cmd/--cellar.rb index fa1eff526e..aa7abafc65 100644 --- a/Library/Homebrew/cmd/--cellar.rb +++ b/Library/Homebrew/cmd/--cellar.rb @@ -1,32 +1,34 @@ -# typed: true +# typed: strict # frozen_string_literal: true -require "cli/parser" +require "abstract_command" module Homebrew - module_function + module Cmd + class Cellar < AbstractCommand + sig { override.returns(String) } + def self.command_name = "--cellar" - def __cellar_args - Homebrew::CLI::Parser.new do - description <<~EOS - Display Homebrew's Cellar path. *Default:* `$(brew --prefix)/Cellar`, or if - that directory doesn't exist, `$(brew --repository)/Cellar`. + cmd_args do + description <<~EOS + Display Homebrew's Cellar path. *Default:* `$(brew --prefix)/Cellar`, or if + that directory doesn't exist, `$(brew --repository)/Cellar`. - If is provided, display the location in the Cellar where - would be installed, without any sort of versioned directory as the last path. - EOS + If is provided, display the location in the Cellar where + would be installed, without any sort of versioned directory as the last path. + EOS - named_args :formula - end - end + named_args :formula + end - def __cellar - args = __cellar_args.parse - - if args.no_named? - puts HOMEBREW_CELLAR - else - puts args.named.to_resolved_formulae.map(&:rack) + sig { override.void } + def run + if args.no_named? + puts HOMEBREW_CELLAR + else + puts args.named.to_resolved_formulae.map(&:rack) + end + end end end end diff --git a/Library/Homebrew/test/cmd/--cellar_spec.rb b/Library/Homebrew/test/cmd/--cellar_spec.rb index 45bcc8dfa3..82eb47958c 100644 --- a/Library/Homebrew/test/cmd/--cellar_spec.rb +++ b/Library/Homebrew/test/cmd/--cellar_spec.rb @@ -1,8 +1,9 @@ # frozen_string_literal: true +require "cmd/--cellar" require "cmd/shared_examples/args_parse" -RSpec.describe "brew --cellar" do +RSpec.describe Homebrew::Cmd::Cellar do it_behaves_like "parseable arguments" it "prints Homebrew's Cellar", :integration_test do