lib/yargs.rb
# Returns or yields true if a flag was provided with any of the given names.
Returns or yields true if a flag was provided with any of the given names.
Returns or yields true if a flag was provided with any of the given names .
def flag(*names)
    result = false
    names_alt = "(?:#{names.join('|')})"
    @remaining.dup.each do |arg|
      if /^(-){1,2}#{names_alt}$/ === arg
        @remaining.delete(arg)
        result = true
      end
    end
    if block_given? && result
      yield result
    else
      return result
    end
  end
def flag ( * names ) result = false names_alt = "(?:#{names.join('|')})" @remaining . dup . each do | arg | if / ^(-){1,2} #{ names_alt } $ / === arg @remaining . delete ( arg ) result = true end end if block_given? && result yield result else return result end end
Returns or yields true if a flag was provided with any of the given names.
Returns or yields true if a flag was provided with any of the given names .
names