Sha256: cee17176c409b2bf32632dc98e933430f511fa1520df1a73179f1bfc42f76a6a

Contents?: true

Size: 388 Bytes

Versions: 16

Compression:

Stored size: 388 Bytes

Contents

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

require 'cl'

class Add < Cl::Cmd
  # depending on its arity the block can receive:
  #
  # * value
  # * value, name
  # * value, name, type
  # * value, name, type, opts
  opt '--to GROUP' do |value|
    opts[:to] = "#{value.upcase}!"
  end

  def run
    p to
  end
end

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

# Output:
#
#   "ONE!"

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
cl-0.1.28 examples/readme/opts_block
cl-0.1.27 examples/readme/opts_block
cl-0.1.26 examples/readme/opts_block
cl-0.1.25 examples/readme/opts_block
cl-0.1.24 examples/readme/opts_block
cl-0.1.23 examples/readme/opts_block
cl-0.1.22 examples/readme/opts_block
cl-0.1.21 examples/readme/opts_block
cl-0.1.20 examples/readme/opts_block
cl-0.1.19 examples/readme/opts_block
cl-0.1.18 examples/readme/opts_block
cl-0.1.17 examples/readme/opts_block
cl-0.1.16 examples/readme/opts_block
cl-0.1.15 examples/readme/opts_block
cl-0.1.14 examples/readme/opts_block
cl-0.1.13 examples/readme/opts_block