rbfind 2.14 → 2.15

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: d2f219a0e17b31db93bb38ec0425b37cc0a5921cdbd89638bab4de5d4303e161
4
- data.tar.gz: 0d470ef4ceac6aa088aea20c4ae7804341fbb5a84d23108bf5342acb6ad5e0e7
3
+ metadata.gz: f3e09c84e19be797486dcc7542e6c7f4ad5c0f40902c49a3863ea935ce13bc90
4
+ data.tar.gz: 1f8a5b49effa192a4a0adbcad84a9c34646ddbc34926ca14af608cb0e526c3a4
5
5
  SHA512:
6
- metadata.gz: d67aae93c618f927f4b3c8ffad8916c0e526be0a59c9567538b90ac5de8d70f317799119347aa370088aae5a77ca95b30eec90f18fd269006d0ec886247f1ecf
7
- data.tar.gz: 56c9ba35469ac5b677b2aa3c6e7b9ee5977e0abcf65c563704aa768b29fc6afdf92ff92931c317c8a273af69b3ed2344cf25ee6e8d10d9782fb30043b438c956
6
+ metadata.gz: 8d4ca8a987bdc92a7518504f558f2a6eedb0da3885ea6934937c9bbe70687d2b6aa02a19e2f358ff6a68b1b78e42b3c15c8d053ef659b88f1d8cc73834c622f9
7
+ data.tar.gz: ebcde948bfb8827b6d54f7a09b85b4d935e6748b5cc30b3b24fb8ef58403bb0b6b8d8b4076967f8d4ed746d65e73989cbc6456942f19a11042dfa94a42f837ee
data/bin/rbfind CHANGED
@@ -62,7 +62,7 @@ module RbFind
62
62
  option %w(N nodirs ), "skip directories" do @nodirs = true ; end
63
63
  option %w(B begin ), "eval block before begin" do |blk| @blkbegin = blk ; end
64
64
  option %w(E end ), "eval block after end" do |blk| @blkend = blk ; end
65
- option %w(f file ), "read block expression from file" do |nam| @block = File.open nam do |f| f.each { |l| l.chomp! } end ; end
65
+ option %w(f file ), "read block expression from file" do |nam| @block = File.read nam ; end
66
66
  option %w(K encoding ), "encoding extern[:intern] (same as ruby -E)" do |str| e, i = str.split ":", 2 ; set_encoding e, i ; end
67
67
  option %w( width-user), "width of user field" do |num| @wdu = num.to_i.nonzero? ; end
68
68
  option %w( width-size), "width of size field" do |num| @wds = num.to_i.nonzero? ; end
@@ -126,12 +126,18 @@ module RbFind
126
126
  end
127
127
 
128
128
  def join_code a, ind = 0
129
- case a
130
- when Array then
131
- a.map { |e| join_code e, ind + 1 }.join "\n"
132
- else
133
- INDENT * ind + a.to_s
134
- end
129
+ r = a.map { |e|
130
+ q = case e
131
+ when Array then
132
+ join_code e, ind + 1
133
+ else
134
+ INDENT * ind + e.to_s
135
+ end
136
+ q.rstrip!
137
+ q unless q.empty?
138
+ }
139
+ r.compact!
140
+ r.join "\n"
135
141
  end
136
142
 
137
143
  def build_block
@@ -148,7 +154,7 @@ module RbFind
148
154
  when :grep then
149
155
  ic = Regexp::IGNORECASE if @icase
150
156
  color = ", true" if co
151
- @block = [ "grep %r#{build_re @block, ic}#{color}"]
157
+ @block = [ "grep %r#{build_re @block.to_s, ic}#{color}"]
152
158
  @block.push "$stdout.flush" unless $stdout.tty?
153
159
  @binary or @block = [ "unless binary? then", @block, "end"]
154
160
 
@@ -161,6 +167,7 @@ module RbFind
161
167
  @block = @args.pop
162
168
  end
163
169
  end
170
+ @block = [ "$_, $. = name, count", @block]
164
171
  output = case @puts
165
172
  when :ls then long_fmt false, false, "mtime.lsish", opath, co
166
173
  when :alt then long_fmt true, true, "mtime.long", opath, co
@@ -168,7 +175,7 @@ module RbFind
168
175
  when :ino then [ "spcsep ino.w8, nlink.w2, #{opath}"]
169
176
  when :plain then [ "puts #{opath}"]
170
177
  end
171
- output and @block = [ "if (", [ @block], ") then", output, "end"]
178
+ output and @block = [ "if (", @block, ") then", output, "end"]
172
179
 
173
180
  end
174
181
 
@@ -48,7 +48,7 @@ class Numeric # sizes in bytes
48
48
  def GiB ; self * Gb ; end
49
49
  def TiB ; self * Tb ; end
50
50
 
51
- PREFIXES = " kMGTPEZY".scan /./ # :nodoc:
51
+ PREFIXES = " kMGTPEZY"
52
52
 
53
53
  # :call-seq:
54
54
  # num.to_h() -> str
data/lib/rbfind.rb CHANGED
@@ -8,7 +8,7 @@ require "rbfind/csv"
8
8
 
9
9
  module RbFind
10
10
 
11
- VERSION = "2.14".freeze
11
+ VERSION = "2.15".freeze
12
12
 
13
13
  =begin rdoc
14
14
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbfind
3
3
  version: !ruby/object:Gem::Version
4
- version: '2.14'
4
+ version: '2.15'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bertram Scharpf
@@ -33,7 +33,7 @@ files:
33
33
  - lib/rbfind/table.rb
34
34
  homepage: http://www.bertram-scharpf.de/software/rbfind
35
35
  licenses:
36
- - BSD-2-Clause
36
+ - BSD-2-Clause+
37
37
  metadata: {}
38
38
  rdoc_options: []
39
39
  require_paths: