Sha256: 406cfc7f46e29d31288dfebee9059c83c5c2be58e4b53290ff6447ae173e3e04

Contents?: true

Size: 574 Bytes

Versions: 3

Compression:

Stored size: 574 Bytes

Contents

#!/usr/bin/env ruby
require_relative '../lib/optimist_xl'

opts = OptimistXL::options do
  opt :french, "starts with french", type: String,
      permitted: %w(fries toast),
      permitted_response: "option %{arg} must be something that starts " +
      "with french, e.g. %{permitted} but you gave '%{given}'"
  opt :dog, "starts with dog", permitted: %r/(house|bone|tail)/, type: String
  opt :zipcode, "zipcode", permitted: %r/^[0-9]{5}$/, default: '39759',
      permitted_response: "option %{arg} must be a zipcode, a five-digit number from 00000..99999"
end

p opts

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
optimist_xl-3.3.0 examples/permitted.rb
optimist_xl-3.2.0 examples/permitted.rb
optimist_xl-3.1.1 examples/permitted.rb