lib/controllers/new.rb in evertils-0.1.11 vs lib/controllers/new.rb in evertils-0.1.12

- old
+ new

@@ -30,10 +30,22 @@ end opt.on("-b", "--body=BODY", "Note body") do |body| @body = body end + + opt.on("-t", "--tags=list", "Assign tags to the new note") do |tags| + @tags = tags + end + + opt.on("-c", "--created_on=DATE", "Set note created date") do |created_on| + # Evernote cuts the last 3 values off of your timestamp because + # it "accurate to milliseconds", so we have to add them back or + # else the date is all messed up + parsed = Date.parse(created_on) + @created_on = (parsed.to_time.to_i.to_s + "000").to_i + end end.parse! # user = @model.user # Notify.success("Welcome, #{user.name} (#{user.username})") rescue ::Evernote::EDAM::Error::EDAMSystemException => e @@ -52,11 +64,11 @@ message = message.gsub!("\n", '<br />') else message = @body end - note = @model.create_note(@title, message, @notebook, @file) + note = @model.create_note(@title, message, @notebook, @file, false, @created_on) if note[:note] Notify.success("Note created") else Notify.error("Unable to create note, are you authenticated?") @@ -73,10 +85,10 @@ end # Prefix title to indicate it's shared status @title = "[SHARED] #{@title}" - note = @model.create_note(@title, message, @notebook, @file, true) + note = @model.create_note(@title, message, @notebook, @file, true, @created_on) if note[:share_url] Notify.success("Note created and shared:\n#{note[:share_url]}") else Notify.error("Something dreadful happened!") \ No newline at end of file