Class: Octopress::Unpublish
- Defined in:
- lib/octopress/commands/unpublish.rb
Class Method Summary collapse
Methods inherited from Command
inherited, #init_with_program, subclasses
Class Method Details
.init_with_program(p) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/octopress/commands/unpublish.rb', line 3 def self.init_with_program(p) p.command(:unpublish) do |c| c.syntax 'unpublish <POST> [options]' c.option 'force', '--force', 'Overwrite draft if it already exists' c.description 'Convert a post to a draft. Command accepts path to post or search string.' CommandHelpers. c c.action do |args, | ['path'] = args.first ['type'] = 'draft from post' if !['path'] abort "Unpublish failed: Please provide a path or a search string to select your post." end if File.exist?(['path']) unpublish_post() else ['path'] = CommandHelpers.select_posts(['path'], 'unpublish') unpublish_post() end end end end |