rbfind 2.0.2 → 2.1

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 +0 -2
  3. data/lib/rbfind.rb +15 -5
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 37699eab678876b60d10d42b360d2a3bdb4f1b47d950ee28077d2087d5f35d15
4
- data.tar.gz: 575d2eaeb4208087545448ae9627a9dbf8c652e068e88c3caad3707897a3a4da
3
+ metadata.gz: 8ccb45a241d65a9dadc83c1ba5a72515f2165d18bf84564e15fad687010221a8
4
+ data.tar.gz: aef115794fdd548ba799413611e39964eca2c9ce9dc10d7ee355e95c52af1ff9
5
5
  SHA512:
6
- metadata.gz: 9027e94322984970d2aba116bd3e135395ab5fab025d36bc78796b7038057398e4fe10cc2917fd1872391be8250e609559d9c6d53c8af7cc2de6a664c4ad885c
7
- data.tar.gz: 9cc76b09a38a3212a67ddbf5d590247b672f1ed80fbfa36e9d4dfd5874f07119c57f0e76ee3c780cfe882eec02aa9d54c2567c5e2742aae12c27d88d5e6bfbbe
6
+ metadata.gz: 95c622fbc6cadf9b86eafa357c1a3dadbdb9ca8df85a83569e2855254c38bc219c11fc4e6a2c59dbeb730ff0f7e6b3133e8e5827158821c8d7ad9d6e3b03be04
7
+ data.tar.gz: f7d5151eb5402104aa7cedc31e932ec9471b0d73df230a1b7943c664ba3d2be98c8bf340624c9c6779330776eefea64241b0cdf449dd61d5ecea70c8625dd4a2
data/bin/rbfind CHANGED
@@ -37,7 +37,6 @@ module RbFind
37
37
  [ %w(--sort-by -s), :str, "sort expression ('n' is name)"],
38
38
  [ %w(--reverse -R), :str, "reverse sort"],
39
39
  [ %w(--require -r), :rb, "require library"],
40
- [ %w(--fileutils -U), nil, "include FileUtils module"],
41
40
  [ %w(--puts-path -p), nil, "do 'puts path/cpath' on true block"],
42
41
  [ %w(--ls-l -P), nil, "do 'ls -l' style output on true block"],
43
42
  [ %w(--wider -+), nil, "widen fields in long output format (--ls-l)"],
@@ -85,7 +84,6 @@ module RbFind
85
84
  when '--sort-by' then @params[ :sort] = instance_eval "proc { |n| #{arg} }"
86
85
  when '--reverse' then @params[ :reverse] = true
87
86
  when '--require' then require arg
88
- when '--fileutils' then require "fileutils" ; include FileUtils
89
87
  when '--puts-path' then @puts = true
90
88
  when '--ls-l' then @puts = true ; @wd = 6
91
89
  when '--wider' then @wd = @wd ? @wd.succ : 4
@@ -8,7 +8,7 @@ require "rbfind/csv"
8
8
 
9
9
  module RbFind
10
10
 
11
- VERSION = "2.0.2".freeze
11
+ VERSION = "2.1".freeze
12
12
 
13
13
  =begin rdoc
14
14
 
@@ -119,6 +119,8 @@ Derivated from stat:
119
119
  csv sep, path, ... # separate by user-defined separator
120
120
 
121
121
  rename newname # rename, but leave it in the same directory
122
+ mv newname # dto.
123
+ rm # remove
122
124
 
123
125
 
124
126
  == Color support
@@ -374,16 +376,22 @@ Sort without case sensitivity and preceding dot:
374
376
  begin
375
377
  e.instance_eval &@block
376
378
  rescue Done
377
- ensure
378
- if !(e.name.equal? @levels.last) && e.name != @levels.last then
379
- p = @path
379
+ end
380
+ if !(e.name.equal? @levels.last) && e.name != @levels.last then
381
+ if e.name then
380
382
  e.name == (File.basename e.name) or
381
383
  raise "#{self.class}: rename to `#{e.name}' may not be a path."
382
384
  e.name.freeze
383
385
  @levels.pop
384
386
  @levels.push e.name
385
- @path = join_path
387
+ p, @path = @path, join_path
386
388
  File.rename p, @path
389
+ else
390
+ if e.dir? then
391
+ Dir.rmdir @path
392
+ else
393
+ File.unlink @path
394
+ end
387
395
  end
388
396
  end
389
397
  true
@@ -682,7 +690,9 @@ Sort without case sensitivity and preceding dot:
682
690
 
683
691
 
684
692
  def rename newname ; @name = newname ; end
693
+ alias mv rename
685
694
 
695
+ def rm ; @name = nil ; end
686
696
 
687
697
 
688
698
  def cname ; color name ; end
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.0.2
4
+ version: '2.1'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bertram Scharpf
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-14 00:00:00.000000000 Z
11
+ date: 2020-07-20 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |
14
14
  A replacement for the standard UNIX command find.