colorls 1.3.4.pre.660 → 1.3.4.pre.670
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 +4 -4
- data/.travis.yml +2 -0
- data/colorls.gemspec +3 -1
- data/lib/colorls/core.rb +12 -7
- data/lib/colorls/fileinfo.rb +9 -0
- data/lib/colorls/git.rb +9 -2
- data/lib/colorls/yaml.rb +1 -1
- 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: f249b8fa5de108d3c989ab6790dd0eeb0f0606a6d48f8837c4a27aad786e2502
|
|
4
|
+
data.tar.gz: d60bc4c540b32113f6f30d48e19d2fc2c5517061ec8767390d5929c68c99bc96
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 44a0a3ba40c74096526b25283a9eb745d074daefaf7f5d3f00a476596f7e62c0cc98f8f41c0e16c04bd72e03609543e76bfdca1d855876e3b83d6be6e4aee1e3
|
|
7
|
+
data.tar.gz: cef18047297eecf989f9dee0f3583d1216759fe2c8bd0bd4ae7b1670c62407537b5361a28655a91e1f324f458eb0a5e3bd9da513477eef41e047319d18d0182b
|
data/.travis.yml
CHANGED
data/colorls.gemspec
CHANGED
|
@@ -47,7 +47,9 @@ Gem::Specification.new do |spec|
|
|
|
47
47
|
|
|
48
48
|
spec.required_ruby_version = '>= 2.4.0'
|
|
49
49
|
|
|
50
|
-
spec.files =
|
|
50
|
+
spec.files = IO.popen(
|
|
51
|
+
%w[git ls-files -z], external_encoding: Encoding::ASCII_8BIT
|
|
52
|
+
).read.split("\x0").reject do |f|
|
|
51
53
|
f.match(%r{^(test|spec|features)/})
|
|
52
54
|
end
|
|
53
55
|
|
data/lib/colorls/core.rb
CHANGED
|
@@ -72,14 +72,14 @@ module ColorLS
|
|
|
72
72
|
CHARS_PER_ITEM = 12
|
|
73
73
|
|
|
74
74
|
def item_widths
|
|
75
|
-
@contents.map { |item| item.
|
|
75
|
+
@contents.map { |item| item.show.size + CHARS_PER_ITEM }
|
|
76
76
|
end
|
|
77
77
|
|
|
78
78
|
def init_contents(path)
|
|
79
79
|
info = FileInfo.new(path, link_info = @long)
|
|
80
80
|
|
|
81
81
|
if info.directory?
|
|
82
|
-
@contents = Dir.entries(path)
|
|
82
|
+
@contents = Dir.entries(path, encoding: Encoding::ASCII_8BIT)
|
|
83
83
|
|
|
84
84
|
filter_hidden_contents
|
|
85
85
|
|
|
@@ -239,7 +239,11 @@ module ColorLS
|
|
|
239
239
|
end
|
|
240
240
|
|
|
241
241
|
def git_file_info(path)
|
|
242
|
-
|
|
242
|
+
unless @git_status[path]
|
|
243
|
+
return ' ✓ '
|
|
244
|
+
.encode(Encoding.default_external, undef: :replace, replace: '=')
|
|
245
|
+
.colorize(@colors[:unchanged])
|
|
246
|
+
end
|
|
243
247
|
|
|
244
248
|
Git.colored_status_symbols(@git_status[path], @colors)
|
|
245
249
|
end
|
|
@@ -283,10 +287,10 @@ module ColorLS
|
|
|
283
287
|
@count[increment] += 1
|
|
284
288
|
value = increment == :folders ? @folders[key] : @files[key]
|
|
285
289
|
logo = value.gsub(/\\u[\da-f]{4}/i) { |m| [m[-4..-1].to_i(16)].pack('U') }
|
|
286
|
-
name = content.
|
|
290
|
+
name = content.show
|
|
287
291
|
name = make_link(path, name) if @hyperlink
|
|
288
292
|
name += content.directory? ? '/' : ' '
|
|
289
|
-
entry = logo + ' ' + name
|
|
293
|
+
entry = logo.encode(Encoding.default_external, undef: :replace, replace: '') + ' ' + name
|
|
290
294
|
|
|
291
295
|
"#{long_info(content)} #{git_info(content)} #{entry.colorize(color)}#{symlink_info(content)}"
|
|
292
296
|
end
|
|
@@ -295,9 +299,10 @@ module ColorLS
|
|
|
295
299
|
padding = 0
|
|
296
300
|
line = +''
|
|
297
301
|
chunk.each_with_index do |content, i|
|
|
302
|
+
entry = fetch_string(@input, content, *options(content))
|
|
298
303
|
line << ' ' * padding
|
|
299
|
-
line << ' ' <<
|
|
300
|
-
padding = widths[i] - content.
|
|
304
|
+
line << ' ' << entry.encode(Encoding.default_external, undef: :replace)
|
|
305
|
+
padding = widths[i] - content.show.length - CHARS_PER_ITEM
|
|
301
306
|
end
|
|
302
307
|
print line << "\n"
|
|
303
308
|
end
|
data/lib/colorls/fileinfo.rb
CHANGED
|
@@ -16,6 +16,8 @@ module ColorLS
|
|
|
16
16
|
@name = File.basename(path)
|
|
17
17
|
@stats = File.lstat(path)
|
|
18
18
|
|
|
19
|
+
@show_name = nil
|
|
20
|
+
|
|
19
21
|
handle_symlink(path) if link_info && @stats.symlink?
|
|
20
22
|
end
|
|
21
23
|
|
|
@@ -23,6 +25,13 @@ module ColorLS
|
|
|
23
25
|
FileInfo.new(path)
|
|
24
26
|
end
|
|
25
27
|
|
|
28
|
+
def show
|
|
29
|
+
return @show_name unless @show_name.nil?
|
|
30
|
+
|
|
31
|
+
@show_name = @name.encode(Encoding.find('filesystem'), Encoding.default_external,
|
|
32
|
+
invalid: :replace, undef: :replace)
|
|
33
|
+
end
|
|
34
|
+
|
|
26
35
|
def dead?
|
|
27
36
|
@dead
|
|
28
37
|
end
|
data/lib/colorls/git.rb
CHANGED
|
@@ -31,7 +31,11 @@ module ColorLS
|
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
def self.colored_status_symbols(modes, colors)
|
|
34
|
-
|
|
34
|
+
if modes.empty?
|
|
35
|
+
return ' ✓ '
|
|
36
|
+
.encode(Encoding.default_external, undef: :replace, replace: '=')
|
|
37
|
+
.colorize(colors[:unchanged])
|
|
38
|
+
end
|
|
35
39
|
|
|
36
40
|
modes = modes.to_a.join.uniq.rjust(3).ljust(4)
|
|
37
41
|
|
|
@@ -51,7 +55,10 @@ module ColorLS
|
|
|
51
55
|
end
|
|
52
56
|
|
|
53
57
|
def git_subdir_status(repo_path)
|
|
54
|
-
yield IO.popen(
|
|
58
|
+
yield IO.popen(
|
|
59
|
+
['git', '-C', repo_path, 'status', '--porcelain', '-z', '-unormal', '--ignored', '.'],
|
|
60
|
+
external_encoding: Encoding::ASCII_8BIT
|
|
61
|
+
)
|
|
55
62
|
end
|
|
56
63
|
end
|
|
57
64
|
end
|
data/lib/colorls/yaml.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: colorls
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.3.4.pre.
|
|
4
|
+
version: 1.3.4.pre.670
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Athitya Kumar
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2020-04-
|
|
11
|
+
date: 2020-04-16 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: clocale
|