require 'thor' class FrenchPress # This is the command line interface for FrenchPress. class CMD < Thor class_option :dir desc 'init', 'Initialize a new frenchpress blog.' option :url option :title def init FrenchPress.open(options[:dir]).new_blog( url: options[:url], title: options[:title] ) end desc 'post', 'Create a new post from given file or URL.' def post(*items) FrenchPress.open(options[:dir]).post(*items) end desc 'default', 'Set the current working directory to your default ' \ 'frenchpress directory.' def default dir = options[:dir] dir ||= Dir.getwd FrenchPress.default = File.expand_path dir end desc 'reply', 'Reply to a frenchpress post with new content.' def reply(orig, *resp) FrenchPress.open(options[:dir]).reply(orig, *resp) end desc 'update', "Update your frenchpress theme if it's outdated." def update FrenchPress.open(options[:dir]).update end end end