rbfind 2.10 → 2.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/rbfind +51 -47
  3. data/lib/rbfind.rb +4 -4
  4. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 46d51dbb19b8c3aa73e4c074f20e8495a7fb7e84e9642244b5d1c0876aaf716b
4
- data.tar.gz: 4ccf7ac31f160c39570eb0b0b757b9f61ff3bc27c92396a98af02eadecaeb2f3
3
+ metadata.gz: 42423613ef5e13b66ee84521bbcc54152d003029d03045023be9d5b462b932c2
4
+ data.tar.gz: 0fdef9df522018d6e2beb14e8793f843a4fb363daf77b410ae5307d3d322581b
5
5
  SHA512:
6
- metadata.gz: c17eb0562ab36f7ab0ea09ee1e98b1b5237f8f1b6787b5fa5668522287987e9aff857cbbac5224b74e6cb0d8893871e2d9a0d0f942eda45f1a7e09d8b8f863a9
7
- data.tar.gz: 4f2150d32c0fb4527e89210aba063810333fec51f401260f2d03cc0ee1e8f2d9f513bf67cabe99147664cf13b83f4c4a1db504034b6760333cf9730b390bafd5
6
+ metadata.gz: 749e55300915ef81eb78e94c92df156c486da011844aa5b396e14e1780074a275e980867cd1275c9d75771e775bc7a1d9200d4f699dd3d2dccac8d695cb52991
7
+ data.tar.gz: 4d67e39478fe2a9a675eed6ec4d4ba00d88c427020afe3942601c79055f7aaf94c57ee539b8ffd796fe6904ace8d071f809b0e68ec14b692c00fff214a4809cb
data/bin/rbfind CHANGED
@@ -66,62 +66,66 @@ module RbFind
66
66
  [ %w(--end -E), :blk, "eval block after end"],
67
67
  [ %w(--file -f), :nam, "read block expression from file"],
68
68
  [ %w(--encoding -K), :str, "encoding extern[:intern] (same as ruby -E)"],
69
+ [ %w(--width-user ), :num, "width of user field"],
70
+ [ %w(--width-size ), :num, "width of size field"],
69
71
  ]
70
72
 
71
73
  def initialize
72
74
  @params = {}
73
75
  envopts = ENV[ "RBFIND_OPTIONS"]
74
76
  $*.unshift *envopts.split if envopts
75
- opts = GetoptLong.new *OPTIONS.map { |(long,short),arg,|
76
- [long,short,(arg ? GetoptLong::REQUIRED_ARGUMENT : GetoptLong::NO_ARGUMENT)]
77
+ opts = GetoptLong.new *OPTIONS.map { |names,arg,|
78
+ [*names,(arg ? GetoptLong::REQUIRED_ARGUMENT : GetoptLong::NO_ARGUMENT)]
77
79
  }
78
80
  opts.ordering = GetoptLong::PERMUTE
79
81
  opts.quiet = true
80
82
  opts.each do |opt,arg|
81
83
  case opt
82
- when '--help' then usage ; exit
83
- when '--version' then puts PROGRAM ; exit
84
- when '--examples' then usage_examples ; exit
85
- when '--verbose' then @verbose = true
86
- when '--show' then @show = true
87
- when '--bw' then @color = false
88
- when '--colored' then @color = true
89
- when '--depth' then @params[ :depth_first] = true
90
- when '--maxdepth' then @params[ :max_depth] = arg.to_i.nonzero?
91
- when '--argsdepth' then @params[ :args_depth] = true
92
- when '--follow' then @params[ :follow] = true
93
- when '--nosort' then @params[ :sort] = false
94
- when '--sort-by' then @params[ :sort] = instance_eval "proc { #{arg} }"
95
- when '--time' then @params[ :sort] = proc { mtime } ; @params[ :reverse] = true
96
- when '--size' then @params[ :sort] = proc { size } ; @params[ :reverse] = true
97
- when '--dirs' then @params[ :dirs] = true
98
- when '--reverse' then @params[ :reverse] = !@params[ :reverse]
99
- when '--require' then require arg
100
- when '--puts-path' then @puts = true
101
- when '--ls-l' then @puts = :ls ; @wds = 6 ; @wd = 6
102
- when '--long' then @puts = :alt ; @wds = 7 ; @wd = 4
103
- when '--humanage' then @puts = :hum ; @wds = 7 ; @wd = 4
104
- when '--ino' then @puts = :ino ; @wds = 8 ; @wd = 2
105
- when '--wider' then @wd and @wd += 2 ; @wds and @wds += @puts != :ls ? 4 : 3
106
- when '--slash' then @slash = true
107
- when '--lines' then @lines = :plain ; @block = arg
108
- when '--reallines' then @lines = :plain ; @real = true ; @block = arg
109
- when '--grep' then @lines = :grep ; @block = arg
110
- when '--igrep' then @lines = :grep ; @icase = true ; @block = arg
111
- when '--binary' then @binary = true
112
- when '--no-vcs' then @vcs = true
113
- when '--no-swap' then @vim = true
114
- when '--skip' then @skip = arg
115
- when '--demand' then @demand = arg
116
- when '--ext' then @ext = arg
117
- when '--visible' then @visible = true
118
- when '--all' then @visible = false
119
- when '--icase' then @icase = true
120
- when '--nodirs' then @nodirs = true
121
- when '--begin' then @blkbegin = arg
122
- when '--end' then @blkend = arg
123
- when '--file' then @block = File.open arg do |f| f.each { |l| l.chomp! } end
124
- when '--encoding' then e, i = arg.split ":" ; set_encoding e, i
84
+ when '--help' then usage ; exit
85
+ when '--version' then puts PROGRAM ; exit
86
+ when '--examples' then usage_examples ; exit
87
+ when '--verbose' then @verbose = true
88
+ when '--show' then @show = true
89
+ when '--bw' then @color = false
90
+ when '--colored' then @color = true
91
+ when '--depth' then @params[ :depth_first] = true
92
+ when '--maxdepth' then @params[ :max_depth] = arg.to_i.nonzero?
93
+ when '--argsdepth' then @params[ :args_depth] = true
94
+ when '--follow' then @params[ :follow] = true
95
+ when '--nosort' then @params[ :sort] = false
96
+ when '--sort-by' then @params[ :sort] = instance_eval "proc { #{arg} }"
97
+ when '--time' then @params[ :sort] = proc { mtime } ; @params[ :reverse] = true
98
+ when '--size' then @params[ :sort] = proc { size } ; @params[ :reverse] = true
99
+ when '--dirs' then @params[ :dirs] = true
100
+ when '--reverse' then @params[ :reverse] = !@params[ :reverse]
101
+ when '--require' then require arg
102
+ when '--puts-path' then @puts = true
103
+ when '--ls-l' then @puts = :ls ; @wds ||= 6 ; @wdu ||= 6
104
+ when '--long' then @puts = :alt ; @wds ||= 7 ; @wdu ||= 4
105
+ when '--humanage' then @puts = :hum ; @wds ||= 7 ; @wdu ||= 4
106
+ when '--ino' then @puts = :ino ; @wds ||= 8 ; @wdu ||= 2
107
+ when '--wider' then @wdu and @wdu += 2 ; @wds and @wds += @puts != :ls ? 4 : 3
108
+ when '--slash' then @slash = true
109
+ when '--lines' then @lines = :plain ; @block = arg
110
+ when '--reallines' then @lines = :plain ; @real = true ; @block = arg
111
+ when '--grep' then @lines = :grep ; @block = arg
112
+ when '--igrep' then @lines = :grep ; @icase = true ; @block = arg
113
+ when '--binary' then @binary = true
114
+ when '--no-vcs' then @vcs = true
115
+ when '--no-swap' then @vim = true
116
+ when '--skip' then @skip = arg
117
+ when '--demand' then @demand = arg
118
+ when '--ext' then @ext = arg
119
+ when '--visible' then @visible = true
120
+ when '--all' then @visible = false
121
+ when '--icase' then @icase = true
122
+ when '--nodirs' then @nodirs = true
123
+ when '--begin' then @blkbegin = arg
124
+ when '--end' then @blkend = arg
125
+ when '--file' then @block = File.open arg do |f| f.each { |l| l.chomp! } end
126
+ when '--encoding' then e, i = arg.split ":" ; set_encoding e, i
127
+ when '--width-user' then @wdu = arg.to_i.nonzero?
128
+ when '--width-size' then @wds = arg.to_i.nonzero?
125
129
  end
126
130
  end
127
131
  @args = $*.dup
@@ -160,7 +164,7 @@ module RbFind
160
164
  [
161
165
  "spcsep stype+modes,",
162
166
  [
163
- "user#{b}.w#@wd, group#{b}.w#@wd,",
167
+ "user#{b}.w#@wdu, group#{b}.w#@wdu,",
164
168
  "size.w#{g}#@wds, #{time},",
165
169
  "#{opath} + #{co ? 'carrow' : 'arrow'}.to_s",
166
170
  ]
@@ -234,7 +238,7 @@ module RbFind
234
238
  when :ls then long_fmt false, false, "mtime.lsish", opath, co
235
239
  when :alt then long_fmt true, true, "mtime.long", opath, co
236
240
  when :hum then long_fmt true, true, "mage.t.r4", opath, co
237
- when :ino then [ "spcsep ino.w#@wds, nlink.w#@wd, #{opath}"]
241
+ when :ino then [ "spcsep ino.w8, nlink.w2, #{opath}"]
238
242
  else [ "puts #{opath}"]
239
243
  end
240
244
  @block = [ "if (", [ cond], ") then", @block, "end"] if cond
data/lib/rbfind.rb CHANGED
@@ -8,7 +8,7 @@ require "rbfind/csv"
8
8
 
9
9
  module RbFind
10
10
 
11
- VERSION = "2.10".freeze
11
+ VERSION = "2.12".freeze
12
12
 
13
13
  =begin rdoc
14
14
 
@@ -356,7 +356,7 @@ Sort without case sensitivity and preceding dot:
356
356
 
357
357
  def visit_dir dir
358
358
  return if @params.max_depth and @params.max_depth <= @depth
359
- list = (Dir.new dir).children.map { |f| Entry.new f, self }
359
+ list = Dir.open dir do |d| d.children.map { |f| Entry.new f, self } end
360
360
  sort_entries list
361
361
  step_depth do
362
362
  list.each { |e| enter e }
@@ -566,7 +566,7 @@ Sort without case sensitivity and preceding dot:
566
566
  # or not accessible, +nil+ is returned.
567
567
  #
568
568
  def empty?
569
- (Dir.new @path).each_child { |f| return false }
569
+ Dir.open @path do |d| d.each_child { |f| return false } end
570
570
  true
571
571
  rescue Errno::ENOTDIR
572
572
  end
@@ -591,7 +591,7 @@ Sort without case sensitivity and preceding dot:
591
591
  # +nil+ is returned.
592
592
  #
593
593
  def entries
594
- (Dir.new @path).children
594
+ Dir.open @path do |d| d.children end
595
595
  rescue Errno::ENOTDIR
596
596
  end
597
597
  alias children entries
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.10'
4
+ version: '2.12'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bertram Scharpf
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-22 00:00:00.000000000 Z
11
+ date: 2024-09-24 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |
14
14
  A replacement for the standard UNIX command find.
@@ -54,7 +54,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
54
54
  version: '0'
55
55
  requirements:
56
56
  - just Ruby
57
- rubygems_version: 3.4.20
57
+ rubygems_version: 3.5.18
58
58
  signing_key:
59
59
  specification_version: 4
60
60
  summary: Ruby replacement for the standard Unix find tool