Skip to content

Commit

Permalink
[yaml_normalizer] Updated docs for 1.2.0 version, small opt_parser re…
Browse files Browse the repository at this point in the history
…factor
  • Loading branch information
JanTaras29 committed Aug 8, 2019
1 parent 3cffb45 commit 0baa016
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 12 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
22 changes: 11 additions & 11 deletions lib/yaml_normalizer/helpers/param_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0baa016

Please sign in to comment.