Class: Swagcov::Options
- Inherits:
-
Object
- Object
- Swagcov::Options
- Defined in:
- lib/swagcov/options.rb
Instance Method Summary collapse
- #define ⇒ Object
-
#initialize(args: ::ARGV) ⇒ Options
constructor
A new instance of Options.
Constructor Details
#initialize(args: ::ARGV) ⇒ Options
Returns a new instance of Options.
7 8 9 |
# File 'lib/swagcov/options.rb', line 7 def initialize args: ::ARGV @args = args end |
Instance Method Details
#define ⇒ Object
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 36 37 38 39 |
# File 'lib/swagcov/options.rb', line 11 def define = {} ::OptionParser.new do |opts| opts. = " Usage:\n * as executable: swagcov [options]\n * as rake task: rake swagcov -- [options]\n MESSAGE\n\n opts.on(\"-i\", \"--init\", \"Generate required .swagcov.yml config file\") do |opt|\n options[:init] = opt\n end\n\n opts.on(\"-t\", \"--todo\", \"Generate optional .swagcov_todo.yml config file\") do |opt|\n options[:todo] = opt\n end\n\n opts.on(\"-v\", \"--version\", \"Display version\") do |opt|\n options[:version] = opt\n end\n end.parse!(@args)\n\n options\nrescue ::OptionParser::InvalidOption => e\n warn e.message\n warn \"For usage information, use --help\"\n exit ::Swagcov::STATUS_ERROR\nend\n" |