class Export

Public Instance Methods

batch() click to toggle source
# File lib/mediawiki_cli/export.rb, line 15
def batch
        pages = []

        # TODO combine options
        export ||= to_hash(options.file) if options.file
        export ||= options

        export.each { |key, value|
                case key
                        when "categories", "namespaces"
                                pages.push invoke "mw:list:members", [],   :categories => export["categories"],
                                                                                                                                                        :namespaces => export["namespaces"],
                                                                                                                                                        :wiki => parent_options.wiki,
                                                                                                                                                        :username => parent_options.username,
                                                                                                                                                        :password => parent_options.password,
                                                                                                                                                        :file => parent_options.file
                        when "pages"
                                pages.push export["pages"]
                end
        }
        return output $mw.export(pages.flatten)
end
export() click to toggle source
# File lib/mediawiki_cli/export.rb, line 40
def export
        create_gateway
        opts = (STDIN.tty?) ? options.pages : $stdin.read.split("\n")
        return output $mw.export(opts)
end