2022-10-11 00:52:32 +01:00
|
|
|
# typed: true
|
2022-09-28 21:57:13 -07:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Homebrew
|
|
|
|
module CLI
|
|
|
|
class Parser
|
2022-12-03 22:08:01 -08:00
|
|
|
undef set_default_options
|
2022-09-28 21:57:13 -07:00
|
|
|
undef validate_options
|
|
|
|
|
2022-12-03 22:08:01 -08:00
|
|
|
def set_default_options
|
|
|
|
@args["formula?"] = true if @args.respond_to?(:formula?)
|
|
|
|
end
|
|
|
|
|
2022-09-28 21:57:13 -07:00
|
|
|
def validate_options
|
|
|
|
return unless @args.respond_to?(:cask?)
|
|
|
|
return unless @args.cask?
|
|
|
|
|
2022-12-31 11:17:17 -08:00
|
|
|
# NOTE: We don't raise a UsageError here because
|
|
|
|
# we don't want to print the help page.
|
|
|
|
raise "Invalid usage: Casks are not supported on Linux"
|
2022-09-28 21:57:13 -07:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|