dorian-replace 0.1.6 → 0.2.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/lib/dorian/replace.rb +4 -3
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4cc33b2f1228281f3583145c3d330ba7f32eeca23d282df8135f4c4a511a41c3
4
- data.tar.gz: 7d1284828196d273a51cded0635f88c28a228bd52595567c2daba952abbcee00
3
+ metadata.gz: 9807abd4d766405607f92a3c0e32f10d4098211fd2a750a3a04e3c956f5c39c0
4
+ data.tar.gz: 2e21cc3070a600b4664ddbad46a62fd3f3f8936991f8063bdebd0f60b4e41a74
5
5
  SHA512:
6
- metadata.gz: ad0e7b020ccaf4033530eceae56990044e8ea1115ffd90609d76fa476fb2ae2e4cfd9ff46279412ee36490af32947cdffc48d5a1f013d377c3f55bd12a8874d6
7
- data.tar.gz: e07efeded9aae9743313d19064da54ab5d1689ee3ef0a0a4beadca34830f1b38593f713fae01091b3b94f88af106cbd26dcb40f137430e1324482312c1095f65
6
+ metadata.gz: 524e7e9938ead456b47a102956d156e0b00735e4d8f830cd1c37db9e999dd279efc65df69b72698aeb6d0e42b3f4d63c77a05bc2ec8dd7425ca10bb5186757a6
7
+ data.tar.gz: 6a36eccb56ec5d7bd0d46aa8675362b886cc44ad2b2cbad1c4df149c67b937c0212062be4b0f33b796dd51b45aaa244ed20948313f921408ab8f030512908981
@@ -1,14 +1,15 @@
1
1
  module Dorian
2
2
  class Replace
3
3
  def self.run
4
- if ARGV.size < 3
5
- puts 'USAGE: replace FROM TO FILES...'
4
+ if ARGV.size < 2
5
+ puts "USAGE: replace FROM TO FILES..."
6
+ puts "USAGE: ... | replace FROM TO"
6
7
  exit
7
8
  end
8
9
 
9
10
  from = ARGV[0]
10
11
  to = ARGV[1]
11
- files = ARGV[2..-1]
12
+ files = ARGV.size > 2 ? ARGV[2..-1] : STDIN.each_line.to_a.map(&:strip)
12
13
 
13
14
  files.each do |file|
14
15
  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.1.6
4
+ version: 0.2.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: 2021-10-10 00:00:00.000000000 Z
11
+ date: 2021-11-19 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |-
14
14
  Replace some string with some other string from the files provided