Sha256: 04e375f305a4ee80a06cbed6759b9cbd89cac20008d306637026708046e5ad74

Contents?: true

Size: 504 Bytes

Versions: 3

Compression:

Stored size: 504 Bytes

Contents

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

require 'cl'

class Add < Cl::Cmd
  register :add

  opt '--to GROUP', format: /^\w+$/

  def run
    p to: to
  end
end

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

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

Cl.new('owners').run(['add', '--to', 'does not match!'])

# Output:
#
#   Invalid format: to (format: /^\w+$/)
#
#   Usage: owners add [options]
#
#   Options:
#
#     --to GROUP      type: string, format: /^\w+$/
#     --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/format
cl-1.2.4 examples/readme/format
cl-1.2.3 examples/readme/format