rbfind 2.8.1 → 2.8.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/rbfind +7 -7
- data/lib/rbfind.rb +28 -12
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 673e3195f462c1f8b06eeb61423bc73811a84e28f191f963af2c546d43717f4a
|
4
|
+
data.tar.gz: 20218e28ea03d78c4e0dba0bbf2aa2a2d8ae484839075eee8bfbec013efd2916
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 44276ce8399adf25ad8bcfad934522d5667ba8120d8d44bcda05fd705d272512a3a5302a0419b1a6d87049a948418df2d5c7c45a49603aba531a3096da103a86
|
7
|
+
data.tar.gz: 24d752cffc2e7669e60b225d6ce1108c9b0d51006215602e564daeeea1ccc2e6ad06ee306674109c371ffa28adb6da71b3f34e487959782abdba12dd71888f69
|
data/bin/rbfind
CHANGED
@@ -31,8 +31,8 @@ module RbFind
|
|
31
31
|
[ %w(--bw -w), nil, "black and white on -p or default output"],
|
32
32
|
[ %w(--colored -c), nil, "force color on -p or default output"],
|
33
33
|
[ %w(--depth -d), nil, "yield directory after its contents"],
|
34
|
-
[ %w(--maxdepth -m), :num, "maxium step depth"],
|
35
|
-
[ %w(--
|
34
|
+
[ %w(--maxdepth -m), :num, "maxium step depth (0 = any)"],
|
35
|
+
[ %w(--argsdepth -A), nil, "args have depth 1 (not 0)"],
|
36
36
|
[ %w(--follow -y), nil, "follow symbolic links"],
|
37
37
|
[ %w(--nosort -U), nil, "unsorted"],
|
38
38
|
[ %w(--sort-by -s), :str, "sort expression"],
|
@@ -85,8 +85,8 @@ module RbFind
|
|
85
85
|
when '--bw' then @color = false
|
86
86
|
when '--colored' then @color = true
|
87
87
|
when '--depth' then @params[ :depth_first] = true
|
88
|
-
when '--maxdepth' then @params[ :max_depth] = arg.to_i
|
89
|
-
when '--
|
88
|
+
when '--maxdepth' then @params[ :max_depth] = arg.to_i.nonzero?
|
89
|
+
when '--argsdepth' then @params[ :args_depth] = true
|
90
90
|
when '--follow' then @params[ :follow] = true
|
91
91
|
when '--nosort' then @params[ :sort] = false
|
92
92
|
when '--sort-by' then @params[ :sort] = instance_eval "proc { #{arg} }"
|
@@ -240,10 +240,10 @@ module RbFind
|
|
240
240
|
"--" stops option processing.
|
241
241
|
|
242
242
|
The last argument is a block that will be executed on every found
|
243
|
-
file object. It may be omitted; then "puts path" is assumed or
|
244
|
-
in case the output is a terminal.
|
243
|
+
file object. It may be omitted; then "puts path" is assumed, or
|
244
|
+
"puts cpath" in case the output is a terminal.
|
245
245
|
|
246
|
-
Default sort order is
|
246
|
+
Default sort order is by name.
|
247
247
|
EOT
|
248
248
|
end
|
249
249
|
|
data/lib/rbfind.rb
CHANGED
@@ -8,7 +8,7 @@ require "rbfind/csv"
|
|
8
8
|
|
9
9
|
module RbFind
|
10
10
|
|
11
|
-
VERSION = "2.8.
|
11
|
+
VERSION = "2.8.2".freeze
|
12
12
|
|
13
13
|
=begin rdoc
|
14
14
|
|
@@ -270,12 +270,12 @@ Sort without case sensitivity and preceding dot:
|
|
270
270
|
|
271
271
|
private
|
272
272
|
|
273
|
-
Params = Struct.new :max_depth, :depth_first, :follow,
|
273
|
+
Params = Struct.new :max_depth, :args_depth, :depth_first, :follow,
|
274
274
|
:sort, :dirs, :reverse, :error, :block
|
275
275
|
|
276
|
-
def initialize max_depth: nil, depth_first: nil, follow: nil,
|
276
|
+
def initialize max_depth: nil, args_depth: false, depth_first: nil, follow: nil,
|
277
277
|
sort: true, dirs: false, reverse: false, error: nil, &block
|
278
|
-
@params = Params.new max_depth, depth_first, follow,
|
278
|
+
@params = Params.new max_depth, args_depth, depth_first, follow,
|
279
279
|
(sort_parser sort), dirs, reverse, error, block
|
280
280
|
@start = Time.instance_eval { @start = Time.now }
|
281
281
|
Time.instance_eval { @start = Time.now }
|
@@ -299,10 +299,12 @@ Sort without case sensitivity and preceding dot:
|
|
299
299
|
if args.empty? then
|
300
300
|
visit_dir Dir::CUR_DIR
|
301
301
|
else
|
302
|
-
args.
|
303
|
-
|
304
|
-
|
305
|
-
|
302
|
+
list = args.map { |base| Entry.new base, self }
|
303
|
+
list.select! { |e| handle_error do e.stat end }
|
304
|
+
sort_entries list
|
305
|
+
step_depth_args do
|
306
|
+
list.each { |e| enter e }
|
307
|
+
end
|
306
308
|
end
|
307
309
|
end
|
308
310
|
|
@@ -319,6 +321,16 @@ Sort without case sensitivity and preceding dot:
|
|
319
321
|
@depth -= 1
|
320
322
|
end
|
321
323
|
|
324
|
+
def step_depth_args
|
325
|
+
if @params[ :args_depth] then
|
326
|
+
step_depth do
|
327
|
+
yield
|
328
|
+
end
|
329
|
+
else
|
330
|
+
yield
|
331
|
+
end
|
332
|
+
end
|
333
|
+
|
322
334
|
def enter elem
|
323
335
|
c_, @current = @current, elem
|
324
336
|
@count += 1
|
@@ -345,16 +357,20 @@ Sort without case sensitivity and preceding dot:
|
|
345
357
|
def visit_dir dir
|
346
358
|
return if @params.max_depth and @params.max_depth <= @depth
|
347
359
|
list = (Dir.new dir).children.map { |f| Entry.new f, self }
|
360
|
+
sort_entries list
|
361
|
+
step_depth do
|
362
|
+
list.each { |e| enter e }
|
363
|
+
end
|
364
|
+
end
|
365
|
+
|
366
|
+
def sort_entries list
|
348
367
|
@params.sort.call list
|
349
368
|
list.reverse! if @params.reverse
|
350
369
|
if @params.dirs then
|
351
|
-
list
|
370
|
+
list.replace list.partition { |e| e.rstat.directory? rescue nil }
|
352
371
|
list.reverse! if @params.depth_first
|
353
372
|
list.flatten!
|
354
373
|
end
|
355
|
-
step_depth do
|
356
|
-
list.each { |e| enter e }
|
357
|
-
end
|
358
374
|
end
|
359
375
|
|
360
376
|
def enter_dir
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbfind
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.8.
|
4
|
+
version: 2.8.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bertram Scharpf
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-03-
|
11
|
+
date: 2021-03-22 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |
|
14
14
|
A replacement for the standard UNIX command find.
|