Sha256: ab79433c09cf707c13c8cc223f29ef7d1505307873b2a388ba41c5f4116ce8d4
Contents?: true
Size: 1.06 KB
Versions: 4
Compression:
Stored size: 1.06 KB
Contents
#!/usr/bin/env ruby require 'rubygems' require 'infoboxer' include Infoboxer require 'optparse' wiki_url = nil OptionParser.new do |opts| opts.banner = "Usage: infoboxer [-w wiki_api_url]" opts.on("-w", "--wiki WIKI_API_URL", "Make wiki by WIKI_API_URL a default wiki, and use it with just get('Pagename')") do |w| wiki_url = w end end.parse! if wiki_url if wiki_url =~ /^[a-z]+$/ wiki_url = case when domain = Infoboxer::WIKIMEDIA_PROJECTS[wiki_url.to_sym] "https://en.#{domain}/w/api.php" when domain = Infoboxer::WIKIMEDIA_PROJECTS[('w' + wiki_url).to_sym] "https://en.#{domain}/w/api.php" else fail("Unidentified wiki: #{wiki_url}") end end DEFAULT_WIKI = Infoboxer.wiki(wiki_url) puts "Default Wiki selected: #{wiki_url}.\nNow you can use `get('Pagename')`, `category('Categoryname')` and so on.\n\n" [:raw, :get, :get_h, :category, :search, :prefixsearch].each do |m| define_method(m){|*arg| DEFAULT_WIKI.send(m, *arg) } end end require 'irb' ARGV.shift until ARGV.empty? IRB.start
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
infoboxer-0.2.7 | bin/infoboxer |
infoboxer-0.2.6 | bin/infoboxer |
infoboxer-0.2.5 | bin/infoboxer |
infoboxer-0.2.4 | bin/infoboxer |