Class: Notes::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/notes-cli/cli.rb

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ CLI

Returns a new instance of CLI.



4
5
6
# File 'lib/notes-cli/cli.rb', line 4

def initialize(argv)
  @options = Notes::Options.parse(argv)
end

Instance Method Details

#find_allObject

Read and parse all files as specified in the options Prints filenames along with all tasks found per file Only outputs to console; returns nothing



11
12
13
14
15
16
17
18
19
# File 'lib/notes-cli/cli.rb', line 11

def find_all
  task_map = Notes::Tasks.all(@options).group_by(&:filename)

  task_map.each do |filename, tasks|
    puts "#{filename}:"
    tasks.each { |task| puts '  ' + task.to_s }
    puts ''
  end
end