Class: GitLab::CI::Lint::Arguments
- Inherits:
-
Object
- Object
- GitLab::CI::Lint::Arguments
- Defined in:
- lib/gitlab/ci/lint/arguments.rb
Instance Attribute Summary collapse
-
#program_name ⇒ Object
readonly
Returns the value of attribute program_name.
Instance Method Summary collapse
- #command_line_parser ⇒ Object
-
#initialize ⇒ Arguments
constructor
A new instance of Arguments.
Constructor Details
#initialize ⇒ Arguments
Returns a new instance of Arguments.
11 12 13 14 15 16 17 |
# File 'lib/gitlab/ci/lint/arguments.rb', line 11 def initialize @program_name = File.basename(__FILE__).colorize(:yellow) @program_version = Gitlab::Ci::Lint::VERSION.colorize(:yellow) @options = { verbose: false } end |
Instance Attribute Details
#program_name ⇒ Object (readonly)
Returns the value of attribute program_name.
9 10 11 |
# File 'lib/gitlab/ci/lint/arguments.rb', line 9 def program_name @program_name end |
Instance Method Details
#command_line_parser ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/gitlab/ci/lint/arguments.rb', line 19 def command_line_parser OptionParser.new do |opts| opts. = "Usage: example.rb [options]" opts.on("-h", "--helper", "Show helper documentation") { |value| @options[:help] = helper() } opts.on("-e", "--endpoint", "GitLab Endpoint") { |value| @options[:endpoint] = value } opts.on("-t", "--token", "GitLab Token") { |value| @options[:token] = value } opts.on("-f", "--file", "GitLab CI File") { |value| @options[:file] = value } opts.on("-d", "--directory", "GitLab CI Directory") { |value| @options[:directory] = value } opts.on("-T", "--timeout", "Request Timeout") { |value| @options[:timeout] = value } opts.on("-n", "--no-color", "Color Usage") { |value| @options[:nocolor] = value } opts.on("-v", "--values", "Values File") { |value| @options[:values] = value } opts.on("-l", "--log", "Log File") { |value| @options[:log] = value } opts.on("--verbose", "If set, print verbose output") { |value| @options[:verbose] = true } opts.on("--version", "Show GitLab CI Lint Version") { |value| @options[:version] = version() } end.parse! return @options end |