diff --git a/Library/Homebrew/exceptions.rb b/Library/Homebrew/exceptions.rb index c8c65fce31..05bf373d71 100644 --- a/Library/Homebrew/exceptions.rb +++ b/Library/Homebrew/exceptions.rb @@ -49,6 +49,9 @@ class UnsupportedInstallationMethod < RuntimeError; end class MultipleVersionsInstalledError < RuntimeError; end +# Raised when a path is not a keg. +# +# @api internal class NotAKegError < RuntimeError; end # Raised when a keg doesn't exist. diff --git a/Library/Homebrew/extend/kernel.rb b/Library/Homebrew/extend/kernel.rb index fd651ad2b7..d9f0f2aa6f 100644 --- a/Library/Homebrew/extend/kernel.rb +++ b/Library/Homebrew/extend/kernel.rb @@ -255,7 +255,9 @@ module Kernel raise ErrorDuringExecution.new([cmd, *args], status: $CHILD_STATUS) end - # Prints no output. + # Run a system comand without any output. + # + # @api internal def quiet_system(cmd, *args) Homebrew._system(cmd, *args) do # Redirect output streams to `/dev/null` instead of closing as some programs diff --git a/Library/Homebrew/system_command.rb b/Library/Homebrew/system_command.rb index 55ec519789..c64d490a31 100644 --- a/Library/Homebrew/system_command.rb +++ b/Library/Homebrew/system_command.rb @@ -12,14 +12,22 @@ require "utils/timer" # Class for running sub-processes and capturing their output and exit status. # -# @api private +# @api internal class SystemCommand # Helper functions for calling {SystemCommand.run}. + # + # @api internal module Mixin + # Run a fallible system command. + # + # @api internal def system_command(executable, **options) SystemCommand.run(executable, **options) end + # Run an infallible system command. + # + # @api internal def system_command!(command, **options) SystemCommand.run!(command, **options) end diff --git a/Library/Homebrew/utils/formatter.rb b/Library/Homebrew/utils/formatter.rb index d4e5124796..8bed52b5c1 100644 --- a/Library/Homebrew/utils/formatter.rb +++ b/Library/Homebrew/utils/formatter.rb @@ -14,6 +14,9 @@ module Formatter prefix("==>", string, color) end + # Format a string as headline. + # + # @api internal def self.headline(string, color: nil) arrow("#{Tty.bold}#{string}#{Tty.reset}", color:) end