colorls 1.4.4 → 1.4.5.pre.93
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/.rubocop.yml +2 -2
- data/CONTRIBUTORS.md +2 -0
- data/README.md +4 -4
- data/Rakefile +7 -5
- data/colorls.gemspec +10 -10
- data/lib/colorls/core.rb +61 -29
- data/lib/colorls/fileinfo.rb +3 -1
- data/lib/colorls/flags.rb +43 -12
- data/lib/colorls/git.rb +6 -2
- data/lib/colorls/monkeys.rb +1 -1
- data/lib/colorls.rb +1 -0
- data/lib/yaml/dark_colors.yaml +1 -0
- data/lib/yaml/file_aliases.yaml +4 -0
- data/lib/yaml/light_colors.yaml +1 -0
- data/man/colorls.1 +22 -2
- data/zsh/_colorls +7 -1
- metadata +12 -13
- data/.travis.yml +0 -123
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f4ebed77f92de70e551998e8a703501c5ed067be1b4bc758a6ce46f9f6ec9437
|
4
|
+
data.tar.gz: 924b863b8cfd4fa37ffafaf58aa2b27c89ac4da9d054026058855f43cf2170e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3bcad1811124c707bac63fd81ba07f8a9156f8ebd6eb568238b0c7725abf5f901aa401b06025eac02eb105eb64f86c314c5024f1356eda70b1e117d8984c4a4c
|
7
|
+
data.tar.gz: eb44b4b7903fd562556f7ae30ff395ceb11d0d3ff9aa28f09a5be54fa397a73ab7399893d4c93b2bcc4daa659a11939e30c00889d6036807cba0c6ba88357a15
|
data/.rubocop.yml
CHANGED
@@ -10,7 +10,7 @@ AllCops:
|
|
10
10
|
- 'profile/*'
|
11
11
|
DisplayCopNames: true
|
12
12
|
NewCops: enable
|
13
|
-
TargetRubyVersion: 2.
|
13
|
+
TargetRubyVersion: 2.6
|
14
14
|
|
15
15
|
# Preferred codebase style ---------------------------------------------
|
16
16
|
|
@@ -58,7 +58,7 @@ Metrics/ClassLength:
|
|
58
58
|
Max: 350
|
59
59
|
|
60
60
|
Metrics/ParameterLists:
|
61
|
-
Max:
|
61
|
+
Max: 16
|
62
62
|
|
63
63
|
Naming/FileName:
|
64
64
|
Enabled: false
|
data/CONTRIBUTORS.md
CHANGED
data/README.md
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
[](http://forthebadge.com)
|
5
5
|
|
6
6
|
[](https://badge.fury.io/rb/colorls)
|
7
|
-
[](https://github.com/athityakumar/colorls/actions/workflows/ruby.yml)
|
8
8
|
[](http://makeapullrequest.com)
|
9
9
|
|
10
10
|
A Ruby script that colorizes the `ls` output with color and icons. Here are the screenshots of working example on an iTerm2 terminal (Mac OS), `oh-my-zsh` with `powerlevel9k` theme and `powerline nerd-font + awesome-config` font with the `Solarized Dark` color theme.
|
@@ -117,8 +117,8 @@ Man pages have been added. Checkout `man colorls`.
|
|
117
117
|
|
118
118
|
[(Back to top)](#table-of-contents)
|
119
119
|
|
120
|
-
1. Install Ruby (preferably, version >= 2.
|
121
|
-
2.
|
120
|
+
1. Install Ruby (preferably, version >= 2.6)
|
121
|
+
2. [Download](https://www.nerdfonts.com/font-downloads) and install a Nerd Font. Have a look at the [Nerd Font README](https://github.com/ryanoasis/nerd-fonts/blob/master/readme.md) for installation instructions.
|
122
122
|
|
123
123
|
*Note for `iTerm2` users - Please enable the Nerd Font at iTerm2 > Preferences > Profiles > Text > Non-ASCII font > Hack Regular Nerd Font Complete.*
|
124
124
|
|
@@ -170,7 +170,7 @@ You can overwrite the existing icons and colors mapping by copying the yaml file
|
|
170
170
|
Let's say that you're using the dark color scheme and would like to change the color of untracked file (`??`) in the `--git-status` flag to yellow. Copy the defaut `dark_colors.yaml` and change it.
|
171
171
|
|
172
172
|
```sh
|
173
|
-
cp $(dirname $(gem which colorls))/yaml/dark_colors.yaml ~/.config/colorls/dark_colors.yaml
|
173
|
+
cp $(dirname $(gem which colorls))/yaml/dark_colors.yaml ~/.config/colorls/dark_colors.yaml
|
174
174
|
```
|
175
175
|
|
176
176
|
In the `~/.config/colorls/dark_colors.yaml` file, change the color set for `untracked` from `darkorange` to `yellow`, and save the change.
|
data/Rakefile
CHANGED
@@ -20,12 +20,12 @@ file 'man/colorls.1' => ['man/colorls.1.ronn', 'lib/colorls/flags.rb'] do
|
|
20
20
|
|
21
21
|
flags = ColorLS::Flags.new
|
22
22
|
attributes = {
|
23
|
-
date: Date.iso8601(`git log -1 --pretty=format:%cI --
|
23
|
+
date: Date.iso8601(`git log -1 --pretty=format:%cI -- lib/colorls/flags.rb`),
|
24
24
|
manual: 'colorls Manual',
|
25
25
|
organization: "colorls #{ColorLS::VERSION}"
|
26
26
|
}
|
27
27
|
doc = Ronn::Document.new(nil, attributes) do
|
28
|
-
template =
|
28
|
+
template = File.read('man/colorls.1.ronn')
|
29
29
|
|
30
30
|
section = ''
|
31
31
|
flags.options.each do |o|
|
@@ -37,12 +37,14 @@ OPTION
|
|
37
37
|
end
|
38
38
|
template.sub('{{ OPTIONS }}', section)
|
39
39
|
end
|
40
|
-
|
40
|
+
File.write('man/colorls.1', doc.convert('roff'))
|
41
41
|
end
|
42
42
|
|
43
|
+
directory 'zsh'
|
44
|
+
|
43
45
|
desc 'Build the Zsh completion file'
|
44
|
-
file 'zsh/_colorls' => [
|
46
|
+
file 'zsh/_colorls' => %w[zsh lib/colorls/flags.rb] do
|
45
47
|
ruby "exe/colorls '--*-completion-zsh=colorls' > zsh/_colorls"
|
46
48
|
end
|
47
49
|
|
48
|
-
task default: %w[spec rubocop]
|
50
|
+
task default: %w[spec rubocop man/colorls.1 zsh/_colorls]
|
data/colorls.gemspec
CHANGED
@@ -27,13 +27,13 @@ POST_INSTALL_MESSAGE = %(
|
|
27
27
|
|
28
28
|
# rubocop:disable Metrics/BlockLength
|
29
29
|
Gem::Specification.new do |spec|
|
30
|
-
is_tagged = ENV['
|
31
|
-
is_origin = ENV['
|
32
|
-
build_number = ENV['
|
30
|
+
is_tagged = ENV['GITHUB_REF'] == "refs/tags/v#{ColorLS::VERSION}"
|
31
|
+
is_origin = ENV['GITHUB_REPOSITORY_OWNER'] == 'athityakumar'
|
32
|
+
build_number = ENV['GITHUB_RUN_NUMBER']
|
33
33
|
|
34
34
|
spec.name = 'colorls'
|
35
35
|
spec.version = if build_number && is_origin && !is_tagged
|
36
|
-
# Prereleasing on
|
36
|
+
# Prereleasing on Github
|
37
37
|
digits = ColorLS::VERSION.to_s.split '.'
|
38
38
|
digits[-1] = digits[-1].to_s.succ
|
39
39
|
|
@@ -47,12 +47,12 @@ Gem::Specification.new do |spec|
|
|
47
47
|
spec.homepage = 'https://github.com/athityakumar/colorls'
|
48
48
|
spec.license = 'MIT'
|
49
49
|
|
50
|
-
spec.required_ruby_version = '>= 2.
|
50
|
+
spec.required_ruby_version = '>= 2.6.0'
|
51
51
|
|
52
|
-
spec.files = IO.popen(
|
52
|
+
spec.files = %w[man/colorls.1 man/colorls.1 zsh/_colorls] + IO.popen(
|
53
53
|
%w[git ls-files -z], external_encoding: Encoding::ASCII_8BIT
|
54
54
|
).read.split("\x0").reject do |f|
|
55
|
-
f.match(%r{^(test|spec|features)/})
|
55
|
+
f.match(%r{^(test|spec|features|[.]github)/})
|
56
56
|
end
|
57
57
|
|
58
58
|
spec.bindir = 'exe'
|
@@ -76,10 +76,10 @@ Gem::Specification.new do |spec|
|
|
76
76
|
spec.add_development_dependency 'ronn', '~> 0'
|
77
77
|
spec.add_development_dependency 'rspec', '~> 3.7'
|
78
78
|
spec.add_development_dependency 'rspec-its', '~> 1.2'
|
79
|
-
spec.add_development_dependency 'rubocop', '~> 1.
|
80
|
-
spec.add_development_dependency 'rubocop-performance', '~> 1.
|
79
|
+
spec.add_development_dependency 'rubocop', '~> 1.22.0'
|
80
|
+
spec.add_development_dependency 'rubocop-performance', '~> 1.13.0'
|
81
81
|
spec.add_development_dependency 'rubocop-rake', '~> 0.5'
|
82
|
-
spec.add_development_dependency 'rubocop-rspec', '~> 2.0'
|
82
|
+
spec.add_development_dependency 'rubocop-rspec', '~> 2.9.0'
|
83
83
|
spec.add_development_dependency 'rubygems-tasks', '~> 0'
|
84
84
|
spec.add_development_dependency 'simplecov', '~> 0.21.2'
|
85
85
|
end
|
data/lib/colorls/core.rb
CHANGED
@@ -8,8 +8,17 @@ module ColorLS
|
|
8
8
|
@file_encoding
|
9
9
|
end
|
10
10
|
|
11
|
-
|
12
|
-
|
11
|
+
def self.terminal_width
|
12
|
+
console = IO.console
|
13
|
+
|
14
|
+
width = IO.console_size[1]
|
15
|
+
|
16
|
+
return width if console.nil? || console.winsize[1].zero?
|
17
|
+
|
18
|
+
console.winsize[1]
|
19
|
+
end
|
20
|
+
|
21
|
+
@screen_width = terminal_width
|
13
22
|
|
14
23
|
def self.screen_width
|
15
24
|
@screen_width
|
@@ -17,8 +26,9 @@ module ColorLS
|
|
17
26
|
|
18
27
|
class Core
|
19
28
|
def initialize(all: false, sort: false, show: false,
|
20
|
-
mode: nil,
|
21
|
-
reverse: false, hyperlink: false, tree_depth: nil,
|
29
|
+
mode: nil, show_git: false, almost_all: false, colors: [], group: nil,
|
30
|
+
reverse: false, hyperlink: false, tree_depth: nil, show_inode: false,
|
31
|
+
indicator_style: 'slash', long_style_options: {})
|
22
32
|
@count = {folders: 0, recognized_files: 0, unrecognized_files: 0}
|
23
33
|
@all = all
|
24
34
|
@almost_all = almost_all
|
@@ -28,10 +38,16 @@ module ColorLS
|
|
28
38
|
@group = group
|
29
39
|
@show = show
|
30
40
|
@one_per_line = mode == :one_per_line
|
31
|
-
|
41
|
+
@show_inode = show_inode
|
42
|
+
init_long_format(mode,long_style_options)
|
32
43
|
@tree = {mode: mode == :tree, depth: tree_depth}
|
33
44
|
@horizontal = mode == :horizontal
|
34
|
-
@git_status = init_git_status(
|
45
|
+
@git_status = init_git_status(show_git)
|
46
|
+
@time_style = long_style_options.key?(:time_style) ? long_style_options[:time_style] : ''
|
47
|
+
@indicator_style = indicator_style
|
48
|
+
@hard_links_count = long_style_options.key?(:hard_links_count) ? long_style_options[:hard_links_count] : true
|
49
|
+
# how much characters an item occupies besides its name
|
50
|
+
@additional_chars_per_item = 12 + (@show_git ? 4 : 0) + (@show_inode ? 10 : 0)
|
35
51
|
|
36
52
|
init_colors colors
|
37
53
|
|
@@ -65,13 +81,24 @@ module ColorLS
|
|
65
81
|
ls
|
66
82
|
end
|
67
83
|
|
68
|
-
def display_report
|
69
|
-
|
84
|
+
def display_report(report_mode)
|
85
|
+
if report_mode == :short
|
86
|
+
puts <<~REPORT
|
87
|
+
|
88
|
+
\s\s\s\sFolders: #{@count[:folders]}, Files: #{@count[:recognized_files] + @count[:unrecognized_files]}.
|
89
|
+
REPORT
|
90
|
+
.colorize(@colors[:report])
|
91
|
+
else
|
92
|
+
puts <<~REPORT
|
70
93
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
94
|
+
Found #{@count.values.sum} items in total.
|
95
|
+
|
96
|
+
\tFolders\t\t\t: #{@count[:folders]}
|
97
|
+
\tRecognized files\t: #{@count[:recognized_files]}
|
98
|
+
\tUnrecognized files\t: #{@count[:unrecognized_files]}
|
99
|
+
REPORT
|
100
|
+
.colorize(@colors[:report])
|
101
|
+
end
|
75
102
|
end
|
76
103
|
|
77
104
|
private
|
@@ -106,13 +133,14 @@ module ColorLS
|
|
106
133
|
end
|
107
134
|
end
|
108
135
|
|
109
|
-
def init_long_format(mode,
|
136
|
+
def init_long_format(mode, long_style_options)
|
110
137
|
@long = mode == :long
|
111
|
-
@show_group = show_group
|
112
|
-
@show_user = show_user
|
138
|
+
@show_group = long_style_options.key?(:show_group) ? long_style_options[:show_group] : true
|
139
|
+
@show_user = long_style_options.key?(:show_user) ? long_style_options[:show_user] : true
|
113
140
|
end
|
114
141
|
|
115
142
|
def init_git_status(show_git)
|
143
|
+
@show_git = show_git
|
116
144
|
return {}.freeze unless show_git
|
117
145
|
|
118
146
|
# stores git status information per directory
|
@@ -126,11 +154,8 @@ module ColorLS
|
|
126
154
|
end
|
127
155
|
end
|
128
156
|
|
129
|
-
# how much characters an item occupies besides its name
|
130
|
-
CHARS_PER_ITEM = 12
|
131
|
-
|
132
157
|
def item_widths
|
133
|
-
@contents.map { |item| Unicode::DisplayWidth.of(item.show) +
|
158
|
+
@contents.map { |item| Unicode::DisplayWidth.of(item.show) + @additional_chars_per_item }
|
134
159
|
end
|
135
160
|
|
136
161
|
def filter_hidden_contents
|
@@ -228,14 +253,14 @@ module ColorLS
|
|
228
253
|
def size_info(filesize)
|
229
254
|
size = Filesize.new(filesize).pretty.split
|
230
255
|
size = "#{size[0][0..-4].rjust(4,' ')} #{size[1].ljust(3,' ')}"
|
231
|
-
return size.colorize(@colors[:file_large]) if filesize >= 512 * 1024 ** 2
|
232
|
-
return size.colorize(@colors[:file_medium]) if filesize >= 128 * 1024 ** 2
|
256
|
+
return size.colorize(@colors[:file_large]) if filesize >= 512 * (1024 ** 2)
|
257
|
+
return size.colorize(@colors[:file_medium]) if filesize >= 128 * (1024 ** 2)
|
233
258
|
|
234
259
|
size.colorize(@colors[:file_small])
|
235
260
|
end
|
236
261
|
|
237
262
|
def mtime_info(file_mtime)
|
238
|
-
mtime = file_mtime.asctime
|
263
|
+
mtime = @time_style.start_with?('+') ? file_mtime.strftime(@time_style.delete_prefix('+')) : file_mtime.asctime
|
239
264
|
now = Time.now
|
240
265
|
return mtime.colorize(@colors[:hour_old]) if now - file_mtime < 60 * 60
|
241
266
|
return mtime.colorize(@colors[:day_old]) if now - file_mtime < 24 * 60 * 60
|
@@ -275,12 +300,19 @@ module ColorLS
|
|
275
300
|
end
|
276
301
|
end
|
277
302
|
|
303
|
+
def inode(content)
|
304
|
+
return '' unless @show_inode
|
305
|
+
|
306
|
+
content.stats.ino.to_s.rjust(10).colorize(@colors[:inode])
|
307
|
+
end
|
308
|
+
|
278
309
|
def long_info(content)
|
279
310
|
return '' unless @long
|
280
311
|
|
281
312
|
links = content.nlink.to_s.rjust(@linklength)
|
282
313
|
|
283
|
-
line_array = [mode_info(content.stats)
|
314
|
+
line_array = [mode_info(content.stats)]
|
315
|
+
line_array.push links if @hard_links_count
|
284
316
|
line_array.push user_info(content) if @show_user
|
285
317
|
line_array.push group_info(content.group) if @show_group
|
286
318
|
line_array.concat [size_info(content.size), mtime_info(content.mtime)]
|
@@ -306,14 +338,14 @@ module ColorLS
|
|
306
338
|
def fetch_string(content, key, color, increment)
|
307
339
|
@count[increment] += 1
|
308
340
|
value = increment == :folders ? @folders[key] : @files[key]
|
309
|
-
logo = value.gsub(/\\u[\da-f]{4}/i) { |m| [m[-4
|
341
|
+
logo = value.gsub(/\\u[\da-f]{4}/i) { |m| [m[-4..].to_i(16)].pack('U') }
|
310
342
|
name = content.show
|
311
343
|
name = make_link(content) if @hyperlink
|
312
|
-
name += content.directory? ? '/' : ' '
|
344
|
+
name += content.directory? && @indicator_style != 'none' ? '/' : ' '
|
313
345
|
entry = "#{out_encode(logo)} #{out_encode(name)}"
|
314
346
|
entry = entry.bright if !content.directory? && content.executable?
|
315
347
|
|
316
|
-
"#{long_info(content)} #{git_info(content)} #{entry.colorize(color)}#{symlink_info(content)}"
|
348
|
+
"#{inode(content)} #{long_info(content)} #{git_info(content)} #{entry.colorize(color)}#{symlink_info(content)}"
|
317
349
|
end
|
318
350
|
|
319
351
|
def ls_line(chunk, widths)
|
@@ -321,9 +353,9 @@ module ColorLS
|
|
321
353
|
line = +''
|
322
354
|
chunk.each_with_index do |content, i|
|
323
355
|
entry = fetch_string(content, *options(content))
|
324
|
-
line << ' ' * padding
|
356
|
+
line << (' ' * padding)
|
325
357
|
line << ' ' << entry.encode(Encoding.default_external, undef: :replace)
|
326
|
-
padding = widths[i] - Unicode::DisplayWidth.of(content.show) -
|
358
|
+
padding = widths[i] - Unicode::DisplayWidth.of(content.show) - @additional_chars_per_item
|
327
359
|
end
|
328
360
|
print line << "\n"
|
329
361
|
end
|
@@ -391,7 +423,7 @@ module ColorLS
|
|
391
423
|
def tree_branch_preprint(prespace, indent, prespace_icon)
|
392
424
|
return prespace_icon if prespace.zero?
|
393
425
|
|
394
|
-
' │ ' * (prespace/indent) + prespace_icon + '─' * indent
|
426
|
+
(' │ ' * (prespace/indent)) + prespace_icon + ('─' * indent)
|
395
427
|
end
|
396
428
|
|
397
429
|
def make_link(content)
|
data/lib/colorls/fileinfo.rb
CHANGED
@@ -14,10 +14,12 @@ module ColorLS
|
|
14
14
|
def initialize(name:, parent:, path: nil, link_info: true)
|
15
15
|
@name = name
|
16
16
|
@parent = parent
|
17
|
-
@path = path.nil? ? File.join(parent, name) : path
|
17
|
+
@path = path.nil? ? File.join(parent, name) : +path
|
18
18
|
@stats = File.lstat(@path)
|
19
19
|
@show_name = nil
|
20
20
|
|
21
|
+
@path.force_encoding(ColorLS.file_encoding)
|
22
|
+
|
21
23
|
handle_symlink(@path) if link_info && @stats.symlink?
|
22
24
|
end
|
23
25
|
|
data/lib/colorls/flags.rb
CHANGED
@@ -11,7 +11,7 @@ module ColorLS
|
|
11
11
|
@light_colors = false
|
12
12
|
|
13
13
|
@opts = default_opts
|
14
|
-
@
|
14
|
+
@report_mode = false
|
15
15
|
@exit_status_code = 0
|
16
16
|
|
17
17
|
parse_options
|
@@ -35,7 +35,7 @@ module ColorLS
|
|
35
35
|
list = @parser.top.list + @parser.base.list
|
36
36
|
|
37
37
|
result = list.collect do |o|
|
38
|
-
next unless o.respond_to?
|
38
|
+
next unless o.respond_to? :desc
|
39
39
|
|
40
40
|
flags = o.short + o.long
|
41
41
|
next if flags.empty?
|
@@ -88,7 +88,7 @@ module ColorLS
|
|
88
88
|
$stderr.puts "#{dir}: #{e}".colorize(:red)
|
89
89
|
end
|
90
90
|
|
91
|
-
core.display_report if @
|
91
|
+
core.display_report(@report_mode) if @report_mode
|
92
92
|
|
93
93
|
@exit_status_code
|
94
94
|
end
|
@@ -102,11 +102,12 @@ module ColorLS
|
|
102
102
|
mode: STDOUT.tty? ? :vertical : :one_per_line, # rubocop:disable Style/GlobalStdStream
|
103
103
|
all: false,
|
104
104
|
almost_all: false,
|
105
|
-
|
105
|
+
show_git: false,
|
106
106
|
colors: [],
|
107
107
|
tree_depth: 3,
|
108
|
-
|
109
|
-
|
108
|
+
show_inode: false,
|
109
|
+
indicator_style: 'slash',
|
110
|
+
long_style_options: {}
|
110
111
|
}
|
111
112
|
end
|
112
113
|
|
@@ -139,8 +140,19 @@ module ColorLS
|
|
139
140
|
options.on('-A', '--almost-all', 'do not list . and ..') { @opts[:almost_all] = true }
|
140
141
|
options.on('-d', '--dirs', 'show only directories') { @opts[:show] = :dirs }
|
141
142
|
options.on('-f', '--files', 'show only files') { @opts[:show] = :files }
|
142
|
-
options.on('--gs', '--git-status', 'show git status for each file') { @opts[:
|
143
|
-
options.on('
|
143
|
+
options.on('--gs', '--git-status', 'show git status for each file') { @opts[:show_git] = true }
|
144
|
+
options.on('-p', 'append / indicator to directories') { @opts[:indicator_style] = 'slash' }
|
145
|
+
options.on('-i', '--inode', 'show inode number') { @opts[:show_inode] = true }
|
146
|
+
options.on('--report=[WORD]', %w[short long], 'show report: short, long (default if omitted)') do |word|
|
147
|
+
word ||= :long
|
148
|
+
@report_mode = word.to_sym
|
149
|
+
end
|
150
|
+
options.on(
|
151
|
+
'--indicator-style=[STYLE]',
|
152
|
+
%w[none slash], 'append indicator with style STYLE to entry names: none, slash (-p) (default)'
|
153
|
+
) do |style|
|
154
|
+
@opts[:indicator_style] = style
|
155
|
+
end
|
144
156
|
end
|
145
157
|
|
146
158
|
def add_format_options(options)
|
@@ -164,17 +176,36 @@ module ColorLS
|
|
164
176
|
options.on('-C', 'list entries by columns instead of by lines') { @opts[:mode] = :vertical }
|
165
177
|
end
|
166
178
|
|
179
|
+
def default_long_style_options
|
180
|
+
{
|
181
|
+
show_group: true,
|
182
|
+
show_user: true,
|
183
|
+
time_style: '',
|
184
|
+
hard_links_count: true
|
185
|
+
}
|
186
|
+
end
|
187
|
+
|
167
188
|
def add_long_style_options(options)
|
168
|
-
|
189
|
+
long_style_options = default_long_style_options
|
190
|
+
options.on('-l', '--long', 'use a long listing format') { @opts[:mode] = :long }
|
169
191
|
options.on('-o', 'use a long listing format without group information') do
|
170
192
|
@opts[:mode] = :long
|
171
|
-
|
193
|
+
long_style_options[:show_group] = false
|
172
194
|
end
|
173
195
|
options.on('-g', 'use a long listing format without owner information') do
|
174
196
|
@opts[:mode] = :long
|
175
|
-
|
197
|
+
long_style_options[:show_user] = false
|
198
|
+
end
|
199
|
+
options.on('-G', '--no-group', 'show no group information in a long listing') do
|
200
|
+
long_style_options[:show_group] = false
|
201
|
+
end
|
202
|
+
options.on('--time-style=FORMAT', String, 'use time display format') do |time_style|
|
203
|
+
long_style_options[:time_style] = time_style
|
204
|
+
end
|
205
|
+
options.on('--no-hardlinks', 'show no hard links count in a long listing') do
|
206
|
+
long_style_options[:hard_links_count] = false
|
176
207
|
end
|
177
|
-
|
208
|
+
@opts[:long_style_options] = long_style_options
|
178
209
|
end
|
179
210
|
|
180
211
|
def add_general_options(options)
|
data/lib/colorls/git.rb
CHANGED
@@ -5,6 +5,9 @@ require 'set'
|
|
5
5
|
|
6
6
|
module ColorLS
|
7
7
|
module Git
|
8
|
+
EMPTY_SET = Set.new.freeze
|
9
|
+
private_constant :EMPTY_SET
|
10
|
+
|
8
11
|
def self.status(repo_path)
|
9
12
|
prefix, success = git_prefix(repo_path)
|
10
13
|
|
@@ -13,10 +16,11 @@ module ColorLS
|
|
13
16
|
prefix_path = Pathname.new(prefix)
|
14
17
|
|
15
18
|
git_status = Hash.new { |hash, key| hash[key] = Set.new }
|
19
|
+
git_status_default = EMPTY_SET
|
16
20
|
|
17
21
|
git_subdir_status(repo_path) do |mode, file|
|
18
22
|
if file == prefix
|
19
|
-
|
23
|
+
git_status_default = Set[mode].freeze
|
20
24
|
else
|
21
25
|
path = Pathname.new(file).relative_path_from(prefix_path)
|
22
26
|
git_status[path.descend.first.cleanpath.to_s].add(mode)
|
@@ -25,7 +29,7 @@ module ColorLS
|
|
25
29
|
|
26
30
|
warn "git status failed in #{repo_path}" unless $CHILD_STATUS.success?
|
27
31
|
|
28
|
-
git_status.default =
|
32
|
+
git_status.default = git_status_default
|
29
33
|
git_status.freeze
|
30
34
|
end
|
31
35
|
|
data/lib/colorls/monkeys.rb
CHANGED
data/lib/colorls.rb
CHANGED
data/lib/yaml/dark_colors.yaml
CHANGED
data/lib/yaml/file_aliases.yaml
CHANGED
@@ -11,6 +11,7 @@ editorconfig: conf
|
|
11
11
|
scss: css
|
12
12
|
docx: doc
|
13
13
|
gdoc: doc
|
14
|
+
odt: doc
|
14
15
|
dockerfile: docker
|
15
16
|
mobi: ebook
|
16
17
|
eot: font
|
@@ -27,6 +28,7 @@ gif: image
|
|
27
28
|
ico: image
|
28
29
|
jpeg: image
|
29
30
|
jpg: image
|
31
|
+
odg: image
|
30
32
|
png: image
|
31
33
|
pxm: image
|
32
34
|
svg: image
|
@@ -41,6 +43,7 @@ mkd: md
|
|
41
43
|
rdoc: md
|
42
44
|
readme: md
|
43
45
|
gslides: ppt
|
46
|
+
odp: ppt
|
44
47
|
pptx: ppt
|
45
48
|
ipynb: py
|
46
49
|
pyc: py
|
@@ -81,6 +84,7 @@ exe: windows
|
|
81
84
|
ini: windows
|
82
85
|
csv: xls
|
83
86
|
gsheet: xls
|
87
|
+
ods: xls
|
84
88
|
xlsx: xls
|
85
89
|
xul: xml
|
86
90
|
yaml: yml
|
data/lib/yaml/light_colors.yaml
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" "March 2022" "colorls 1.4.4" "colorls Manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBcolorls\fR \- list directory contents with colors and icons
|
@@ -43,8 +43,20 @@ show only files
|
|
43
43
|
show git status for each file
|
44
44
|
.
|
45
45
|
.TP
|
46
|
+
\fB\-p\fR
|
47
|
+
append / indicator to directories
|
48
|
+
.
|
49
|
+
.TP
|
50
|
+
\fB\-i\fR, \fB\-\-inode\fR
|
51
|
+
show inode number
|
52
|
+
.
|
53
|
+
.TP
|
46
54
|
\fB\-\-report\fR
|
47
|
-
show
|
55
|
+
show report: short, long (default if omitted)
|
56
|
+
.
|
57
|
+
.TP
|
58
|
+
\fB\-\-indicator\-style\fR
|
59
|
+
append indicator with style STYLE to entry names: none, slash (\-p) (default)
|
48
60
|
.
|
49
61
|
.TP
|
50
62
|
\fB\-\-format\fR
|
@@ -83,6 +95,14 @@ use a long listing format without owner information
|
|
83
95
|
show no group information in a long listing
|
84
96
|
.
|
85
97
|
.TP
|
98
|
+
\fB\-\-time\-style\fR
|
99
|
+
use time display format
|
100
|
+
.
|
101
|
+
.TP
|
102
|
+
\fB\-\-no\-hardlinks\fR
|
103
|
+
show no hard links count in a long listing
|
104
|
+
.
|
105
|
+
.TP
|
86
106
|
\fB\-\-sd\fR, \fB\-\-sort\-dirs\fR, \fB\-\-group\-directories\-first\fR
|
87
107
|
sort directories first
|
88
108
|
.
|
data/zsh/_colorls
CHANGED
@@ -14,7 +14,11 @@ _arguments -s -S \
|
|
14
14
|
"--files[show only files]" \
|
15
15
|
"--gs[show git status for each file]" \
|
16
16
|
"--git-status[show git status for each file]" \
|
17
|
-
"
|
17
|
+
"-p[append / indicator to directories]" \
|
18
|
+
"-i[show inode number]" \
|
19
|
+
"--inode[show inode number]" \
|
20
|
+
"--report[show report: short, long (default if omitted)]" \
|
21
|
+
"--indicator-style[append indicator with style STYLE to entry names: none, slash (-p) (default)]" \
|
18
22
|
"--format[use format: across (-x), horizontal (-x), long (-l), single-column (-1), vertical (-C)]" \
|
19
23
|
"-1[list one file per line]" \
|
20
24
|
"--tree[shows tree view of the directory]" \
|
@@ -26,6 +30,8 @@ _arguments -s -S \
|
|
26
30
|
"-g[use a long listing format without owner information]" \
|
27
31
|
"-G[show no group information in a long listing]" \
|
28
32
|
"--no-group[show no group information in a long listing]" \
|
33
|
+
"--time-style[use time display format]" \
|
34
|
+
"--no-hardlinks[show no hard links count in a long listing]" \
|
29
35
|
"--sd[sort directories first]" \
|
30
36
|
"--sort-dirs[sort directories first]" \
|
31
37
|
"--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.5.pre.93
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Athitya Kumar
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-04-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -224,28 +224,28 @@ dependencies:
|
|
224
224
|
requirements:
|
225
225
|
- - "~>"
|
226
226
|
- !ruby/object:Gem::Version
|
227
|
-
version: 1.
|
227
|
+
version: 1.22.0
|
228
228
|
type: :development
|
229
229
|
prerelease: false
|
230
230
|
version_requirements: !ruby/object:Gem::Requirement
|
231
231
|
requirements:
|
232
232
|
- - "~>"
|
233
233
|
- !ruby/object:Gem::Version
|
234
|
-
version: 1.
|
234
|
+
version: 1.22.0
|
235
235
|
- !ruby/object:Gem::Dependency
|
236
236
|
name: rubocop-performance
|
237
237
|
requirement: !ruby/object:Gem::Requirement
|
238
238
|
requirements:
|
239
239
|
- - "~>"
|
240
240
|
- !ruby/object:Gem::Version
|
241
|
-
version: 1.
|
241
|
+
version: 1.13.0
|
242
242
|
type: :development
|
243
243
|
prerelease: false
|
244
244
|
version_requirements: !ruby/object:Gem::Requirement
|
245
245
|
requirements:
|
246
246
|
- - "~>"
|
247
247
|
- !ruby/object:Gem::Version
|
248
|
-
version: 1.
|
248
|
+
version: 1.13.0
|
249
249
|
- !ruby/object:Gem::Dependency
|
250
250
|
name: rubocop-rake
|
251
251
|
requirement: !ruby/object:Gem::Requirement
|
@@ -266,14 +266,14 @@ dependencies:
|
|
266
266
|
requirements:
|
267
267
|
- - "~>"
|
268
268
|
- !ruby/object:Gem::Version
|
269
|
-
version:
|
269
|
+
version: 2.9.0
|
270
270
|
type: :development
|
271
271
|
prerelease: false
|
272
272
|
version_requirements: !ruby/object:Gem::Requirement
|
273
273
|
requirements:
|
274
274
|
- - "~>"
|
275
275
|
- !ruby/object:Gem::Version
|
276
|
-
version:
|
276
|
+
version: 2.9.0
|
277
277
|
- !ruby/object:Gem::Dependency
|
278
278
|
name: rubygems-tasks
|
279
279
|
requirement: !ruby/object:Gem::Requirement
|
@@ -312,7 +312,6 @@ extra_rdoc_files: []
|
|
312
312
|
files:
|
313
313
|
- ".gitignore"
|
314
314
|
- ".rubocop.yml"
|
315
|
-
- ".travis.yml"
|
316
315
|
- CODE_OF_CONDUCT.md
|
317
316
|
- CONTRIBUTING.md
|
318
317
|
- CONTRIBUTORS.md
|
@@ -376,14 +375,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
376
375
|
requirements:
|
377
376
|
- - ">="
|
378
377
|
- !ruby/object:Gem::Version
|
379
|
-
version: 2.
|
378
|
+
version: 2.6.0
|
380
379
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
381
380
|
requirements:
|
382
|
-
- - "
|
381
|
+
- - ">"
|
383
382
|
- !ruby/object:Gem::Version
|
384
|
-
version:
|
383
|
+
version: 1.3.1
|
385
384
|
requirements: []
|
386
|
-
rubygems_version: 3.
|
385
|
+
rubygems_version: 3.3.7
|
387
386
|
signing_key:
|
388
387
|
specification_version: 4
|
389
388
|
summary: A Ruby CLI gem that beautifies the terminal's ls command, with color and
|
data/.travis.yml
DELETED
@@ -1,123 +0,0 @@
|
|
1
|
-
conditions: v1
|
2
|
-
|
3
|
-
if: branch = master OR tag IS present
|
4
|
-
|
5
|
-
language:
|
6
|
-
ruby
|
7
|
-
|
8
|
-
os:
|
9
|
-
- linux
|
10
|
-
|
11
|
-
cache: bundler
|
12
|
-
|
13
|
-
rvm:
|
14
|
-
- '2.5'
|
15
|
-
- '2.6'
|
16
|
-
- '2.7'
|
17
|
-
- 'truffleruby-head'
|
18
|
-
|
19
|
-
jobs:
|
20
|
-
fast_finish: true
|
21
|
-
|
22
|
-
allow_failures:
|
23
|
-
- rvm: truffleruby-head
|
24
|
-
|
25
|
-
include:
|
26
|
-
- os: osx
|
27
|
-
rvm: '2.7'
|
28
|
-
|
29
|
-
- os: windows
|
30
|
-
language: bash
|
31
|
-
before_cache:
|
32
|
-
- |-
|
33
|
-
# https://unix.stackexchange.com/a/137322/107554
|
34
|
-
pacman --sync --clean --noconfirm
|
35
|
-
- bundle clean
|
36
|
-
before_install:
|
37
|
-
- ruby --version
|
38
|
-
- gem --version
|
39
|
-
- |
|
40
|
-
if [[ ! -f /C/tools/msys64/--msys2-- ]]; then
|
41
|
-
rm -rf /C/tools/msys64
|
42
|
-
choco uninstall -y mingw
|
43
|
-
choco upgrade --no-progress -y msys2 --params /NoUpdate
|
44
|
-
ridk.cmd install dev_tools
|
45
|
-
fi
|
46
|
-
- touch /C/tools/msys64/--msys2--
|
47
|
-
install:
|
48
|
-
- bundle config set path 'vendor/bundle'
|
49
|
-
- bundle install --retry=3
|
50
|
-
- export MSYS=winsymlinks:nativestrict
|
51
|
-
cache:
|
52
|
-
directories:
|
53
|
-
- $HOME/AppData/Local/Temp/chocolatey
|
54
|
-
- /C/tools/msys64
|
55
|
-
- vendor/bundle
|
56
|
-
|
57
|
-
before_install:
|
58
|
-
- gem --version
|
59
|
-
- gem install bundler -v '~> 2'
|
60
|
-
|
61
|
-
script:
|
62
|
-
- bundle exec rubocop
|
63
|
-
- bundle exec rake spec
|
64
|
-
- bundle exec rake install
|
65
|
-
- bundle binstubs colorls
|
66
|
-
- PATH=$PWD/bin:$PATH
|
67
|
-
- colorls
|
68
|
-
- colorls -1
|
69
|
-
- colorls -a
|
70
|
-
- colorls -A
|
71
|
-
- colorls -d
|
72
|
-
- colorls -f
|
73
|
-
- colorls -l
|
74
|
-
- colorls -l spec/fixtures/symlinks
|
75
|
-
- ( cd spec/fixtures ; colorls .hidden-file ) | fgrep '.hidden-file'
|
76
|
-
- colorls -l README.md
|
77
|
-
- colorls -r
|
78
|
-
- colorls --sd
|
79
|
-
- colorls --sf
|
80
|
-
- colorls --hyperlink
|
81
|
-
- colorls -t
|
82
|
-
- colorls --sort=time
|
83
|
-
- colorls -U
|
84
|
-
- colorls --sort=none
|
85
|
-
- colorls -S
|
86
|
-
- colorls --sort=size
|
87
|
-
- colorls -h
|
88
|
-
- colorls --gs
|
89
|
-
- colorls spec/fixtures/symlinks
|
90
|
-
- colorls README.md
|
91
|
-
- colorls *
|
92
|
-
- colorls | grep /
|
93
|
-
- colorls --color
|
94
|
-
- colorls --color=auto
|
95
|
-
- colorls --color=never
|
96
|
-
- colorls --color=always
|
97
|
-
- colorls --tree spec
|
98
|
-
- colorls --tree=1
|
99
|
-
- LC_ALL=C colorls spec/fixtures/
|
100
|
-
- LC_ALL=C colorls --git spec/fixtures/
|
101
|
-
- |
|
102
|
-
if colorls does-not-exist; then
|
103
|
-
echo "expected error!"
|
104
|
-
exit 1
|
105
|
-
else
|
106
|
-
ret=$?
|
107
|
-
if [ $ret -ne 2 ]; then
|
108
|
-
echo "unexpected error: $ret"
|
109
|
-
exit 1
|
110
|
-
fi
|
111
|
-
fi
|
112
|
-
|
113
|
-
deploy:
|
114
|
-
provider: rubygems
|
115
|
-
api_key:
|
116
|
-
secure: iHo85pvy3iIp0/r8mbP0q0VPCFyYcwaQb19YUxwIGbMrksswIJPe2bsdAQTvd1fU3U+uwAgyzfaLMWgY6T1evVjv5GGXW0zmNthgWuaCbTBmzx3q6OPV6zJLsinKSJ4xbKjmTOi6BIhXTtc09dRRNp1d9U8HtmM9KyvD5ORm5M9W0/WxP3+8oOe0/yl3DOVNgCQ0j64KEqowLlfdJXe2q5iSUkZEvf+o5F6pz0g7dFiVHPVpJbZ9sOchPzYNMjLCx4jPt42J806oAH7TMeRC4lFpKgJr9U05LRGb22jiokHH6gl17RpuGRYJIexWkf3jb5iy9bivT2S2fGo9/BBKO5BvQAaL7McCwpdKM2QEyVy7RVbUz5D8vfXkJNIJankQj3Ikuz7qYyDglucGCpSGjecNCqL61NoBag7ORJ0RMWg7zklKjR59zeT4oks8rByx688y5Oi4f9Z98SPfc9NIJbHxbrDHtr13gm509cEXxwOLuVePa9J+mDGq2Uawi/PuIon1x2ztHUgvTx0DSYtwv96HzXet8QqXHwRKKjddxEApvCvGvaJV3akeUVjcsyei892ajHP6CffaKazPtogotfsu68g8WmKFWHFRkdmS6NIqg7MrnMRCjDkxAoQYYzt6cl95aBk4G7CTbjtXgIct1LGMM/WjE6K/jpeF0YLsVR4=
|
117
|
-
gem: colorls
|
118
|
-
on:
|
119
|
-
all_branches: true
|
120
|
-
condition: $TRAVIS_BRANCH = master || $TRAVIS_TAG =~ ^v[0-9][.]
|
121
|
-
repo: athityakumar/colorls
|
122
|
-
rvm: '2.6'
|
123
|
-
os: linux
|