Fix module_function errors

This commit is contained in:
Douglas Eichelberger 2023-03-06 15:11:10 -08:00
parent 1c44a8861d
commit 54fad14ff3
2 changed files with 6 additions and 10 deletions

View File

@ -6,10 +6,8 @@ require "cli/parser"
module Homebrew module Homebrew
extend T::Sig extend T::Sig
module_function
sig { returns(CLI::Parser) } sig { returns(CLI::Parser) }
def __prefix_args def self.__prefix_args
Homebrew::CLI::Parser.new do Homebrew::CLI::Parser.new do
description <<~EOS description <<~EOS
Display Homebrew's install path. *Default:* Display Homebrew's install path. *Default:*
@ -30,7 +28,7 @@ module Homebrew
end end
end end
def __prefix def self.__prefix
args = __prefix_args.parse args = __prefix_args.parse
raise UsageError, "`--installed` requires a formula argument." if args.installed? && args.no_named? raise UsageError, "`--installed` requires a formula argument." if args.installed? && args.no_named?
@ -89,7 +87,7 @@ module Homebrew
texlive/* texlive/*
].freeze ].freeze
def list_unbrewed def self.list_unbrewed
dirs = HOMEBREW_PREFIX.subdirs.map { |dir| dir.basename.to_s } dirs = HOMEBREW_PREFIX.subdirs.map { |dir| dir.basename.to_s }
dirs -= %w[Library Cellar Caskroom .git] dirs -= %w[Library Cellar Caskroom .git]

View File

@ -6,10 +6,8 @@ require "cli/parser"
module Homebrew module Homebrew
extend T::Sig extend T::Sig
module_function
sig { returns(CLI::Parser) } sig { returns(CLI::Parser) }
def log_args def self.log_args
Homebrew::CLI::Parser.new do Homebrew::CLI::Parser.new do
description <<~EOS description <<~EOS
Show the `git log` for <formula> or <cask>, or show the log for the Homebrew repository Show the `git log` for <formula> or <cask>, or show the log for the Homebrew repository
@ -37,7 +35,7 @@ module Homebrew
end end
end end
def log def self.log
args = log_args.parse args = log_args.parse
# As this command is simplifying user-run commands then let's just use a # As this command is simplifying user-run commands then let's just use a
@ -53,7 +51,7 @@ module Homebrew
end end
end end
def git_log(cd_dir, path = nil, tap = nil, args:) def self.git_log(cd_dir, path = nil, tap = nil, args:)
cd cd_dir do cd cd_dir do
repo = Utils.popen_read("git", "rev-parse", "--show-toplevel").chomp repo = Utils.popen_read("git", "rev-parse", "--show-toplevel").chomp
if tap if tap