Created
February 14, 2020 03:00
-
-
Save afcapel/6c02c353dd4a9f2ad5bd3debf4ec32a7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby --disable-gems | |
require "date" | |
require "fileutils" | |
JOURNAL_DIR = File.expand_path("~/textos/diario") | |
now = DateTime.now | |
date = now.strftime("%F") | |
entry = "#{JOURNAL_DIR}/#{date}.md" | |
new_entry = !File.exist?(entry) | |
open(entry, "a") do |f| | |
if new_entry | |
f << "# #{now.strftime("%A %d %B %Y %H:%M")}\n\n" | |
else | |
f << "\n\n" | |
f << "# #{now.strftime("%H:%M")}\n\n" | |
end | |
end | |
`open #{entry}` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment