Skip to content

Commit

Permalink
Remove duplicate constraint, fix constraint messages
Browse files Browse the repository at this point in the history
  • Loading branch information
nanobowers committed May 14, 2024
1 parent b5e5d7d commit a42218f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/optimist.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def error_condition(overlap_size)
(overlap_size != 0) && (overlap_size != @idents.size)
end
def error_message(longargs) # constraint_sym, this_sym)
"#{longargs.join(', ')} have dependency and must be given together"
"#{longargs.join(', ')} have a dependency and must be given together"
end
end

Expand All @@ -77,7 +77,7 @@ def error_condition(overlap_size)
overlap_size != 1
end
def error_message(longargs)
"one of #{longargs.join(', ')} is required"
"one and only one of #{longargs.join(', ')} is required"
end
end

Expand Down Expand Up @@ -263,7 +263,6 @@ def conflicts(*syms)
## Marks two (or more!) options as required but mutually exclusive.
def either(*syms)
syms.each { |sym| raise ArgumentError, "unknown option '#{sym}'" unless @specs[sym] }
@constraints << ConflictConstraint.new(syms)
@constraints << EitherConstraint.new(syms)
end

Expand Down

0 comments on commit a42218f

Please sign in to comment.