dorian-yaml-uniq 0.0.4 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/yaml-uniq +16 -7
  3. metadata +16 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 71b6d8a947308cef60b1b401bf26bcc94035b5eda5e79c0500bee2eb310023c6
4
- data.tar.gz: c6ae8e7ed40141e6e46964a389fa5c826242026891e54c71e45cadbc507a64e8
3
+ metadata.gz: 9af958e086359a72bfbadcea3259b040b32444a74ed6fc59fada88eacac2f59a
4
+ data.tar.gz: 4c8af29a027da198cd15820b7840274aedfb72fb10509593a966804049faca5a
5
5
  SHA512:
6
- metadata.gz: cd2aa973e624ff6c4cee5335727c30c08210ebf1411b44af4e6d45fa372ff8966c6ee12282bfe89ec2feefcdde3000a2cbaeba442a62b20e72b066b8c59cda29
7
- data.tar.gz: 5a032f36943b0c76f350dfadf574b8f49c4cfe8a57c1aea66616f1128a6d195b37e868f1c73734ebf83091aa5767c2dbc6b96e1bf4917ea3308ee998437268b8
6
+ metadata.gz: 56ac2c4c35ba6ff3e59b9d21ce6af1a8afd57d5b91c9c65e54be25c9766a5fb6c79a930ad6aee32601ee0261541985ae45143f0ebac14673caea92709f733d75
7
+ data.tar.gz: 3e3b709c3f09314a569da4093b1397bb27a868a317000d5d1d0908982df42856256135a1cab98eb885d1729ca4166bb6f3a41b29812310da4030267dd09f46cf
data/bin/yaml-uniq CHANGED
@@ -1,12 +1,21 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
- if ARGV.size != 1 || ARGV[0] == "--help" || ARGV[0] == "-h"
5
- puts "USAGE: ... | each CODE"
6
- exit
7
- end
4
+ require "dorian/arguments"
5
+ require "yaml"
6
+
7
+ parsed = Dorian::Arguments.parse(version: { alias: :v }, help: { alias: :h })
8
+
9
+ abort parsed.help if parsed.options.help
8
10
 
9
- $stdin.each_line do |it|
10
- it.strip!
11
- eval(ARGV.first)
11
+ if parsed.options.version
12
+ abort File.read(File.expand_path("../../VERSION", __FILE__))
12
13
  end
14
+
15
+ input = parsed.arguments.join("\n")
16
+ input += parsed.files.map { |file| File.read(file) }.join("\n")
17
+ input = $stdin.each_line.to_a.join if input.empty?
18
+
19
+ yaml = YAML.safe_load(input)
20
+ yaml.uniq! if yaml.is_a?(Array)
21
+ puts yaml.to_yaml
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dorian-yaml-uniq
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dorian Marié
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-08-18 00:00:00.000000000 Z
11
+ date: 2024-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: yaml
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: dorian-arguments
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  description: uniq yaml file from yaml path
28
42
  email: dorian@dorianmarie.com
29
43
  executables: