Class: WP2Middleman::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/wp2middleman/cli.rb

Instance Method Summary collapse

Instance Method Details

#usageObject



26
27
28
29
30
31
32
# File 'lib/wp2middleman/cli.rb', line 26

def usage
  say "wp2middleman #{WP2Middleman::VERSION}"
  say "https://github.com/mdb/wp2middleman"
  say "\n"

  help
end

#wp2mm(wp_xml_export = nil) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/wp2middleman/cli.rb', line 11

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