class Tukune::OptionParser

Public Class Methods

new() click to toggle source
# File lib/tukune/option_parser.rb, line 3
def initialize
  @opt_parser = ::OptionParser.new do |opt|
    opt.banner = 'Usage: tukune [OPTIONS]'
    opt.separator  ''
    opt.separator  'Options'

    opt.on('-t', '--title TITLE', 'Pull request title') do |title|
      @title = title
    end

    opt.on('-b', '--body BODY', 'Pull request body') do |body|
      @body = body
    end

    opt.on('--target-path V,V...', Array) do |path|
      @target_paths = path
    end

    opt.on('-h', '--help', 'help') do
      puts @opt_parser
    end
  end
end

Public Instance Methods

options() click to toggle source
# File lib/tukune/option_parser.rb, line 31
def options
  {
    title: @title,
    body: @body,
    target_paths: @target_paths || []
  }
end
parse!(argv = @opt_parser.default_argv) click to toggle source
# File lib/tukune/option_parser.rb, line 27
def parse!(argv = @opt_parser.default_argv)
  @opt_parser.parse!(argv)
end