class FeedTheZettelkasten::CLI

Entrypoint for CLI usage

Constants

STATUS_FAILURE
STATUS_SUCCESS

Attributes

options[R]

Public Class Methods

new(options) click to toggle source
# File lib/feed_the_zettelkasten/cli.rb, line 13
def initialize(options)
  @options = options
end
run(argv) click to toggle source
# File lib/feed_the_zettelkasten/cli.rb, line 9
def self.run(argv)
  new(Options.new(argv)).run
end

Public Instance Methods

run() click to toggle source
# File lib/feed_the_zettelkasten/cli.rb, line 17
def run
  notes = NotesDir.new(options[:path], file_extension: options[:ext])
  range = options[:from]..options[:to]

  Seinfeld.new(notes, target: options[:target]).each_day(range) do |data|
    puts Format::Pretty.new(data)
  end

  STATUS_SUCCESS
rescue StandardError => e
  $stderr.puts e
  STATUS_FAILURE
end