yamlook 0.3.1 → 0.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 867706c81bb16407e762b76754d645825cdb6ba53030ac1ce5bf99d46087b5a9
4
- data.tar.gz: 1c0a8face94149303d06484573db378b23cfe8a6e6d0e7ab6229737f62201103
3
+ metadata.gz: df1211ccca0c68e598391b78bd6328f09a1f67eb0948a926c5263bfa7206934a
4
+ data.tar.gz: 496953bbe6969dc05ff4165b2ab4ac8a76eb9df68be265b126c2b6eacb7061f8
5
5
  SHA512:
6
- metadata.gz: a2c4351ab5486d2a8802f935afc331af435b7655f0de81dae3f030235524682f80c8f867af85f5a041b0e70699c4edf74ec62e2bae1488353647310576abc7c8
7
- data.tar.gz: db2af0dcb85bc99700317118320453aad3dc8d1e46d8597e80e069b3f24687d2a4105203a82fdbf954ebe57eeb2c7e40108da3880a3131431a6aa255bf5f6667
6
+ metadata.gz: bdf2d00d030814fc65940d1ad4d3bed49dbad70a022945d8b2534f303316646a289670d1e99cf40a8f993870f96cfbd35f942c2b9cb105acccdd6c522272302c
7
+ data.tar.gz: 7c68b6c0b71d2975014197ad68cde9f3e503213d5124ed993df1743530650e15e41ff450fd8b02d981ffde3a168fc567b31daf097823b786e7490fcd9596d06a
data/bin/yamlook CHANGED
@@ -5,4 +5,6 @@ $LOAD_PATH.unshift("#{__dir__}/../lib")
5
5
 
6
6
  require 'yamlook'
7
7
 
8
- Yamlook::Search.perform(ARGV[0].split('.'))
8
+ cli_parser = Yamlook::Cli.new(ARGV)
9
+
10
+ Yamlook::Search.perform(cli_parser.argument.split('.'))
data/lib/yamlook.rb CHANGED
@@ -7,3 +7,4 @@ require 'yamlook/node_list'
7
7
  require 'yamlook/locale'
8
8
  require 'yamlook/file'
9
9
  require 'yamlook/search'
10
+ require 'yamlook/cli'
@@ -0,0 +1,56 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'optparse'
4
+ require 'yamlook/version'
5
+
6
+ module Yamlook
7
+ # Yamlook CLI
8
+ class Cli
9
+ attr_reader :arguments, :options
10
+
11
+ def initialize(arguments)
12
+ @arguments = arguments
13
+ @options = {}
14
+
15
+ opt_parser.parse!(@arguments)
16
+
17
+ show_help! if @arguments.empty?
18
+ rescue OptionParser::InvalidOption => e
19
+ puts e
20
+ exit 1
21
+ end
22
+
23
+ def argument
24
+ @arguments.first
25
+ end
26
+
27
+ private
28
+
29
+ # rubocop:disable Metrics/MethodLength
30
+ def opt_parser
31
+ @opt_parser ||= OptionParser.new do |opts|
32
+ opts.banner = 'Usage: yamlook KEYS'
33
+ opts.separator ''
34
+ opts.separator 'Example: yamlook some.deep.key.in.you.yaml.file'
35
+
36
+ opts.separator ''
37
+ opts.separator 'Options:'
38
+ opts.on_tail('-h', '--help', 'Show this message') do
39
+ puts opts.help
40
+ exit
41
+ end
42
+
43
+ opts.on_tail('--version', 'Show version') do
44
+ puts Yamlook::VERSION
45
+ exit
46
+ end
47
+ end
48
+ end
49
+ # rubocop:enable Metrics/MethodLength
50
+
51
+ def show_help!
52
+ puts opt_parser.help
53
+ exit
54
+ end
55
+ end
56
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Yamlook
4
- VERSION = '0.3.1'
4
+ VERSION = '0.3.5'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yamlook
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Viacheslav Mefodin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-08 00:00:00.000000000 Z
11
+ date: 2021-08-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: psych
@@ -72,6 +72,7 @@ files:
72
72
  - README.md
73
73
  - bin/yamlook
74
74
  - lib/yamlook.rb
75
+ - lib/yamlook/cli.rb
75
76
  - lib/yamlook/file.rb
76
77
  - lib/yamlook/locale.rb
77
78
  - lib/yamlook/node.rb
@@ -98,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
98
99
  - !ruby/object:Gem::Version
99
100
  version: '0'
100
101
  requirements: []
101
- rubygems_version: 3.0.9
102
+ rubygems_version: 3.1.4
102
103
  signing_key:
103
104
  specification_version: 4
104
105
  summary: Search occurrences of dot-notated yaml keys.