Class: We::GitHubStats::Cli::ScriptOptions

Inherits:
Object
  • Object
show all
Defined in:
lib/we/github_stats/cli.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeScriptOptions

Returns a new instance of ScriptOptions.



16
17
18
# File 'lib/we/github_stats/cli.rb', line 16

def initialize
  @format = 'console'
end

Instance Attribute Details

#access_tokenObject

Returns the value of attribute access_token.



14
15
16
# File 'lib/we/github_stats/cli.rb', line 14

def access_token
  @access_token
end

#formatObject

Returns the value of attribute format.



14
15
16
# File 'lib/we/github_stats/cli.rb', line 14

def format
  @format
end

#optionsObject (readonly)

Returns the value of attribute options.



57
58
59
# File 'lib/we/github_stats/cli.rb', line 57

def options
  @options
end

#organizationObject

Returns the value of attribute organization.



14
15
16
# File 'lib/we/github_stats/cli.rb', line 14

def organization
  @organization
end

#parserObject (readonly)

Returns the value of attribute parser.



57
58
59
# File 'lib/we/github_stats/cli.rb', line 57

def parser
  @parser
end

Instance Method Details

#define_options(parser) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/we/github_stats/cli.rb', line 20

def define_options(parser)
  parser.banner = "Usage: github_stats [options]"
  parser.separator ""
  parser.separator "Specific options:"

  parser.on(
    "-o", "--organization wework",
    "GitHub organization to troll for stats"
  ) do |o|
    @organization = o
  end

  parser.on(
    "-t", "--token ABC123",
    "GitHub Access Token with read permissions for the organization"
  ) do |t|
    @access_token = t
  end

  parser.on(
    "-f", "--format console",
    "How should it be output? Supported: console,csv"
  ) do |f|
    @format = f
  end

  parser.on_tail("-h", "--help", "Show this message") do
    puts parser
    exit
  end

  parser.on_tail("--version", "Show version") do
    puts VERSION
    exit
  end
end