diff --git a/CHANGELOG.md b/CHANGELOG.md index 11822e9..a0d416e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### Removed +## [1.2.0] - 2019-08-08 +### Added +- Versioning and help messages for CLI + +### Changed +- Extended allowed line length to 120 +- Change the mutant to only scan the latest commits + ## [1.1.0] - 2019-05-21 ### Added diff --git a/README.md b/README.md index 4ec5d8f..d7f32b0 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,20 @@ This is how you run them in your terminal: $ yaml_check my_yaml_file.yml $ yaml_normalize my_yaml_file.yml +To check the current version of yaml_normalizer type: + $ yaml_check --version + + or + + $ yaml_normalize -v + +To see the help message for yaml_normalizer type: + $ yaml_check --help + + or + + $ yaml_normalize -h + ### Include Yaml Normalizer rake tasks In your Gemfile, add diff --git a/Rakefile b/Rakefile index 6d33950..f928183 100644 --- a/Rakefile +++ b/Rakefile @@ -44,7 +44,7 @@ end desc 'Mutation testing to check mutation coverage of current RSpec test suite' task :mutant do mutant_sh = 'bundle exec mutant \ - --since 18069a6bb8779c2381b361738c866ce4c35f7466 \ + --since v1.2.0 \ --include lib \ --require yaml_normalizer \ --use rspec YamlNormalizer* 2>&1' diff --git a/lib/yaml_normalizer/helpers/param_parser.rb b/lib/yaml_normalizer/helpers/param_parser.rb index b6237ae..97e7633 100644 --- a/lib/yaml_normalizer/helpers/param_parser.rb +++ b/lib/yaml_normalizer/helpers/param_parser.rb @@ -6,29 +6,29 @@ module YamlNormalizer module Helpers # Methods handling passing of additional params from CLI module ParamParser - # rubocop:disable Metrics/MethodLength - # Parse the params provided to the service # @param [Array] args - params passed to the service # @return nil def parse_params(*args) OptionParser.new do |opts| opts.banner = "Usage: #{program_name} [options] file1, file2..." - opts.on('-v', '--version', 'Prints the yaml_normalizer version') do - print_version - exit_success - end - opts.on('-h', '--help', 'Prints this help') do - print(opts) - exit_success - end + opts.on('-v', '--version', 'Prints the yaml_normalizer version') { print_version } + opts.on('-h', '--help', 'Prints this help') { print_help(opts) } end.parse(args) end - # rubocop:enable Metrics/MethodLength # Print current version of the tool def print_version print("#{YamlNormalizer::VERSION}\n") + exit_success + end + + # Print current version of the tool + # @param [Option] opts - options of opt_parser object + # @return nil + def print_help(opts) + print(opts) + exit_success end private