lib/mr_poole/commands.rb
def draft(opts)
      opts = @helper.ensure_open_struct(opts)

      # the drafts folder might not exist yet...create it just in case
      FileUtils.mkdir_p(DRAFTS_FOLDER)

      slug = if opts.slug.nil? || opts.slug.empty?
               opts.title
             else
               opts.slug
             end
      slug = @helper.get_slug_for(slug)

      # put the metadata into the layout header
      head, ext = @helper.get_layout(opts.layout)
      head.sub!(/^title:\s*$/, "title: #{opts.title}")
      head.sub!(/^date:\s*$/, "date: #{@helper.get_date_stamp}")
      ext ||= @ext

      path = File.join(DRAFTS_FOLDER, "#{slug}.#{ext}")
      f = File.open(path, "w")
      f.write(head)
      f.close
      @helper.open_in_editor(path) # open file if config key set
      path    # return the path, in case we want to do anything useful
    end
def draft(opts)
      opts = @helper.ensure_open_struct(opts)

      # the drafts folder might not exist yet...create it just in case
      FileUtils.mkdir_p(DRAFTS_FOLDER)

      slug = if opts.slug.nil? || opts.slug.empty?
               opts.title
             else
               opts.slug
             end
      slug = @helper.get_slug_for(slug)

      # put the metadata into the layout header
      head, ext = @helper.get_layout(opts.layout)
      head.sub!(/^title:\s*$/, "title: #{opts.title}")
      head.sub!(/^date:\s*$/, "date: #{@helper.get_date_stamp}")
      ext ||= @ext

      path = File.join(DRAFTS_FOLDER, "#{slug}.#{ext}")
      f = File.open(path, "w")
      f.write(head)
      f.close
      @helper.open_in_editor(path) # open file if config key set
      path    # return the path, in case we want to do anything useful
    end
Generate a non-timestamped draft