Exception: Homebrew::CLI::OptionConstraintError

Inherits:
UsageError
  • Object
show all
Defined in:
Library/Homebrew/cli/parser.rb

Instance Attribute Summary

Attributes inherited from UsageError

#reason

Instance Method Summary collapse

Methods inherited from UsageError

#to_s

Constructor Details

#initialize(arg1, arg2, missing: false) ⇒ OptionConstraintError

Returns a new instance of OptionConstraintError.


510
511
512
513
514
515
516
517
518
519
520
# File 'Library/Homebrew/cli/parser.rb', line 510

def initialize(arg1, arg2, missing: false)
  arg1 = "--#{arg1.tr("_", "-")}"
  arg2 = "--#{arg2.tr("_", "-")}"

  message = if !missing
    "`#{arg1}` and `#{arg2}` should be passed together."
  else
    "`#{arg2}` cannot be passed without `#{arg1}`."
  end
  super message
end