Class: Castaway::CLI::Script

Inherits:
Object
  • Object
show all
Extended by:
GLI::App
Defined in:
lib/castaway/cli/script.rb

Class Method Summary collapse

Class Method Details

.define(command) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/castaway/cli/script.rb', line 12

def self.define(command)
  command.action do |_globals, _options, args|
    exit_now!('you have to supply a castaway program') if args.empty?

    production = Castaway::Production.from_script(args.first)

    production.new.scenes.each.with_index do |scene, idx|
      mark = scene.start || "##{idx}"
      puts "[#{mark}] #{scene.title}"
      puts scene.script if scene.script
      puts
    end
  end
end

.descriptionObject



8
9
10
# File 'lib/castaway/cli/script.rb', line 8

def self.description
  'Display the given program as a script'
end