Class: Markdo::ProcessCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/markdo/commands/process_command.rb

Instance Method Summary collapse

Constructor Details

#initializeProcessCommand

Returns a new instance of ProcessCommand.



6
7
8
9
10
11
# File 'lib/markdo/commands/process_command.rb', line 6

def initialize(*)
  super
  @lines_by_filename = Hash.new { [] }
  @lines = File.readlines(data_source.inbox_path)
  @line_index = 0
end

Instance Method Details

#runObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/markdo/commands/process_command.rb', line 13

def run
  catch :abort do
    while has_lines?
      line = current_line
      choice = prompt(line)

      case choice
      when 'h'
        show_help
      when 'i'
        move_line_to(@env['MARKDO_INBOX'], line)
      when 's'
        move_line_to('Sprint.md', line)
      when 'b'
        move_line_to('Backlog.md', line)
      when 'm'
        move_line_to('Maybe.md', line)
      when 'a'
        throw :abort
      end
    end

    write_files
  end
end