Class: Rebaser::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/rebaser/parser.rb

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Parser

Returns a new instance of Parser.



5
6
7
# File 'lib/rebaser/parser.rb', line 5

def initialize(args)
  @args = args
end

Instance Method Details

#parseObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/rebaser/parser.rb', line 9

def parse
  options = {}

  OptionParser.new do |opts|
    opts.on("--username USERNAME", String, "Your github username") do |v|
      options[:username] = v
    end

    opts.on("--password PASSWORD", String, "Your github password") do |v|
      options[:password] = v
    end

    opts.on("--token TOKEN", String, "Your github two factor authentication code") do |v|
      options[:token] = v
    end

    opts.on("--remote REMOTE", String, "The git remote in the form of `timminkov/rebaser`") do |v|
      options[:remote] = v
    end

    opts.on("--branch BRANCH", String, "Branch name to rebase onto") do |v|
      options[:rebase_branch] = v
    end
  end.parse(args)

  options
end