colorls 1.4.3.pre.821 → 1.4.4.pre.837
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/colorls.gemspec +3 -2
- data/lib/colorls.rb +1 -0
- data/lib/colorls/core.rb +16 -7
- data/lib/colorls/flags.rb +44 -21
- data/lib/colorls/version.rb +1 -1
- data/man/colorls.1 +17 -5
- data/zsh/_colorls +6 -2
- metadata +20 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b424cb09f3f8d4f46564313c314eac175b346ba97ca2da148dd313f553bc404
|
4
|
+
data.tar.gz: 315afc8e524855f08c9fdc419fd670ecae8c1c48fd768659e18f72193a4ce57b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 503219ef596b7aac7ebb6d0c38127ebe8b5d6bba12d08a64ef963a016aad60074706e41d9cc270384a56fa985b6d1fb44f352c3889631dbbc42d2bf98297be58
|
7
|
+
data.tar.gz: 3d732a88f8f0b6f12fc545fa92b5397d38fe1ea69a09f341f9f4ec9fef15b62a6a2a8e6daafac6c27708ae73ba58d9900342c2ad4af23adca86b11842cd875cc
|
data/colorls.gemspec
CHANGED
@@ -63,6 +63,7 @@ Gem::Specification.new do |spec|
|
|
63
63
|
spec.add_runtime_dependency 'filesize', '~> 0'
|
64
64
|
spec.add_runtime_dependency 'manpages', '~> 0'
|
65
65
|
spec.add_runtime_dependency 'rainbow', '>= 2.2', '< 4.0'
|
66
|
+
spec.add_runtime_dependency 'unicode-display_width', '~> 1.7'
|
66
67
|
|
67
68
|
spec.add_development_dependency 'bundler', '~> 2.0'
|
68
69
|
spec.add_development_dependency 'codecov', '~> 0.1'
|
@@ -72,10 +73,10 @@ Gem::Specification.new do |spec|
|
|
72
73
|
spec.add_development_dependency 'ronn', '~> 0'
|
73
74
|
spec.add_development_dependency 'rspec', '~> 3.7'
|
74
75
|
spec.add_development_dependency 'rspec-its', '~> 1.2'
|
75
|
-
spec.add_development_dependency 'rubocop', '~> 1.
|
76
|
+
spec.add_development_dependency 'rubocop', '~> 1.5.0'
|
76
77
|
spec.add_development_dependency 'rubocop-performance', '~> 1.9.0'
|
77
78
|
spec.add_development_dependency 'rubocop-rspec', '~> 2.0'
|
78
79
|
spec.add_development_dependency 'rubygems-tasks', '~> 0'
|
79
|
-
spec.add_development_dependency 'simplecov', '~> 0.
|
80
|
+
spec.add_development_dependency 'simplecov', '~> 0.20.0'
|
80
81
|
end
|
81
82
|
# rubocop:enable Metrics/BlockLength
|
data/lib/colorls.rb
CHANGED
data/lib/colorls/core.rb
CHANGED
@@ -11,7 +11,7 @@ module ColorLS
|
|
11
11
|
class Core
|
12
12
|
def initialize(input, all: false, report: false, sort: false, show: false,
|
13
13
|
mode: nil, git_status: false, almost_all: false, colors: [], group: nil,
|
14
|
-
reverse: false, hyperlink: false, tree_depth: nil)
|
14
|
+
reverse: false, hyperlink: false, tree_depth: nil, show_group: true, show_user: true)
|
15
15
|
@input = (+input).force_encoding(ColorLS.file_encoding)
|
16
16
|
@count = {folders: 0, recognized_files: 0, unrecognized_files: 0}
|
17
17
|
@all = all
|
@@ -23,7 +23,7 @@ module ColorLS
|
|
23
23
|
@group = group
|
24
24
|
@show = show
|
25
25
|
@one_per_line = mode == :one_per_line
|
26
|
-
|
26
|
+
init_long_format(mode,show_group,show_user)
|
27
27
|
@tree = {mode: mode == :tree, depth: tree_depth}
|
28
28
|
@horizontal = mode == :horizontal
|
29
29
|
process_git_status_details(git_status)
|
@@ -75,11 +75,17 @@ module ColorLS
|
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
78
|
+
def init_long_format(mode,show_group,show_user)
|
79
|
+
@long = mode == :long
|
80
|
+
@show_group = show_group
|
81
|
+
@show_user = show_user
|
82
|
+
end
|
83
|
+
|
78
84
|
# how much characters an item occupies besides its name
|
79
85
|
CHARS_PER_ITEM = 12
|
80
86
|
|
81
87
|
def item_widths
|
82
|
-
@contents.map { |item| item.show
|
88
|
+
@contents.map { |item| Unicode::DisplayWidth.of(item.show) + CHARS_PER_ITEM }
|
83
89
|
end
|
84
90
|
|
85
91
|
def init_contents(path)
|
@@ -210,7 +216,7 @@ module ColorLS
|
|
210
216
|
end
|
211
217
|
|
212
218
|
def size_info(filesize)
|
213
|
-
size = Filesize.
|
219
|
+
size = Filesize.new(filesize).pretty.split
|
214
220
|
size = "#{size[0][0..-4].rjust(4,' ')} #{size[1].ljust(3,' ')}"
|
215
221
|
return size.colorize(@colors[:file_large]) if filesize >= 512 * 1024 ** 2
|
216
222
|
return size.colorize(@colors[:file_medium]) if filesize >= 128 * 1024 ** 2
|
@@ -274,8 +280,11 @@ module ColorLS
|
|
274
280
|
|
275
281
|
links = content.nlink.to_s.rjust(@linklength)
|
276
282
|
|
277
|
-
[mode_info(content.stats), links
|
278
|
-
|
283
|
+
line_array = [mode_info(content.stats), links]
|
284
|
+
line_array.push user_info(content) if @show_user
|
285
|
+
line_array.push group_info(content.group) if @show_group
|
286
|
+
line_array.concat [size_info(content.size), mtime_info(content.mtime)]
|
287
|
+
line_array.join(' ')
|
279
288
|
end
|
280
289
|
|
281
290
|
def symlink_info(content)
|
@@ -314,7 +323,7 @@ module ColorLS
|
|
314
323
|
entry = fetch_string(@input, content, *options(content))
|
315
324
|
line << ' ' * padding
|
316
325
|
line << ' ' << entry.encode(Encoding.default_external, undef: :replace)
|
317
|
-
padding = widths[i] - content.show
|
326
|
+
padding = widths[i] - Unicode::DisplayWidth.of(content.show) - CHARS_PER_ITEM
|
318
327
|
end
|
319
328
|
print line << "\n"
|
320
329
|
end
|
data/lib/colorls/flags.rb
CHANGED
@@ -10,19 +10,7 @@ module ColorLS
|
|
10
10
|
@args = args
|
11
11
|
@light_colors = false
|
12
12
|
|
13
|
-
@opts =
|
14
|
-
show: false,
|
15
|
-
sort: true,
|
16
|
-
reverse: false,
|
17
|
-
group: nil,
|
18
|
-
mode: STDOUT.tty? ? :vertical : :one_per_line, # rubocop:disable Style/GlobalStdStream
|
19
|
-
all: false,
|
20
|
-
almost_all: false,
|
21
|
-
report: false,
|
22
|
-
git_status: false,
|
23
|
-
colors: [],
|
24
|
-
tree_depth: 3
|
25
|
-
}
|
13
|
+
@opts = default_opts
|
26
14
|
|
27
15
|
parse_options
|
28
16
|
|
@@ -81,6 +69,24 @@ module ColorLS
|
|
81
69
|
warn "WARN: #{e}, check your locale settings"
|
82
70
|
end
|
83
71
|
|
72
|
+
def default_opts
|
73
|
+
{
|
74
|
+
show: false,
|
75
|
+
sort: true,
|
76
|
+
reverse: false,
|
77
|
+
group: nil,
|
78
|
+
mode: STDOUT.tty? ? :vertical : :one_per_line, # rubocop:disable Style/GlobalStdStream
|
79
|
+
all: false,
|
80
|
+
almost_all: false,
|
81
|
+
report: false,
|
82
|
+
git_status: false,
|
83
|
+
colors: [],
|
84
|
+
tree_depth: 3,
|
85
|
+
show_group: true,
|
86
|
+
show_user: true
|
87
|
+
}
|
88
|
+
end
|
89
|
+
|
84
90
|
def add_sort_options(options)
|
85
91
|
options.separator ''
|
86
92
|
options.separator 'sorting options:'
|
@@ -126,8 +132,7 @@ module ColorLS
|
|
126
132
|
when 'single-column' then @opts[:mode] = :one_per_line
|
127
133
|
end
|
128
134
|
end
|
129
|
-
options.on('-1', 'list one file per line')
|
130
|
-
options.on('-l', '--long', 'use a long listing format') { @opts[:mode] = :long }
|
135
|
+
options.on('-1', 'list one file per line') { @opts[:mode] = :one_per_line }
|
131
136
|
options.on('--tree=[DEPTH]', Integer, 'shows tree view of the directory') do |depth|
|
132
137
|
@opts[:tree_depth] = depth
|
133
138
|
@opts[:mode] = :tree
|
@@ -136,6 +141,19 @@ module ColorLS
|
|
136
141
|
options.on('-C', 'list entries by columns instead of by lines') { @opts[:mode] = :vertical }
|
137
142
|
end
|
138
143
|
|
144
|
+
def add_long_style_options(options)
|
145
|
+
options.on('-l', '--long', 'use a long listing format') { @opts[:mode] = :long }
|
146
|
+
options.on('-o', 'use a long listing format without group information') do
|
147
|
+
@opts[:mode] = :long
|
148
|
+
@opts[:show_group] = false
|
149
|
+
end
|
150
|
+
options.on('-g', 'use a long listing format without owner information') do
|
151
|
+
@opts[:mode] = :long
|
152
|
+
@opts[:show_user] = false
|
153
|
+
end
|
154
|
+
options.on('-G', '--no-group', 'show no group information in a long listing') { @opts[:show_group] = false }
|
155
|
+
end
|
156
|
+
|
139
157
|
def add_general_options(options)
|
140
158
|
options.separator ''
|
141
159
|
options.separator 'general options:'
|
@@ -196,17 +214,22 @@ module ColorLS
|
|
196
214
|
EXAMPLES
|
197
215
|
end
|
198
216
|
|
217
|
+
def assign_each_options(opts)
|
218
|
+
add_common_options(opts)
|
219
|
+
add_format_options(opts)
|
220
|
+
add_long_style_options(opts)
|
221
|
+
add_sort_options(opts)
|
222
|
+
add_compatiblity_options(opts)
|
223
|
+
add_general_options(opts)
|
224
|
+
add_help_option(opts)
|
225
|
+
end
|
226
|
+
|
199
227
|
def parse_options
|
200
228
|
@parser = OptionParser.new do |opts|
|
201
229
|
opts.banner = 'Usage: colorls [OPTION]... [FILE]...'
|
202
230
|
opts.separator ''
|
203
231
|
|
204
|
-
|
205
|
-
add_format_options(opts)
|
206
|
-
add_sort_options(opts)
|
207
|
-
add_compatiblity_options(opts)
|
208
|
-
add_general_options(opts)
|
209
|
-
add_help_option(opts)
|
232
|
+
assign_each_options(opts)
|
210
233
|
|
211
234
|
opts.on_tail('--version', 'show version') do
|
212
235
|
puts ColorLS::VERSION
|
data/lib/colorls/version.rb
CHANGED
data/man/colorls.1
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "COLORLS" "1" "
|
4
|
+
.TH "COLORLS" "1" "November 2020" "colorls 1.4.2" "colorls Manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBcolorls\fR \- list directory contents with colors and icons
|
@@ -55,10 +55,6 @@ use format: across (\-x), horizontal (\-x), long (\-l), single\-column (\-1), ve
|
|
55
55
|
list one file per line
|
56
56
|
.
|
57
57
|
.TP
|
58
|
-
\fB\-l\fR, \fB\-\-long\fR
|
59
|
-
use a long listing format
|
60
|
-
.
|
61
|
-
.TP
|
62
58
|
\fB\-\-tree\fR
|
63
59
|
shows tree view of the directory
|
64
60
|
.
|
@@ -71,6 +67,22 @@ list entries by lines instead of by columns
|
|
71
67
|
list entries by columns instead of by lines
|
72
68
|
.
|
73
69
|
.TP
|
70
|
+
\fB\-l\fR, \fB\-\-long\fR
|
71
|
+
use a long listing format
|
72
|
+
.
|
73
|
+
.TP
|
74
|
+
\fB\-o\fR
|
75
|
+
use a long listing format without group information
|
76
|
+
.
|
77
|
+
.TP
|
78
|
+
\fB\-g\fR
|
79
|
+
use a long listing format without owner information
|
80
|
+
.
|
81
|
+
.TP
|
82
|
+
\fB\-G\fR, \fB\-\-no\-group\fR
|
83
|
+
show no group information in a long listing
|
84
|
+
.
|
85
|
+
.TP
|
74
86
|
\fB\-\-sd\fR, \fB\-\-sort\-dirs\fR, \fB\-\-group\-directories\-first\fR
|
75
87
|
sort directories first
|
76
88
|
.
|
data/zsh/_colorls
CHANGED
@@ -17,11 +17,15 @@ _arguments -s -S \
|
|
17
17
|
"--report[show brief report]" \
|
18
18
|
"--format[use format: across (-x), horizontal (-x), long (-l), single-column (-1), vertical (-C)]" \
|
19
19
|
"-1[list one file per line]" \
|
20
|
-
"-l[use a long listing format]" \
|
21
|
-
"--long[use a long listing format]" \
|
22
20
|
"--tree[shows tree view of the directory]" \
|
23
21
|
"-x[list entries by lines instead of by columns]" \
|
24
22
|
"-C[list entries by columns instead of by lines]" \
|
23
|
+
"-l[use a long listing format]" \
|
24
|
+
"--long[use a long listing format]" \
|
25
|
+
"-o[use a long listing format without group information]" \
|
26
|
+
"-g[use a long listing format without owner information]" \
|
27
|
+
"-G[show no group information in a long listing]" \
|
28
|
+
"--no-group[show no group information in a long listing]" \
|
25
29
|
"--sd[sort directories first]" \
|
26
30
|
"--sort-dirs[sort directories first]" \
|
27
31
|
"--group-directories-first[sort directories first]" \
|
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.4.
|
4
|
+
version: 1.4.4.pre.837
|
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-
|
11
|
+
date: 2020-12-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: clocale
|
@@ -72,6 +72,20 @@ dependencies:
|
|
72
72
|
- - "<"
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: '4.0'
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: unicode-display_width
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - "~>"
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '1.7'
|
82
|
+
type: :runtime
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - "~>"
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '1.7'
|
75
89
|
- !ruby/object:Gem::Dependency
|
76
90
|
name: bundler
|
77
91
|
requirement: !ruby/object:Gem::Requirement
|
@@ -190,14 +204,14 @@ dependencies:
|
|
190
204
|
requirements:
|
191
205
|
- - "~>"
|
192
206
|
- !ruby/object:Gem::Version
|
193
|
-
version: 1.
|
207
|
+
version: 1.5.0
|
194
208
|
type: :development
|
195
209
|
prerelease: false
|
196
210
|
version_requirements: !ruby/object:Gem::Requirement
|
197
211
|
requirements:
|
198
212
|
- - "~>"
|
199
213
|
- !ruby/object:Gem::Version
|
200
|
-
version: 1.
|
214
|
+
version: 1.5.0
|
201
215
|
- !ruby/object:Gem::Dependency
|
202
216
|
name: rubocop-performance
|
203
217
|
requirement: !ruby/object:Gem::Requirement
|
@@ -246,14 +260,14 @@ dependencies:
|
|
246
260
|
requirements:
|
247
261
|
- - "~>"
|
248
262
|
- !ruby/object:Gem::Version
|
249
|
-
version: 0.
|
263
|
+
version: 0.20.0
|
250
264
|
type: :development
|
251
265
|
prerelease: false
|
252
266
|
version_requirements: !ruby/object:Gem::Requirement
|
253
267
|
requirements:
|
254
268
|
- - "~>"
|
255
269
|
- !ruby/object:Gem::Version
|
256
|
-
version: 0.
|
270
|
+
version: 0.20.0
|
257
271
|
description:
|
258
272
|
email:
|
259
273
|
- athityakumar@gmail.com
|