From e896c5c4cfb832bcb0b00d33a4ca35512946b9c6 Mon Sep 17 00:00:00 2001 From: hyuraku <32809703+hyuraku@users.noreply.github.com> Date: Sun, 10 Jan 2021 23:03:13 +0900 Subject: [PATCH] cmd/commands: add_only_bash_command_list --- Library/Homebrew/brew.rb | 2 ++ Library/Homebrew/commands.rb | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/Library/Homebrew/brew.rb b/Library/Homebrew/brew.rb index ca712613e4..cab8b2a852 100644 --- a/Library/Homebrew/brew.rb +++ b/Library/Homebrew/brew.rb @@ -131,6 +131,8 @@ begin end exec "brew-#{cmd}", *ARGV else + raise "command made by bash not ruby: #{cmd}" if Commands.only_bash_command_list.include?(cmd) + possible_tap = OFFICIAL_CMD_TAPS.find { |_, cmds| cmds.include?(cmd) } possible_tap = Tap.fetch(possible_tap.first) if possible_tap diff --git a/Library/Homebrew/commands.rb b/Library/Homebrew/commands.rb index 0fd56c5838..d725a0bafd 100644 --- a/Library/Homebrew/commands.rb +++ b/Library/Homebrew/commands.rb @@ -197,4 +197,8 @@ module Commands file = HOMEBREW_CACHE/"all_commands_list.txt" file.atomic_write("#{commands(aliases: true).sort.join("\n")}\n") end + + def only_bash_command_list + internal_commands.reject { |cmd| valid_internal_cmd?(cmd) } + end end