Class: We::GitHubStats::Cli::ScriptOptions
- Inherits:
-
Object
- Object
- We::GitHubStats::Cli::ScriptOptions
- Defined in:
- lib/we/github_stats/cli.rb
Instance Attribute Summary collapse
-
#access_token ⇒ Object
Returns the value of attribute access_token.
-
#format ⇒ Object
Returns the value of attribute format.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#organization ⇒ Object
Returns the value of attribute organization.
-
#parser ⇒ Object
readonly
Returns the value of attribute parser.
Instance Method Summary collapse
- #define_options(parser) ⇒ Object
-
#initialize ⇒ ScriptOptions
constructor
A new instance of ScriptOptions.
Constructor Details
#initialize ⇒ ScriptOptions
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_token ⇒ Object
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 |
#format ⇒ Object
Returns the value of attribute format.
14 15 16 |
# File 'lib/we/github_stats/cli.rb', line 14 def format @format end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
57 58 59 |
# File 'lib/we/github_stats/cli.rb', line 57 def @options end |
#organization ⇒ Object
Returns the value of attribute organization.
14 15 16 |
# File 'lib/we/github_stats/cli.rb', line 14 def organization @organization end |
#parser ⇒ Object (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 (parser) parser. = "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 |