Add ShellCommand module for shell command stubs

This commit is contained in:
Ruoyu Zhong 2024-07-15 11:28:39 -04:00
parent cb48a95bbd
commit d611e3e0f9
No known key found for this signature in database
2 changed files with 18 additions and 7 deletions

View File

@ -61,12 +61,5 @@ module Homebrew
sig { abstract.void }
def run; end
sig { void }
def raise_sh_command_error!
raise StandardError,
"This command is just here for completions generation. " \
"It's actually defined in `cmd/#{self.class.command_name}.sh` instead."
end
end
end

View File

@ -0,0 +1,18 @@
# typed: strict
# frozen_string_literal: true
module Homebrew
module ShellCommand
extend T::Helpers
requires_ancestor { AbstractCommand }
sig { void }
def run
sh_cmd_path = "#{self.class.dev_cmd? ? "dev-cmd" : "cmd"}/#{self.class.command_name}.sh"
raise StandardError,
"This command is just here for completions generation. " \
"It's actually defined in `#{sh_cmd_path}` instead."
end
end
end