Class: OrgMode::Commands::Agenda

Inherits:
Object
  • Object
show all
Defined in:
lib/org_mode/commands/agenda.rb

Instance Method Summary collapse

Instance Method Details

#execute(args, options) ⇒ Object

Private: executes the agenda command parses all the files

args - list of filenames options - switches set by the app

Returns the restult to stdout



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/org_mode/commands/agenda.rb', line 17

def execute(args, options)

  files_to_parse = args
  if files_to_parse.empty?
    files_to_parse = $config.org_mode_files
  end

  file_collection = OrgMode::Loader.load_and_parse_files(files_to_parse)
  agenda_reporter = OrgMode::Reporters::Agenda.new(file_collection)
  console_presenter  = OrgMode::Presenters::Agenda::Console.new(agenda_reporter)

  puts console_presenter.open_items_per_day_colorized

rescue SystemCallError => e
  puts "Encountered a little problem: #{e}"
end