dle 0.1.2 → 0.1.3

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
  SHA1:
3
- metadata.gz: 4e626d98336ab00f1eba38cdb2ac2c8ece8d117d
4
- data.tar.gz: ad3b0e3b3957594f672b015138c8bfbf2559399a
3
+ metadata.gz: b93e109c474d35ba962565151925dbce37d71ab5
4
+ data.tar.gz: b300d9592ebde5e28ce3413380ad01ed0b0ba254
5
5
  SHA512:
6
- metadata.gz: 8cd1db20c569827e03f16e675bfd91792b6320b0552c3b3db16539fc453eac678fa9e665274fd4dab144af89535b8001702524b093d82f1e07f9de9c5cc2ac4b
7
- data.tar.gz: 799f52f04be31a2ff9ff45fa5c6ee71b029a899e271f301c6405607f38042788c339057450d181128e8ebab81c690964695ae85ef874c618af236f4803b0095f
6
+ metadata.gz: 962f86f44a67fa42ca803c2ef44b43f95d7f11ddc7e95ac4c6fb85e08c20d2b68a6845c8b5aad358be0ba5ce7556334df01ff99842b8a1494ba442a97ba3b51c
7
+ data.tar.gz: 77be89e5d6788b1e0d251c8a95d45bf8157e3d0dbe6ff47764ba5415433444c9841f3fe357c0b4902f4146d73691033def67783f1545f652781893117880523e
data/README.md CHANGED
@@ -5,6 +5,8 @@ You can copy, move, rename, chmod, chown or remove individual files or directori
5
5
 
6
6
  **BETA product, use at your own risk, use `--simulate` to be sure, always have a backup!**
7
7
 
8
+ **[» See it in action!](https://www.youtube.com/watch?v=-xfnx3VQvNQ)**
9
+
8
10
  ## Requirements
9
11
 
10
12
  You will need a UNIX system with a working Ruby installation, sorry Windozer!
@@ -30,6 +32,8 @@ To get a list of available options invoke DLE with the `--help` or `-h` option:
30
32
  -r, --skip-review Skip review changes before applying
31
33
  -s, --simulate Don't apply changes, show commands instead
32
34
  -f, --file DLFILE Use input file (be careful)
35
+ -o, --only pattern files, dirs or regexp (without delimiters)
36
+ e.g.: dle ~/Movies -o "(mov|mkv|avi)$"
33
37
  -m, --monochrome Don't colorize output
34
38
  -h, --help Shows this help
35
39
  -v, --version Shows version and other info
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.1.3
@@ -14,11 +14,13 @@ module Dle
14
14
  end
15
15
 
16
16
  def dispatch_help
17
- @optparse.to_s.split("\n").each(&method(:log))
18
- log ""
19
- log "To set your favorite editor set the env variable #{c "DLE_EDITOR", :magenta}"
20
- log "Note that you need a blocking call (e.g. subl -w, mate -w)"
21
- log "Your current editor is: #{c @editor || "none", :magenta}"
17
+ logger.log_without_timestr do
18
+ @optparse.to_s.split("\n").each(&method(:log))
19
+ log ""
20
+ log "To set your favorite editor set the env variable #{c "DLE_EDITOR", :magenta}"
21
+ log "Note that you need a blocking call (e.g. subl -w, mate -w)"
22
+ log "Your current editor is: #{c @editor || "none", :magenta}"
23
+ end
22
24
  end
23
25
 
24
26
  def dispatch_info
@@ -79,7 +81,7 @@ module Dle
79
81
  # index filesystem
80
82
  log("index #{c base_dir, :magenta}")
81
83
  logger.ensure_prefix c("[index]\t", :magenta) do
82
- @fs = Filesystem.new(base_dir, dotfiles: @opts[:dotfiles])
84
+ @fs = Filesystem.new(base_dir, dotfiles: @opts[:dotfiles], pattern: @opts[:pattern])
83
85
 
84
86
  notifier do
85
87
  loop do
@@ -16,7 +16,7 @@ module Dle
16
16
  def self.dispatch *a
17
17
  new(*a) do |app|
18
18
  app.parse_params
19
- app.log "core ready"
19
+ app.logger
20
20
  begin
21
21
  app.dispatch
22
22
  rescue Interrupt
@@ -46,6 +46,7 @@ module Dle
46
46
  opts.on("-r", "--skip-review", "Skip review changes before applying") { @opts[:review] = false }
47
47
  opts.on("-s", "--simulate", "Don't apply changes, show commands instead") { @opts[:simulate] = true ; @opts[:review] = false }
48
48
  opts.on("-f", "--file DLFILE", "Use input file (be careful)") {|f| @opts[:input_file] = f }
49
+ opts.on("-o", "--only pattern", c("files", :blue) << c(", ") << c("dirs", :blue) << c(" or regexp (without delimiters)"), " e.g.:" << c(%{ dle ~/Movies -o "(mov|mkv|avi)$"}, :blue)) {|p| @opts[:pattern] = p }
49
50
  opts.on("-m", "--monochrome", "Don't colorize output") { logger.colorize = false }
50
51
  opts.on("-h", "--help", "Shows this help") { @opts[:dispatch] = :help }
51
52
  opts.on("-v", "--version", "Shows version and other info") { @opts[:dispatch] = :info }
@@ -24,6 +24,7 @@ module Dle
24
24
  raise ArgumentError, "#{base_dir} is not a directory" unless FileTest.directory?(base_dir)
25
25
  @base_dir = File.expand_path(base_dir).freeze
26
26
  @opts = { dotfiles: true, verbose: true }.merge(opts)
27
+ @opts[:pattern] = Regexp.new(@opts[:pattern]) unless ["dirs", "files", ""].include?(@opts[:pattern].to_s)
27
28
  @index = {}
28
29
  end
29
30
 
@@ -34,6 +35,10 @@ module Dle
34
35
 
35
36
  def index!
36
37
  Find.find(@base_dir) do |path|
38
+ next if @opts[:pattern] == "files" && !FileTest.file?(path)
39
+ next if @opts[:pattern] == "dirs" && !FileTest.directory?(path)
40
+ next if @opts[:pattern].is_a?(Regexp) && !path.match(@opts[:pattern])
41
+
37
42
  if File.basename(path)[0] == ?. && !@opts[:dotfiles]
38
43
  Find.prune
39
44
  else
data/lib/dle/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Dle
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  UPDATE_URL = "https://raw.githubusercontent.com/2called-chaos/dle/master/VERSION"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sven Pachnit
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-25 00:00:00.000000000 Z
11
+ date: 2014-04-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry