dorian-each 0.4.2 → 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/each +11 -7
  3. metadata +17 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 457cd86b814a8800225ac31dba35717a08f6ee36f2edb07c3edf902d4ed33c16
4
- data.tar.gz: 4672c34a270c5a157a243a6f892a4bca9e172d3db49c5eb89abf98e2178a1e75
3
+ metadata.gz: 2535892b7e895248bd296accdf5895a2bc26b757c2a5f88dafa454da31d0c4a8
4
+ data.tar.gz: 85bf14385ebd419587867d3bb739e40f2b0fbcbf42dac6edf3bc1d306364980b
5
5
  SHA512:
6
- metadata.gz: 46461898bea8fa8babe495f81022b658beb127ef846123bfaedbdde46f16a530f2b82bf2692db83c49be8b37c857e6c4b86797564a3cae0739dd3541ba336222
7
- data.tar.gz: 074acfc97f286369a27c07bcd934eef4bb900d7d60dd5c4470e441c5353c94f2f605fb423d02a95815620b1ebf22074677ab25964d128c4045f7b417a327388d
6
+ metadata.gz: 06ddfc0903a5d5b9f1242282a911a4f6a0dc7f8725edd6a45091f187b398a87fa872b277fc43abc01e4b67e918d19f4acba2c4d0c703c6a7d70c7d02d4cf560b
7
+ data.tar.gz: 85c9d8c3ccf9a059b04ecf28ac2f5814da46b0082a6cf2aab3259b1bf3ceb1d93de097141e8a451cdaf7cb8e5759b0ce62bc9241463ce39a728c2ce795a8983a
data/bin/each CHANGED
@@ -1,12 +1,16 @@
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
+
6
+ parsed = Dorian::Arguments.parse(version: { alias: :v }, help: { alias: :h })
8
7
 
9
- $stdin.each_line do |it|
10
- it.strip!
11
- eval(ARGV.first)
8
+ abort parsed.help if parsed.options.help
9
+
10
+ if parsed.options.version
11
+ abort File.read(File.expand_path("../../VERSION", __FILE__))
12
12
  end
13
+
14
+ input = parsed.files.map { |file| File.read(file) }.join("\n")
15
+ input = $stdin.each_line.to_a.map(&:strip).join("\n") if input.empty?
16
+ input.lines.map(&:strip).each { |it| eval(parsed.arguments.join(" ")) }
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dorian-each
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
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
12
- dependencies: []
11
+ date: 2024-08-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: dorian-arguments
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  description: evaluates some code on each line of the input
14
28
  email: dorian@dorianmarie.com
15
29
  executables: