Sha256: f98a59d28c6924d7366f10e840643cc1a8af1809d897718fd0e4bfcaf4f2c3f1

Contents?: true

Size: 655 Bytes

Versions: 15

Compression:

Stored size: 655 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))

# Output:
#
#   [["1", "2", "3"], "4", "5"]

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

# Output:
#
#   ["1", ["2", "3", "4"], "5"]

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

# Output:
#
#   ["1", "2", ["3", "4", "5"]]

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
cl-1.2.2 examples/readme/args_splat
cl-1.2.1 examples/readme/args_splat
cl-1.2.0 examples/readme/args_splat
cl-1.1.5 examples/readme/args_splat
cl-1.1.4 examples/readme/args_splat
cl-1.1.3 examples/readme/args_splat
cl-1.1.2 examples/readme/args_splat
cl-1.1.1 examples/readme/args_splat
cl-1.1.0 examples/readme/args_splat
cl-1.0.5 examples/readme/args_splat
cl-1.0.4 examples/readme/args_splat
cl-1.0.3 examples/readme/args_splat
cl-1.0.2 examples/readme/args_splat
cl-1.0.1 examples/readme/args_splat
cl-1.0.0 examples/readme/args_splat