Sha256: afd4de63c5c3da21017e17e75933f5e39ff51f639ac159caa811d65c6e4787f8

Contents?: true

Size: 887 Bytes

Versions: 2

Compression:

Stored size: 887 Bytes

Contents

require 'thor'

module WP2Middleman
  class CLI < Thor
    default_task :wp2mm

    desc "WORDPRESS XML EXPORT FILE", "Migrate Wordpress posts to Middleman-style markdown files"
    option :body_to_markdown, :type => :boolean
    option :include_fields, :type => :array

    def wp2mm(wp_xml_export = nil)
      return usage unless wp_xml_export

      unless File.file? wp_xml_export
        error "#{wp_xml_export} is not a valid file"
        exit 1
      end

      include_fields = options[:include_fields] || []
      WP2Middleman.migrate(wp_xml_export, options[:body_to_markdown], include_fields)

      say "Successfully migrated #{wp_xml_export}", "\033[32m"
    end

    desc "usage", "Display usage banner", hide: true
    def usage
      say "wp2middleman #{WP2Middleman::VERSION}"
      say "https://github.com/mdb/wp2middleman"
      say "\n"

      help
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
wp2middleman-0.0.3 lib/wp2middleman/cli.rb
wp2middleman-0.0.2 lib/wp2middleman/cli.rb