Class: PROIEL::Commands::Shell

Inherits:
PROIEL::Command show all
Defined in:
lib/proiel/cli/commands/shell.rb

Class Method Summary collapse

Methods inherited from PROIEL::Command

inherited, subclasses

Class Method Details

.init_with_program(prog) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/proiel/cli/commands/shell.rb', line 5

def init_with_program(prog)
  prog.command(:shell) do |c|
    c.syntax 'shell filename(s)'
    c.description 'Launch a shell with the treebank loaded'

    c.action do |args, options|
      if args.empty?
        STDERR.puts 'Missing filename(s). Use --help for more information.'
      else
        process(args, options)
      end
    end
  end
end

.process(args, options) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/proiel/cli/commands/shell.rb', line 20

def process(args, options)
  tb = PROIEL::Treebank.new

  args.each do |filename|
    STDERR.puts "Reading #{filename}...".green if options['verbose']

    tb.load_from_xml(filename)
  end

  binding.pry
end