From 39ec7bad9c7596962ec1b6f0b518d68b60295770 Mon Sep 17 00:00:00 2001 From: David DeGraw Date: Fri, 7 Jun 2024 17:29:34 -0600 Subject: [PATCH] make a new post script --- bin/new-post | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 bin/new-post diff --git a/bin/new-post b/bin/new-post new file mode 100755 index 0000000..3b84f9d --- /dev/null +++ b/bin/new-post @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby + +require 'date' + +def create_post_file() + # Get the current date in YYYY-MM-DD format + date = Date.today.strftime('%Y-%m-%d') + + # Create the filename + filename = "./_posts/news/#{date}-title.md" + + # Define the content of the file + content = <<~CONTENT + --- + title: newpost + tags: [] + date: #{DateTime.now.strftime('%Y-%m-%d %H:%M:%S %z')} + --- + CONTENT + + # Write the content to the file + File.write(filename, content) + + puts "File created at #{filename}" + + system("subl", "./", filename) +end + +create_post_file()