colorls 1.4.5.pre.890 → 1.4.5
Sign up to get free protection for your applications and to get access to all the features.
- 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 +50 -27
- data/lib/colorls/flags.rb +43 -12
- data/lib/colorls/git.rb +6 -2
- data/lib/colorls/version.rb +1 -1
- 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 +15 -18
- data/.github/dependabot.yml +0 -8
- data/.github/workflows/ruby.yml +0 -32
- 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: 357abd534a9704c1ca793adcd54d81e5a33b6d591e2a3ae868ac9d05314761c1
|
4
|
+
data.tar.gz: 78ef3e08cb06c60406dc3109579bc7f866524305c1ddaea62e8ce3937d731595
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d7e7bf328e1d2d96f4b5e030f1289690e9486fbdca954e4fb6fe1f75f0ef39524e4bf6888b1d50717266a34c90fdc6ff92b7906b022f618ce28f0659d186533
|
7
|
+
data.tar.gz: 70d7eaf91b1f1ebc91e5daed018abd020e77d70d8c5819c038e61aa30e48f87dfee0543bdca6061202bc85368c0f24fab0c5ec90a8bc5eea606b92d0fc555738
|
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
|
[![forthebadge](http://forthebadge.com/images/badges/built-with-love.svg)](http://forthebadge.com)
|
5
5
|
|
6
6
|
[![Gem Version](https://badge.fury.io/rb/colorls.svg)](https://badge.fury.io/rb/colorls)
|
7
|
-
[![
|
7
|
+
[![CI](https://github.com/athityakumar/colorls/actions/workflows/ruby.yml/badge.svg)](https://github.com/athityakumar/colorls/actions/workflows/ruby.yml)
|
8
8
|
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=shields)](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
@@ -26,8 +26,9 @@ module ColorLS
|
|
26
26
|
|
27
27
|
class Core
|
28
28
|
def initialize(all: false, sort: false, show: false,
|
29
|
-
mode: nil,
|
30
|
-
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: {})
|
31
32
|
@count = {folders: 0, recognized_files: 0, unrecognized_files: 0}
|
32
33
|
@all = all
|
33
34
|
@almost_all = almost_all
|
@@ -37,10 +38,16 @@ module ColorLS
|
|
37
38
|
@group = group
|
38
39
|
@show = show
|
39
40
|
@one_per_line = mode == :one_per_line
|
40
|
-
|
41
|
+
@show_inode = show_inode
|
42
|
+
init_long_format(mode,long_style_options)
|
41
43
|
@tree = {mode: mode == :tree, depth: tree_depth}
|
42
44
|
@horizontal = mode == :horizontal
|
43
|
-
@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)
|
44
51
|
|
45
52
|
init_colors colors
|
46
53
|
|
@@ -74,13 +81,24 @@ module ColorLS
|
|
74
81
|
ls
|
75
82
|
end
|
76
83
|
|
77
|
-
def display_report
|
78
|
-
|
84
|
+
def display_report(report_mode)
|
85
|
+
if report_mode == :short
|
86
|
+
puts <<~REPORT
|
79
87
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
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
|
93
|
+
|
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
|
84
102
|
end
|
85
103
|
|
86
104
|
private
|
@@ -115,13 +133,14 @@ module ColorLS
|
|
115
133
|
end
|
116
134
|
end
|
117
135
|
|
118
|
-
def init_long_format(mode,
|
136
|
+
def init_long_format(mode, long_style_options)
|
119
137
|
@long = mode == :long
|
120
|
-
@show_group = show_group
|
121
|
-
@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
|
122
140
|
end
|
123
141
|
|
124
142
|
def init_git_status(show_git)
|
143
|
+
@show_git = show_git
|
125
144
|
return {}.freeze unless show_git
|
126
145
|
|
127
146
|
# stores git status information per directory
|
@@ -135,11 +154,8 @@ module ColorLS
|
|
135
154
|
end
|
136
155
|
end
|
137
156
|
|
138
|
-
# how much characters an item occupies besides its name
|
139
|
-
CHARS_PER_ITEM = 12
|
140
|
-
|
141
157
|
def item_widths
|
142
|
-
@contents.map { |item| Unicode::DisplayWidth.of(item.show) +
|
158
|
+
@contents.map { |item| Unicode::DisplayWidth.of(item.show) + @additional_chars_per_item }
|
143
159
|
end
|
144
160
|
|
145
161
|
def filter_hidden_contents
|
@@ -237,14 +253,14 @@ module ColorLS
|
|
237
253
|
def size_info(filesize)
|
238
254
|
size = Filesize.new(filesize).pretty.split
|
239
255
|
size = "#{size[0][0..-4].rjust(4,' ')} #{size[1].ljust(3,' ')}"
|
240
|
-
return size.colorize(@colors[:file_large]) if filesize >= 512 * 1024 ** 2
|
241
|
-
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)
|
242
258
|
|
243
259
|
size.colorize(@colors[:file_small])
|
244
260
|
end
|
245
261
|
|
246
262
|
def mtime_info(file_mtime)
|
247
|
-
mtime = file_mtime.asctime
|
263
|
+
mtime = @time_style.start_with?('+') ? file_mtime.strftime(@time_style.delete_prefix('+')) : file_mtime.asctime
|
248
264
|
now = Time.now
|
249
265
|
return mtime.colorize(@colors[:hour_old]) if now - file_mtime < 60 * 60
|
250
266
|
return mtime.colorize(@colors[:day_old]) if now - file_mtime < 24 * 60 * 60
|
@@ -284,12 +300,19 @@ module ColorLS
|
|
284
300
|
end
|
285
301
|
end
|
286
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
|
+
|
287
309
|
def long_info(content)
|
288
310
|
return '' unless @long
|
289
311
|
|
290
312
|
links = content.nlink.to_s.rjust(@linklength)
|
291
313
|
|
292
|
-
line_array = [mode_info(content.stats)
|
314
|
+
line_array = [mode_info(content.stats)]
|
315
|
+
line_array.push links if @hard_links_count
|
293
316
|
line_array.push user_info(content) if @show_user
|
294
317
|
line_array.push group_info(content.group) if @show_group
|
295
318
|
line_array.concat [size_info(content.size), mtime_info(content.mtime)]
|
@@ -315,14 +338,14 @@ module ColorLS
|
|
315
338
|
def fetch_string(content, key, color, increment)
|
316
339
|
@count[increment] += 1
|
317
340
|
value = increment == :folders ? @folders[key] : @files[key]
|
318
|
-
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') }
|
319
342
|
name = content.show
|
320
343
|
name = make_link(content) if @hyperlink
|
321
|
-
name += content.directory? ? '/' : ' '
|
344
|
+
name += content.directory? && @indicator_style != 'none' ? '/' : ' '
|
322
345
|
entry = "#{out_encode(logo)} #{out_encode(name)}"
|
323
346
|
entry = entry.bright if !content.directory? && content.executable?
|
324
347
|
|
325
|
-
"#{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)}"
|
326
349
|
end
|
327
350
|
|
328
351
|
def ls_line(chunk, widths)
|
@@ -330,9 +353,9 @@ module ColorLS
|
|
330
353
|
line = +''
|
331
354
|
chunk.each_with_index do |content, i|
|
332
355
|
entry = fetch_string(content, *options(content))
|
333
|
-
line << ' ' * padding
|
356
|
+
line << (' ' * padding)
|
334
357
|
line << ' ' << entry.encode(Encoding.default_external, undef: :replace)
|
335
|
-
padding = widths[i] - Unicode::DisplayWidth.of(content.show) -
|
358
|
+
padding = widths[i] - Unicode::DisplayWidth.of(content.show) - @additional_chars_per_item
|
336
359
|
end
|
337
360
|
print line << "\n"
|
338
361
|
end
|
@@ -400,7 +423,7 @@ module ColorLS
|
|
400
423
|
def tree_branch_preprint(prespace, indent, prespace_icon)
|
401
424
|
return prespace_icon if prespace.zero?
|
402
425
|
|
403
|
-
' │ ' * (prespace/indent) + prespace_icon + '─' * indent
|
426
|
+
(' │ ' * (prespace/indent)) + prespace_icon + ('─' * indent)
|
404
427
|
end
|
405
428
|
|
406
429
|
def make_link(content)
|
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/version.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.5" "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.5
|
4
|
+
version: 1.4.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Athitya Kumar
|
8
|
-
autorequire:
|
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
|
@@ -302,7 +302,7 @@ dependencies:
|
|
302
302
|
- - "~>"
|
303
303
|
- !ruby/object:Gem::Version
|
304
304
|
version: 0.21.2
|
305
|
-
description:
|
305
|
+
description:
|
306
306
|
email:
|
307
307
|
- athityakumar@gmail.com
|
308
308
|
executables:
|
@@ -310,11 +310,8 @@ executables:
|
|
310
310
|
extensions: []
|
311
311
|
extra_rdoc_files: []
|
312
312
|
files:
|
313
|
-
- ".github/dependabot.yml"
|
314
|
-
- ".github/workflows/ruby.yml"
|
315
313
|
- ".gitignore"
|
316
314
|
- ".rubocop.yml"
|
317
|
-
- ".travis.yml"
|
318
315
|
- CODE_OF_CONDUCT.md
|
319
316
|
- CONTRIBUTING.md
|
320
317
|
- CONTRIBUTORS.md
|
@@ -378,15 +375,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
378
375
|
requirements:
|
379
376
|
- - ">="
|
380
377
|
- !ruby/object:Gem::Version
|
381
|
-
version: 2.
|
378
|
+
version: 2.6.0
|
382
379
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
383
380
|
requirements:
|
384
|
-
- - "
|
381
|
+
- - ">="
|
385
382
|
- !ruby/object:Gem::Version
|
386
|
-
version:
|
383
|
+
version: '0'
|
387
384
|
requirements: []
|
388
|
-
rubygems_version: 3.
|
389
|
-
signing_key:
|
385
|
+
rubygems_version: 3.2.26
|
386
|
+
signing_key:
|
390
387
|
specification_version: 4
|
391
388
|
summary: A Ruby CLI gem that beautifies the terminal's ls command, with color and
|
392
389
|
font-awesome icons.
|
data/.github/dependabot.yml
DELETED
data/.github/workflows/ruby.yml
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
# This workflow uses actions that are not certified by GitHub.
|
2
|
-
# They are provided by a third-party and are governed by
|
3
|
-
# separate terms of service, privacy policy, and support
|
4
|
-
# documentation.
|
5
|
-
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
|
6
|
-
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
7
|
-
|
8
|
-
name: Ruby
|
9
|
-
|
10
|
-
on:
|
11
|
-
push:
|
12
|
-
branches: [ master ]
|
13
|
-
pull_request:
|
14
|
-
branches: [ master ]
|
15
|
-
|
16
|
-
jobs:
|
17
|
-
test:
|
18
|
-
|
19
|
-
runs-on: ubuntu-latest
|
20
|
-
strategy:
|
21
|
-
matrix:
|
22
|
-
ruby-version: ['2.6', '2.7', '3.0']
|
23
|
-
|
24
|
-
steps:
|
25
|
-
- uses: actions/checkout@v2
|
26
|
-
- name: Set up Ruby
|
27
|
-
uses: ruby/setup-ruby@v1
|
28
|
-
with:
|
29
|
-
ruby-version: ${{ matrix.ruby-version }}
|
30
|
-
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
31
|
-
- name: Run tests
|
32
|
-
run: bundle exec rake
|
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
|