colorls 1.4.5.pre.96 → 1.4.5.pre.872

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 39f5ebd51baf7c6a6f737f81def0866922a56ed90e53fe71d7b5de1ba0f7a26f
4
- data.tar.gz: cb05ad3b3478b9dd9963d58cb6809e38df913ad0b6b9c2bd41359ffd157024a6
3
+ metadata.gz: 849c1d2e50807b6ad4667481a74c5bc77aa60112cc06637f141c70f29ddb0fda
4
+ data.tar.gz: 43530de105df3de16a043f2c6c87ba58c9e9e70aa094be99466b5fdfd7e8c53c
5
5
  SHA512:
6
- metadata.gz: 9d8ec1933d0f226abfd318724248c9822ef326df8357c0330c2c36d229424125a2f8aa105c69eb4496055e3d82ffb396101b88478d8bb05b7e6a56d5829d0de8
7
- data.tar.gz: 1e25ebb29439d503bb50eae499af73f6e138688d10dec91e134a6587fd7efcc251f7954aab47753b9c3e95757610495d43d9b5e461300dbc55063bb8dc6bd6c2
6
+ metadata.gz: e17c109ad1febe2aeb3c4f64677d74c7ff26ee8ee491dae80853bb98777a1afdfa7afbfcb6d19aa41e184af18c5277cc2c5d2ddd689d3fb603cd14d295e17384
7
+ data.tar.gz: 40571e64e90e8fc434078875bbc255ce20d3990f5b738de8c0154fc00546375f794e7c1dc76db3368afe7bad7390d082765e5a9b821483b5761cc1d320547781
data/.rubocop.yml CHANGED
@@ -10,7 +10,7 @@ AllCops:
10
10
  - 'profile/*'
11
11
  DisplayCopNames: true
12
12
  NewCops: enable
13
- TargetRubyVersion: 2.6
13
+ TargetRubyVersion: 2.5
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: 16
61
+ Max: 15
62
62
 
63
63
  Naming/FileName:
64
64
  Enabled: false
data/.travis.yml ADDED
@@ -0,0 +1,123 @@
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
data/CONTRIBUTORS.md CHANGED
@@ -77,7 +77,5 @@ Color LS contributors (sorted alphabetically)
77
77
 
78
78
  * **[Vladislav Isakov](https://github.com/bladebhs)**
79
79
 
80
- * **[T.Mangoe](https://github.com/t-mangoe)**
81
-
82
80
 
83
81
  **[Full contributors list](https://github.com/athityakumar/colorls/graphs/contributors).**
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
- [![CI](https://github.com/athityakumar/colorls/actions/workflows/ruby.yml/badge.svg)](https://github.com/athityakumar/colorls/actions/workflows/ruby.yml)
7
+ [![Build Status](https://travis-ci.org/athityakumar/colorls.svg?branch=master)](https://travis-ci.org/athityakumar/colorls)
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.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.
120
+ 1. Install Ruby (preferably, version >= 2.5)
121
+ 2. Install the patched fonts of powerline nerd-font and/or font-awesome. Have a look at the [Nerd Font README](https://github.com/ryanoasis/nerd-fonts/blob/master/readme.md) for more 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 -- lib/colorls/flags.rb`),
23
+ date: Date.iso8601(`git log -1 --pretty=format:%cI -- man/colorls.1`),
24
24
  manual: 'colorls Manual',
25
25
  organization: "colorls #{ColorLS::VERSION}"
26
26
  }
27
27
  doc = Ronn::Document.new(nil, attributes) do
28
- template = File.read('man/colorls.1.ronn')
28
+ template = IO.read('man/colorls.1.ronn')
29
29
 
30
30
  section = ''
31
31
  flags.options.each do |o|
@@ -37,14 +37,12 @@ OPTION
37
37
  end
38
38
  template.sub('{{ OPTIONS }}', section)
39
39
  end
40
- File.write('man/colorls.1', doc.convert('roff'))
40
+ IO.write('man/colorls.1', doc.convert('roff'))
41
41
  end
42
42
 
43
- directory 'zsh'
44
-
45
43
  desc 'Build the Zsh completion file'
46
- file 'zsh/_colorls' => %w[zsh lib/colorls/flags.rb] do
44
+ file 'zsh/_colorls' => ['lib/colorls/flags.rb'] do
47
45
  ruby "exe/colorls '--*-completion-zsh=colorls' > zsh/_colorls"
48
46
  end
49
47
 
50
- task default: %w[spec rubocop man/colorls.1 zsh/_colorls]
48
+ task default: %w[spec rubocop]
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['GITHUB_REF'] == "refs/tags/v#{ColorLS::VERSION}"
31
- is_origin = ENV['GITHUB_REPOSITORY_OWNER'] == 'athityakumar'
32
- build_number = ENV['GITHUB_RUN_NUMBER']
30
+ is_tagged = ENV['TRAVIS_TAG'] == "v#{ColorLS::VERSION}"
31
+ is_origin = ENV['TRAVIS_REPO_SLUG'] == 'athityakumar/colorls'
32
+ build_number = ENV['TRAVIS_BUILD_NUMBER']
33
33
 
34
34
  spec.name = 'colorls'
35
35
  spec.version = if build_number && is_origin && !is_tagged
36
- # Prereleasing on Github
36
+ # Prereleasing on Travis CI
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.6.0'
50
+ spec.required_ruby_version = '>= 2.5.0'
51
51
 
52
- spec.files = %w[man/colorls.1 man/colorls.1 zsh/_colorls] + IO.popen(
52
+ spec.files = 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|[.]github)/})
55
+ f.match(%r{^(test|spec|features)/})
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.22.0'
80
- spec.add_development_dependency 'rubocop-performance', '~> 1.13.0'
79
+ spec.add_development_dependency 'rubocop', '~> 1.11.0'
80
+ spec.add_development_dependency 'rubocop-performance', '~> 1.10.1'
81
81
  spec.add_development_dependency 'rubocop-rake', '~> 0.5'
82
- spec.add_development_dependency 'rubocop-rspec', '~> 2.9.0'
82
+ spec.add_development_dependency 'rubocop-rspec', '~> 2.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,17 +8,8 @@ module ColorLS
8
8
  @file_encoding
9
9
  end
10
10
 
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
11
+ @screen_width = IO.console.winsize[1]
12
+ @screen_width = 80 if @screen_width.zero?
22
13
 
23
14
  def self.screen_width
24
15
  @screen_width
@@ -26,9 +17,8 @@ module ColorLS
26
17
 
27
18
  class Core
28
19
  def initialize(all: false, sort: false, show: false,
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: {})
20
+ mode: nil, git_status: false, almost_all: false, colors: [], group: nil,
21
+ reverse: false, hyperlink: false, tree_depth: nil, show_group: true, show_user: true)
32
22
  @count = {folders: 0, recognized_files: 0, unrecognized_files: 0}
33
23
  @all = all
34
24
  @almost_all = almost_all
@@ -38,16 +28,10 @@ module ColorLS
38
28
  @group = group
39
29
  @show = show
40
30
  @one_per_line = mode == :one_per_line
41
- @show_inode = show_inode
42
- init_long_format(mode,long_style_options)
31
+ init_long_format(mode,show_group,show_user)
43
32
  @tree = {mode: mode == :tree, depth: tree_depth}
44
33
  @horizontal = mode == :horizontal
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)
34
+ @git_status = init_git_status(git_status)
51
35
 
52
36
  init_colors colors
53
37
 
@@ -81,24 +65,13 @@ module ColorLS
81
65
  ls
82
66
  end
83
67
 
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
68
+ def display_report
69
+ print "\n Found #{@count.values.sum} items in total.".colorize(@colors[:report])
93
70
 
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
71
+ puts "\n\n\tFolders\t\t\t: #{@count[:folders]}"\
72
+ "\n\tRecognized files\t: #{@count[:recognized_files]}"\
73
+ "\n\tUnrecognized files\t: #{@count[:unrecognized_files]}"
74
+ .colorize(@colors[:report])
102
75
  end
103
76
 
104
77
  private
@@ -133,14 +106,13 @@ module ColorLS
133
106
  end
134
107
  end
135
108
 
136
- def init_long_format(mode, long_style_options)
109
+ def init_long_format(mode, show_group, show_user)
137
110
  @long = mode == :long
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
111
+ @show_group = show_group
112
+ @show_user = show_user
140
113
  end
141
114
 
142
115
  def init_git_status(show_git)
143
- @show_git = show_git
144
116
  return {}.freeze unless show_git
145
117
 
146
118
  # stores git status information per directory
@@ -154,8 +126,11 @@ module ColorLS
154
126
  end
155
127
  end
156
128
 
129
+ # how much characters an item occupies besides its name
130
+ CHARS_PER_ITEM = 12
131
+
157
132
  def item_widths
158
- @contents.map { |item| Unicode::DisplayWidth.of(item.show) + @additional_chars_per_item }
133
+ @contents.map { |item| Unicode::DisplayWidth.of(item.show) + CHARS_PER_ITEM }
159
134
  end
160
135
 
161
136
  def filter_hidden_contents
@@ -253,14 +228,14 @@ module ColorLS
253
228
  def size_info(filesize)
254
229
  size = Filesize.new(filesize).pretty.split
255
230
  size = "#{size[0][0..-4].rjust(4,' ')} #{size[1].ljust(3,' ')}"
256
- return size.colorize(@colors[:file_large]) if filesize >= 512 * (1024 ** 2)
257
- return size.colorize(@colors[:file_medium]) if filesize >= 128 * (1024 ** 2)
231
+ return size.colorize(@colors[:file_large]) if filesize >= 512 * 1024 ** 2
232
+ return size.colorize(@colors[:file_medium]) if filesize >= 128 * 1024 ** 2
258
233
 
259
234
  size.colorize(@colors[:file_small])
260
235
  end
261
236
 
262
237
  def mtime_info(file_mtime)
263
- mtime = @time_style.start_with?('+') ? file_mtime.strftime(@time_style.delete_prefix('+')) : file_mtime.asctime
238
+ mtime = file_mtime.asctime
264
239
  now = Time.now
265
240
  return mtime.colorize(@colors[:hour_old]) if now - file_mtime < 60 * 60
266
241
  return mtime.colorize(@colors[:day_old]) if now - file_mtime < 24 * 60 * 60
@@ -300,19 +275,12 @@ module ColorLS
300
275
  end
301
276
  end
302
277
 
303
- def inode(content)
304
- return '' unless @show_inode
305
-
306
- content.stats.ino.to_s.rjust(10).colorize(@colors[:inode])
307
- end
308
-
309
278
  def long_info(content)
310
279
  return '' unless @long
311
280
 
312
281
  links = content.nlink.to_s.rjust(@linklength)
313
282
 
314
- line_array = [mode_info(content.stats)]
315
- line_array.push links if @hard_links_count
283
+ line_array = [mode_info(content.stats), links]
316
284
  line_array.push user_info(content) if @show_user
317
285
  line_array.push group_info(content.group) if @show_group
318
286
  line_array.concat [size_info(content.size), mtime_info(content.mtime)]
@@ -338,14 +306,14 @@ module ColorLS
338
306
  def fetch_string(content, key, color, increment)
339
307
  @count[increment] += 1
340
308
  value = increment == :folders ? @folders[key] : @files[key]
341
- logo = value.gsub(/\\u[\da-f]{4}/i) { |m| [m[-4..].to_i(16)].pack('U') }
309
+ logo = value.gsub(/\\u[\da-f]{4}/i) { |m| [m[-4..-1].to_i(16)].pack('U') }
342
310
  name = content.show
343
311
  name = make_link(content) if @hyperlink
344
- name += content.directory? && @indicator_style != 'none' ? '/' : ' '
312
+ name += content.directory? ? '/' : ' '
345
313
  entry = "#{out_encode(logo)} #{out_encode(name)}"
346
314
  entry = entry.bright if !content.directory? && content.executable?
347
315
 
348
- "#{inode(content)} #{long_info(content)} #{git_info(content)} #{entry.colorize(color)}#{symlink_info(content)}"
316
+ "#{long_info(content)} #{git_info(content)} #{entry.colorize(color)}#{symlink_info(content)}"
349
317
  end
350
318
 
351
319
  def ls_line(chunk, widths)
@@ -353,9 +321,9 @@ module ColorLS
353
321
  line = +''
354
322
  chunk.each_with_index do |content, i|
355
323
  entry = fetch_string(content, *options(content))
356
- line << (' ' * padding)
324
+ line << ' ' * padding
357
325
  line << ' ' << entry.encode(Encoding.default_external, undef: :replace)
358
- padding = widths[i] - Unicode::DisplayWidth.of(content.show) - @additional_chars_per_item
326
+ padding = widths[i] - Unicode::DisplayWidth.of(content.show) - CHARS_PER_ITEM
359
327
  end
360
328
  print line << "\n"
361
329
  end
@@ -423,7 +391,7 @@ module ColorLS
423
391
  def tree_branch_preprint(prespace, indent, prespace_icon)
424
392
  return prespace_icon if prespace.zero?
425
393
 
426
- (' │ ' * (prespace/indent)) + prespace_icon + ('─' * indent)
394
+ ' │ ' * (prespace/indent) + prespace_icon + '─' * indent
427
395
  end
428
396
 
429
397
  def make_link(content)
@@ -14,12 +14,10 @@ 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
-
23
21
  handle_symlink(@path) if link_info && @stats.symlink?
24
22
  end
25
23
 
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
- @report_mode = false
14
+ @show_report = 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? :desc
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(@report_mode) if @report_mode
91
+ core.display_report if @show_report
92
92
 
93
93
  @exit_status_code
94
94
  end
@@ -102,12 +102,11 @@ 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
- show_git: false,
105
+ git_status: false,
106
106
  colors: [],
107
107
  tree_depth: 3,
108
- show_inode: false,
109
- indicator_style: 'slash',
110
- long_style_options: {}
108
+ show_group: true,
109
+ show_user: true
111
110
  }
112
111
  end
113
112
 
@@ -140,19 +139,8 @@ module ColorLS
140
139
  options.on('-A', '--almost-all', 'do not list . and ..') { @opts[:almost_all] = true }
141
140
  options.on('-d', '--dirs', 'show only directories') { @opts[:show] = :dirs }
142
141
  options.on('-f', '--files', 'show only files') { @opts[:show] = :files }
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
142
+ options.on('--gs', '--git-status', 'show git status for each file') { @opts[:git_status] = true }
143
+ options.on('--report', 'show brief report') { @show_report = true }
156
144
  end
157
145
 
158
146
  def add_format_options(options)
@@ -176,36 +164,17 @@ module ColorLS
176
164
  options.on('-C', 'list entries by columns instead of by lines') { @opts[:mode] = :vertical }
177
165
  end
178
166
 
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
-
188
167
  def add_long_style_options(options)
189
- long_style_options = default_long_style_options
190
- options.on('-l', '--long', 'use a long listing format') { @opts[:mode] = :long }
168
+ options.on('-l', '--long', 'use a long listing format') { @opts[:mode] = :long }
191
169
  options.on('-o', 'use a long listing format without group information') do
192
170
  @opts[:mode] = :long
193
- long_style_options[:show_group] = false
171
+ @opts[:show_group] = false
194
172
  end
195
173
  options.on('-g', 'use a long listing format without owner information') do
196
174
  @opts[:mode] = :long
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
175
+ @opts[:show_user] = false
207
176
  end
208
- @opts[:long_style_options] = long_style_options
177
+ options.on('-G', '--no-group', 'show no group information in a long listing') { @opts[:show_group] = false }
209
178
  end
210
179
 
211
180
  def add_general_options(options)
data/lib/colorls/git.rb CHANGED
@@ -5,9 +5,6 @@ require 'set'
5
5
 
6
6
  module ColorLS
7
7
  module Git
8
- EMPTY_SET = Set.new.freeze
9
- private_constant :EMPTY_SET
10
-
11
8
  def self.status(repo_path)
12
9
  prefix, success = git_prefix(repo_path)
13
10
 
@@ -16,11 +13,10 @@ module ColorLS
16
13
  prefix_path = Pathname.new(prefix)
17
14
 
18
15
  git_status = Hash.new { |hash, key| hash[key] = Set.new }
19
- git_status_default = EMPTY_SET
20
16
 
21
17
  git_subdir_status(repo_path) do |mode, file|
22
18
  if file == prefix
23
- git_status_default = Set[mode].freeze
19
+ git_status.default = Set[mode].freeze
24
20
  else
25
21
  path = Pathname.new(file).relative_path_from(prefix_path)
26
22
  git_status[path.descend.first.cleanpath.to_s].add(mode)
@@ -29,7 +25,7 @@ module ColorLS
29
25
 
30
26
  warn "git status failed in #{repo_path}" unless $CHILD_STATUS.success?
31
27
 
32
- git_status.default = git_status_default
28
+ git_status.default = Set.new.freeze if git_status.default.nil?
33
29
  git_status.freeze
34
30
  end
35
31
 
@@ -6,6 +6,6 @@ class String
6
6
  end
7
7
 
8
8
  def uniq
9
- chars.uniq.join
9
+ split('').uniq.join
10
10
  end
11
11
  end
data/lib/colorls.rb CHANGED
@@ -5,7 +5,6 @@ require 'etc'
5
5
  require 'English'
6
6
  require 'filesize'
7
7
  require 'io/console'
8
- require 'io/console/size'
9
8
  require 'rainbow/ext/string'
10
9
  require 'clocale'
11
10
  require 'unicode/display_width'
@@ -36,7 +36,6 @@ tree: cyan
36
36
  empty: yellow
37
37
  error: red
38
38
  normal: darkkhaki
39
- inode: moccasin
40
39
 
41
40
  # Git
42
41
  addition: chartreuse
@@ -11,7 +11,6 @@ editorconfig: conf
11
11
  scss: css
12
12
  docx: doc
13
13
  gdoc: doc
14
- odt: doc
15
14
  dockerfile: docker
16
15
  mobi: ebook
17
16
  eot: font
@@ -28,7 +27,6 @@ gif: image
28
27
  ico: image
29
28
  jpeg: image
30
29
  jpg: image
31
- odg: image
32
30
  png: image
33
31
  pxm: image
34
32
  svg: image
@@ -43,7 +41,6 @@ mkd: md
43
41
  rdoc: md
44
42
  readme: md
45
43
  gslides: ppt
46
- odp: ppt
47
44
  pptx: ppt
48
45
  ipynb: py
49
46
  pyc: py
@@ -84,7 +81,6 @@ exe: windows
84
81
  ini: windows
85
82
  csv: xls
86
83
  gsheet: xls
87
- ods: xls
88
84
  xlsx: xls
89
85
  xul: xml
90
86
  yaml: yml
@@ -36,7 +36,6 @@ tree: cyan
36
36
  empty: yellow
37
37
  error: red
38
38
  normal: black
39
- inode: black
40
39
 
41
40
  # Git
42
41
  addition: chartreuse
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" "April 2022" "colorls 1.4.4" "colorls Manual"
4
+ .TH "COLORLS" "1" "January 2021" "colorls 1.4.4" "colorls Manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBcolorls\fR \- list directory contents with colors and icons
@@ -43,20 +43,8 @@ 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
54
46
  \fB\-\-report\fR
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)
47
+ show brief report
60
48
  .
61
49
  .TP
62
50
  \fB\-\-format\fR
@@ -95,14 +83,6 @@ use a long listing format without owner information
95
83
  show no group information in a long listing
96
84
  .
97
85
  .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
106
86
  \fB\-\-sd\fR, \fB\-\-sort\-dirs\fR, \fB\-\-group\-directories\-first\fR
107
87
  sort directories first
108
88
  .
data/zsh/_colorls CHANGED
@@ -14,11 +14,7 @@ _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
- "-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)]" \
17
+ "--report[show brief report]" \
22
18
  "--format[use format: across (-x), horizontal (-x), long (-l), single-column (-1), vertical (-C)]" \
23
19
  "-1[list one file per line]" \
24
20
  "--tree[shows tree view of the directory]" \
@@ -30,8 +26,6 @@ _arguments -s -S \
30
26
  "-g[use a long listing format without owner information]" \
31
27
  "-G[show no group information in a long listing]" \
32
28
  "--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]" \
35
29
  "--sd[sort directories first]" \
36
30
  "--sort-dirs[sort directories first]" \
37
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.5.pre.96
4
+ version: 1.4.5.pre.872
5
5
  platform: ruby
6
6
  authors:
7
7
  - Athitya Kumar
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-04-04 00:00:00.000000000 Z
11
+ date: 2021-03-10 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.22.0
227
+ version: 1.11.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.22.0
234
+ version: 1.11.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.13.0
241
+ version: 1.10.1
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.13.0
248
+ version: 1.10.1
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: 2.9.0
269
+ version: '2.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: 2.9.0
276
+ version: '2.0'
277
277
  - !ruby/object:Gem::Dependency
278
278
  name: rubygems-tasks
279
279
  requirement: !ruby/object:Gem::Requirement
@@ -312,6 +312,7 @@ extra_rdoc_files: []
312
312
  files:
313
313
  - ".gitignore"
314
314
  - ".rubocop.yml"
315
+ - ".travis.yml"
315
316
  - CODE_OF_CONDUCT.md
316
317
  - CONTRIBUTING.md
317
318
  - CONTRIBUTORS.md
@@ -375,14 +376,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
375
376
  requirements:
376
377
  - - ">="
377
378
  - !ruby/object:Gem::Version
378
- version: 2.6.0
379
+ version: 2.5.0
379
380
  required_rubygems_version: !ruby/object:Gem::Requirement
380
381
  requirements:
381
382
  - - ">"
382
383
  - !ruby/object:Gem::Version
383
384
  version: 1.3.1
384
385
  requirements: []
385
- rubygems_version: 3.3.7
386
+ rubygems_version: 3.0.8
386
387
  signing_key:
387
388
  specification_version: 4
388
389
  summary: A Ruby CLI gem that beautifies the terminal's ls command, with color and