Sha256: 77ec3ed169874e2edd6c75f1b53bea6e62399c7b570f1debdfe75d605042b18a

Contents?: true

Size: 974 Bytes

Versions: 29

Compression:

Stored size: 974 Bytes

Contents

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

require 'cl'

module Rakeish
  module Db
    class Create < Cl::Cmd
      register 'db:create'

      arg :name

      def run; [registry_key, args, opts] end
    end

    class Drop < Cl::Cmd
      register 'db:drop'

      arg :name

      opt '-f', '--force'

      def run; [registry_key, args, opts] end
    end

    class Migrate < Cl::Cmd
      register 'db:migrate'

      arg :name

      opt '-v', '--version VERSION'

      def run; [registry_key, args, opts] end
    end
  end
end

def output(result)
  result.each do |cmd, args, opts|
    puts "Called #{cmd} with args=#{args} opts=#{opts}"
  end
  puts
end

argv = %w(db:drop production -f db:create db:migrate production -v 1)
output Cl.new($0, runner: :multi).run(argv)

# Output:
#
#   Called db:drop with args=["production"] opts={:force=>true}
#   Called db:create with args=[] opts={}
#   Called db:migrate with args=["production"] opts={:version=>"1"}

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
cl-0.1.28 examples/rakeish
cl-0.1.27 examples/rakeish
cl-0.1.26 examples/rakeish
cl-0.1.25 examples/rakeish
cl-0.1.24 examples/rakeish
cl-0.1.23 examples/rakeish
cl-0.1.22 examples/rakeish
cl-0.1.21 examples/rakeish
cl-0.1.20 examples/rakeish
cl-0.1.19 examples/rakeish
cl-0.1.18 examples/rakeish
cl-0.1.17 examples/rakeish
cl-0.1.16 examples/rakeish
cl-0.1.15 examples/rakeish
cl-0.1.14 examples/rakeish
cl-0.1.13 examples/rakeish
cl-0.1.12 examples/rakeish
cl-0.1.11 examples/rakeish
cl-0.1.10 examples/rakeish
cl-0.1.9 examples/rakeish