Class: Squib::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/squib/commands/cli.rb

Instance Method Summary collapse

Instance Method Details

#runObject


8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/squib/commands/cli.rb', line 8

def run
  Mercenary.program(:squib) do |p|
    p.version Squib::VERSION
    p.description 'A Ruby DSL for prototyping card games'
    p.syntax 'squib <subcommand> [options]'

    p.command(:new) do |c|
      c.syntax 'new PATH'
      c.description 'Creates a new basic Squib project scaffolding in PATH. Must be a new directory or already empty.'

      c.option 'advanced', '--advanced', 'Create the advanced layout'

      c.action do |args, options|
        advanced = options.key? 'advanced'
        Squib::Commands::New.new.process(args, advanced)
      end
    end

    p.command(:make_sprue) do |c|
      c.syntax 'make_sprue'
      c.description 'Creates a sprue definition file.'

      c.action do |args, options|
        Squib::Commands::MakeSprue.new.process(args)
      end
    end

  end
end