lib/macros4cuke/cli/cmd-line.rb in macros4cuke-0.5.16 vs lib/macros4cuke/cli/cmd-line.rb in macros4cuke-0.5.17

- old
+ new

@@ -1,5 +1,7 @@ +# frozen_string_literal: true + # File: cli.rb # Access the OptionParser library from the standard Ruby library require 'optparse' require 'pathname' @@ -21,11 +23,11 @@ class CmdLine ShortHelpMsg = <<-END_MSG For help about the command-line syntax, do: macros4cuke --help END_MSG - .freeze + # A Hash with the result of the command-line parse. attr_reader(:options) # OptionParser object attr_reader(:parser) @@ -72,18 +74,18 @@ # Perform the command-line parsing def parse!(theCmdLineArgs) begin parser.parse!(theCmdLineArgs.dup) - rescue Macros4Cuke::CmdLineError => exc - $stderr.puts exc.message + rescue Macros4Cuke::CmdLineError => e + $stderr.puts e.message exit - rescue OptionParser::InvalidOption => exc - $stderr.puts exc.message + rescue OptionParser::InvalidOption => e + $stderr.puts e.message exit - rescue OptionParser::MissingArgument => exc - err_msg = '' - exc.args.each do |arg| + rescue OptionParser::MissingArgument => e + err_msg = +'' + e.args.each do |arg| err_msg << "No argument provided with command line option: #{arg}\n" end $stderr.puts err_msg exit end