class Md2Cnblog::OptParser
Public Class Methods
new()
click to toggle source
# File lib/md2cnblog/cli.rb, line 8 def initialize() @option = OpenStruct.new end
Public Instance Methods
do(args)
click to toggle source
# File lib/md2cnblog/cli.rb, line 12 def do(args) parser = OptionParser.new do |opts| opts.banner = 'Usage: mdt [type] filename' opts.separator "" opts.separator "Specific options:" opts.on('-t', '--type [BLOGTYPE]', 'the blog type to translate') do |t| @option.type = t end opts.separator '' opts.separator 'Common options:' opts.on_tail('-h', '--help', 'show this message') do puts opts exit end end # new parser.parse!(args) @option end