apainintheneck a8384c0ce7 cli/parser: Better error message for cask on linux
1. Validate options before constraint violations. This allows
us to error out when --cask is passed on Linux before getting
a constraint violation when --cask and --formula are set.
2. Skip printing the help page when --cask is passed on Linux.
2022-12-31 12:34:18 -08:00

25 lines
566 B
Ruby

# typed: true
# frozen_string_literal: true
module Homebrew
module CLI
class Parser
undef set_default_options
undef validate_options
def set_default_options
@args["formula?"] = true if @args.respond_to?(:formula?)
end
def validate_options
return unless @args.respond_to?(:cask?)
return unless @args.cask?
# 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"
end
end
end
end