Exception: Homebrew::CLI::MaxNamedArgumentsError

Inherits:
UsageError
  • Object
show all
Extended by:
T::Sig
Defined in:
cli/parser.rb

Instance Attribute Summary

Attributes inherited from UsageError

#reason

Instance Method Summary collapse

Methods inherited from UsageError

#to_s

Constructor Details

#initialize(maximum, types: []) ⇒ void

Parameters:

  • maximum (Integer)
  • types (Array<Symbol>) (defaults to: [])


675
676
677
678
679
680
681
682
683
684
685
686
# File 'cli/parser.rb', line 675

def initialize(maximum, types: [])
  super case maximum
  when 0
    "This command does not take named arguments."
  else
    types << :named if types.empty?
    arg_types = types.map { |type| type.to_s.tr("_", " ") }
                     .to_sentence two_words_connector: " or ", last_word_connector: " or "

    "This command does not take more than #{maximum} #{arg_types} #{"argument".pluralize(maximum)}."
  end
end