class BuPr::Command
Attributes
args[R]
opts[R]
Public Class Methods
new(args)
click to toggle source
@param args [Array<String>]
# File lib/bu_pr/command.rb, line 19 def initialize args @args = args @opts = {} end
start(args)
click to toggle source
Entry Point
@note for backward compatibility
# File lib/bu_pr/command.rb, line 10 def self.start args Runner.call \ new(args).parse end
Public Instance Methods
parse()
click to toggle source
@return [Hash<Symbol, String>]
# File lib/bu_pr/command.rb, line 25 def parse parser.parse! args opts end
Private Instance Methods
parser()
click to toggle source
# File lib/bu_pr/command.rb, line 32 def parser ::OptionParser.new do |o| o.banner = "Usage: bu_pr [options]" o.on("-b", "--branch [NAME]", String, "Base branch name") { |v| opts[:branch] = v } o.on("-t", "--title [TITLE]", String, "pull-request title") { |v| opts[:title] = v } o.on("-k", "--token [TOKEN]", String, "GitHub Token") { |v| opts[:token] = v } o.on("-r", "--repo [NAME]", String, "GitHub repo name") { |v| opts[:repo] = v } end end