Sha256: e9bb12bd6743e9af075c4ee646f83991108e2538f41b62680d6179da8a66de67
Contents?: true
Size: 1.12 KB
Versions: 29
Compression:
Stored size: 1.12 KB
Contents
#!/usr/bin/env ruby $: << File.expand_path('lib') require 'cl' class SplatLeft < Cl::Cmd register 'splat:left' arg :one, type: :array args :two, :three def run [registry_key, one: one, two: two, three: three] end end class SplatMiddle < Cl::Cmd register 'splat:middle' arg :one arg :two, type: :array arg :three def run [registry_key, one: one, two: two, three: three] end end class SplatRight < Cl::Cmd register 'splat:right' args :one, :two arg :three, type: :array def run [registry_key, one: one, two: two, three: three] end end def output(cmd, args) args = args.map { |key, value| "#{key}=#{value.inspect}" }.join(' ') puts "Called #{cmd} with #{args}\n\n" end output *Cl.new($0).run(%w(splat left foo bar baz buz)) # Output: # # Called splat:left with one=["foo", "bar"] two="baz" three="buz" output *Cl.new($0).run(%w(splat middle foo bar baz buz)) # Output: # # Called splat:middle with one="foo" two=["bar", "baz"] three="buz" output *Cl.new($0).run(%w(splat right foo bar baz buz)) # Output: # # Called splat:middle with one="foo" two="bar" three=["baz", "buz"]
Version data entries
29 entries across 29 versions & 1 rubygems