diff -r 4c759312950b -r 39add8e7fa99 jorvick --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jorvick Tue Jul 14 02:07:18 2009 +0100 @@ -0,0 +1,42 @@ +#!/usr/bin/env lua + +require "jorvick.util" + +local commands = {}; + +function commands.build() + require "jorvick.build"; +end + +function commands.create(...) + local title = table.concat({...}, " "); + if #title == 0 then + title = os.date("New Post %Y-%m-%d"); + end + + local filename = make_short_title(title); + print(posts_dir..filename) + local f = io.open(posts_dir..filename..".markdown", "r"); + if f then print("File already exists or is unreable"); return; end + f = io.open(posts_dir..filename..".markdown", "w+"); + if not f then + print("File not writeable"); + end + + -- YAML + --f:write(" +end + +function commands.help() + print "Jorvick - Blog Generator" + print "" + print "Commands:" + print " create - Create a new blank post with a title" + print " publish - Mark a post as published and stamp it with a date" + print " build - Generate the HTML files and feed for all posts" + print "" +end + +local command = arg[1] or "help"; +table.remove(arg, 1); +(commands[command] or commands.help)(unpack(arg));