dorian-replace 0.5.3 → 1.1.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/replace +10 -7
  3. metadata +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1b15c7204316b23cc21d51fbaa137c310c54b14a049d22c0de33bc949b7c67ce
4
- data.tar.gz: aa850b952ab60810422147031c940c44c0a15cf45061baadb5843b8c9387a85e
3
+ metadata.gz: dfc486e1bb75cf78015e157b6ef61c54e67fdbeaec1e65015dd2771171c6a9b8
4
+ data.tar.gz: c0a4a0b83107f02a51a46cf8b21a1d8fb648c6c062146de99049f5437ad2fb87
5
5
  SHA512:
6
- metadata.gz: 0a0090ea7dd0dc684640090c95de7b38f35a443ef1849750569cb6f7d2ef75e2d27df624cccf137e1bc50f6fbac9ccbd13b0ac0959690704bf087a6b88d0e371
7
- data.tar.gz: 3228f529eddceb4600b3b6b8e17952922440ab63f460803148fabe8ae682b59611a9cef330e92da937a33a6b795db596fedc686a60296d581a46f688cf18dbcd
6
+ metadata.gz: e782844d5c8944698d7400a6eaa12bb9a04f39da687cdd7ce51388e8bf9c42ea55fdf788a9de1ce4600c76dd566d60d7149dfb0ac89b569ae14d9e2e97c160ee
7
+ data.tar.gz: bd4c7bd1393f2dde86a92c6de6bb7fa079d647bb6092a3c3062e02d319e30ad0a1c0c4a6b0e1a4468b1755159ab4f74d5901c5a85f93338ddda3955edd6eec8a
data/bin/replace CHANGED
@@ -1,15 +1,18 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
- if ARGV.size < 2 || ARGV[0] == "--help" || ARGV[0] == "-h"
5
- puts "USAGE: replace FROM TO FILES..."
6
- puts "USAGE: ... | replace FROM TO"
7
- exit
4
+ require "dorian/arguments"
5
+
6
+ parsed = Dorian::Arguments.parse(version: { alias: :v }, help: { alias: :h })
7
+
8
+ abort parsed.help if parsed.options.help
9
+
10
+ if parsed.options.version
11
+ abort File.read(File.expand_path("../VERSION", __dir__))
8
12
  end
9
13
 
10
- from = ARGV[0]
11
- to = ARGV[1]
12
- files = ARGV.size > 2 ? ARGV[2..] : $stdin.each_line.to_a.map(&:strip)
14
+ from, to = parsed.arguments
15
+ files = parsed.files.any? ? parsed.files : $stdin.each_line.to_a.map(&:strip)
13
16
 
14
17
  files.each do |file|
15
18
  next if File.directory?(file)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dorian-replace
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 1.1.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-22 00:00:00.000000000 Z
11
+ date: 2024-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dorian-arguments
@@ -43,9 +43,9 @@ require_paths:
43
43
  - lib
44
44
  required_ruby_version: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - ">="
46
+ - - '='
47
47
  - !ruby/object:Gem::Version
48
- version: '0'
48
+ version: 3.3.4
49
49
  required_rubygems_version: !ruby/object:Gem::Requirement
50
50
  requirements:
51
51
  - - ">="