Sha256: 6b8c8dedc398de10bc9117233036cc3fc262d7bd61e91394a6ac09002a94c378
Contents?: true
Size: 946 Bytes
Versions: 24
Compression:
Stored size: 946 Bytes
Contents
module Octopress class Unpublish < Command def self.init_with_program(p) p.command(:unpublish) do |c| c.syntax 'unpublish <POST> [options]' c.description 'Convert a post to a draft. Command accepts path to post or search string.' CommandHelpers.add_common_options c c.action do |args, options| options['path'] = args.first options['type'] = 'draft from post' if !options['path'] abort "Unpublish failed: Please provide a path or a search string to select your post." end if File.exist?(options['path']) unpublish_post(options) else options['path'] = CommandHelpers.select_posts(options['path'], 'unpublish') unpublish_post(options) end end end end def self.unpublish_post(options) Post.new(Octopress.site(options), options).unpublish end end end
Version data entries
24 entries across 24 versions & 1 rubygems