Sha256: 1bebda32aabdb30a700c66d21580a2788f841bc639976d7b95542ec0b4a6596a

Contents?: true

Size: 614 Bytes

Versions: 16

Compression:

Stored size: 614 Bytes

Contents

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

require 'cl'

class Lft < Cl::Cmd
  arg :a, type: :array, splat: true
  arg :b
  arg :c

  def run
    p [a, b, c]
  end
end

class Mid < Cl::Cmd
  arg :a
  arg :b, type: :array, splat: true
  arg :c

  def run
    p [a, b, c]
  end
end

class Rgt < Cl::Cmd
  arg :a
  arg :b
  arg :c, type: :array, splat: true

  def run
    p [a, b, c]
  end
end

Cl.new('splat').run(%w(lft 1 2 3 4 5))
Cl.new('splat').run(%w(mid 1 2 3 4 5))
Cl.new('splat').run(%w(rgt 1 2 3 4 5))

# =>
# [["1", "2", "3"], "4", "5"]
# ["1", ["2", "3", "4"], "5"]
# ["1", "2", ["3", "4", "5"]]

Version data entries

16 entries across 16 versions & 1 rubygems

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