lib/controllers/generate.rb in evertils-0.1.17 vs lib/controllers/generate.rb in evertils-0.1.18

- old
+ new

@@ -1,9 +1,9 @@ module Granify module Controller class Generate < Controller::Base - attr_accessor :force + attr_accessor :force, :start def pre_exec begin # interface with the Evernote API so we can use it later @model = Granify::Helper.load('evernote') @@ -23,10 +23,14 @@ opt.banner = "#{Granify::PACKAGE_NAME} generate timeframe [...-flags]" opt.on("-f", "--force", "Force execution") do @force = true end + + opt.on("-s", "--start=START", "Specify a date for the note") do |date| + @start = DateTime.parse(date) + end end.parse! super end @@ -34,15 +38,15 @@ if STDIN.tty? Notify.error("This command relies on piped data to generate note data") end if !@force - if @model.note_exists + if @model.note_exists(@start) Notify.error("There's already a log for today!") end end - @model.create_deployment_note + @model.create_deployment_note(@start) end # generate daily notes def daily if !@force \ No newline at end of file