Sha256: 14cba7ef7a1c39a292609b6a0e77027d0e5863cb6ccf6ac75278ab4ea3dd2447

Contents?: true

Size: 513 Bytes

Versions: 3

Compression:

Stored size: 513 Bytes

Contents

#!/usr/bin/env ruby
$: << File.expand_path('lib')

require 'cl'

class Add < Cl::Cmd
  register :add

  opt '--to GROUP', enum: %w(one two)

  def run
    p to: to
  end
end

Cl.new('owners').run(%w(add --to one))

# Output:
#
#   {:to=>"one"}

Cl.new('owners').run(%w(add --to unknown))

# Output:
#
#   Unknown value: to=unknown (known values: one, two)
#
#   Usage: owners add [options]
#
#   Options:
#
#     --to GROUP      type: string, known values: one, two
#     --help          Get help on this command

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
travis-cl-1.2.4 examples/readme/enum
cl-1.2.4 examples/readme/enum
cl-1.2.3 examples/readme/enum