From a42218f677e6c5157dae8377f6145fe864e80325 Mon Sep 17 00:00:00 2001 From: Ben Bowers Date: Tue, 14 May 2024 07:27:35 -0400 Subject: [PATCH] Remove duplicate constraint, fix constraint messages --- lib/optimist.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/optimist.rb b/lib/optimist.rb index 673697f..9db3439 100644 --- a/lib/optimist.rb +++ b/lib/optimist.rb @@ -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 @@ -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 @@ -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