colorls 1.4.3.pre.833 → 1.4.3

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: ae10b489eb11d679a8609075cb11018b4e5168301b953fb8438d24cf910e4efa
4
- data.tar.gz: d7473d0e9c133423dd2bd0b86f6e40342b22a1a7bab1ab83d2b49aa7575c72ac
3
+ metadata.gz: 6262614e4d1fc244092d9d8475615bfef90e76a578973f185c77e1b7a1ced3d1
4
+ data.tar.gz: 8a80bf1393ba0c052bc2679797bbf63331c07bfac2c289c8025fa2a0806dcd09
5
5
  SHA512:
6
- metadata.gz: d0c98c861a7d490481ecc54c44f9ca958cb1b5ef2ccdb074a1c5f8537e50d680878398ad21374dc442be95f9885ab657cd320d8887a0278df3107f081b6f7660
7
- data.tar.gz: e9dae29ef7397270a3a0470b9473d9c635a286d0e61a4329d2075d09139cf9bbe0b992b6328c5f090c2e59914ac0912cfed576834708a8852a460045bbaee2b0
6
+ metadata.gz: 9d1985b6402cb04850ee8b501d03bc7ed50fe724816e48768824cc6a3fa6d8c7d9975c0f057aa168341c98f3c2807af797b5c1a3dbb715859703210c5ccfb7a3
7
+ data.tar.gz: 28c10940c031149210950f53cfffe22bff07624506a89d8fbedfc3e45ed0971f3e2c9400b0dc0cc8942b6ef2338f6b6143f7b9d76bef6dc2d5a4a071bc887fe2
@@ -11,7 +11,7 @@ module ColorLS
11
11
  class Core
12
12
  def initialize(input, all: false, report: false, sort: false, show: false,
13
13
  mode: nil, git_status: false, almost_all: false, colors: [], group: nil,
14
- reverse: false, hyperlink: false, tree_depth: nil)
14
+ reverse: false, hyperlink: false, tree_depth: nil, show_group: true, show_user: true)
15
15
  @input = (+input).force_encoding(ColorLS.file_encoding)
16
16
  @count = {folders: 0, recognized_files: 0, unrecognized_files: 0}
17
17
  @all = all
@@ -23,7 +23,7 @@ module ColorLS
23
23
  @group = group
24
24
  @show = show
25
25
  @one_per_line = mode == :one_per_line
26
- @long = mode == :long
26
+ init_long_format(mode,show_group,show_user)
27
27
  @tree = {mode: mode == :tree, depth: tree_depth}
28
28
  @horizontal = mode == :horizontal
29
29
  process_git_status_details(git_status)
@@ -75,6 +75,12 @@ module ColorLS
75
75
  end
76
76
  end
77
77
 
78
+ def init_long_format(mode,show_group,show_user)
79
+ @long = mode == :long
80
+ @show_group = show_group
81
+ @show_user = show_user
82
+ end
83
+
78
84
  # how much characters an item occupies besides its name
79
85
  CHARS_PER_ITEM = 12
80
86
 
@@ -274,8 +280,11 @@ module ColorLS
274
280
 
275
281
  links = content.nlink.to_s.rjust(@linklength)
276
282
 
277
- [mode_info(content.stats), links, user_info(content), group_info(content.group),
278
- size_info(content.size), mtime_info(content.mtime)].join(' ')
283
+ line_array = [mode_info(content.stats), links]
284
+ line_array.push user_info(content) if @show_user
285
+ line_array.push group_info(content.group) if @show_group
286
+ line_array.concat [size_info(content.size), mtime_info(content.mtime)]
287
+ line_array.join(' ')
279
288
  end
280
289
 
281
290
  def symlink_info(content)
@@ -10,19 +10,7 @@ module ColorLS
10
10
  @args = args
11
11
  @light_colors = false
12
12
 
13
- @opts = {
14
- show: false,
15
- sort: true,
16
- reverse: false,
17
- group: nil,
18
- mode: STDOUT.tty? ? :vertical : :one_per_line, # rubocop:disable Style/GlobalStdStream
19
- all: false,
20
- almost_all: false,
21
- report: false,
22
- git_status: false,
23
- colors: [],
24
- tree_depth: 3
25
- }
13
+ @opts = default_opts
26
14
 
27
15
  parse_options
28
16
 
@@ -81,6 +69,24 @@ module ColorLS
81
69
  warn "WARN: #{e}, check your locale settings"
82
70
  end
83
71
 
72
+ def default_opts
73
+ {
74
+ show: false,
75
+ sort: true,
76
+ reverse: false,
77
+ group: nil,
78
+ mode: STDOUT.tty? ? :vertical : :one_per_line, # rubocop:disable Style/GlobalStdStream
79
+ all: false,
80
+ almost_all: false,
81
+ report: false,
82
+ git_status: false,
83
+ colors: [],
84
+ tree_depth: 3,
85
+ show_group: true,
86
+ show_user: true
87
+ }
88
+ end
89
+
84
90
  def add_sort_options(options)
85
91
  options.separator ''
86
92
  options.separator 'sorting options:'
@@ -126,8 +132,7 @@ module ColorLS
126
132
  when 'single-column' then @opts[:mode] = :one_per_line
127
133
  end
128
134
  end
129
- options.on('-1', 'list one file per line') { @opts[:mode] = :one_per_line }
130
- options.on('-l', '--long', 'use a long listing format') { @opts[:mode] = :long }
135
+ options.on('-1', 'list one file per line') { @opts[:mode] = :one_per_line }
131
136
  options.on('--tree=[DEPTH]', Integer, 'shows tree view of the directory') do |depth|
132
137
  @opts[:tree_depth] = depth
133
138
  @opts[:mode] = :tree
@@ -136,6 +141,19 @@ module ColorLS
136
141
  options.on('-C', 'list entries by columns instead of by lines') { @opts[:mode] = :vertical }
137
142
  end
138
143
 
144
+ def add_long_style_options(options)
145
+ options.on('-l', '--long', 'use a long listing format') { @opts[:mode] = :long }
146
+ options.on('-o', 'use a long listing format without group information') do
147
+ @opts[:mode] = :long
148
+ @opts[:show_group] = false
149
+ end
150
+ options.on('-g', 'use a long listing format without owner information') do
151
+ @opts[:mode] = :long
152
+ @opts[:show_user] = false
153
+ end
154
+ options.on('-G', '--no-group', 'show no group information in a long listing') { @opts[:show_group] = false }
155
+ end
156
+
139
157
  def add_general_options(options)
140
158
  options.separator ''
141
159
  options.separator 'general options:'
@@ -196,17 +214,22 @@ module ColorLS
196
214
  EXAMPLES
197
215
  end
198
216
 
217
+ def assign_each_options(opts)
218
+ add_common_options(opts)
219
+ add_format_options(opts)
220
+ add_long_style_options(opts)
221
+ add_sort_options(opts)
222
+ add_compatiblity_options(opts)
223
+ add_general_options(opts)
224
+ add_help_option(opts)
225
+ end
226
+
199
227
  def parse_options
200
228
  @parser = OptionParser.new do |opts|
201
229
  opts.banner = 'Usage: colorls [OPTION]... [FILE]...'
202
230
  opts.separator ''
203
231
 
204
- add_common_options(opts)
205
- add_format_options(opts)
206
- add_sort_options(opts)
207
- add_compatiblity_options(opts)
208
- add_general_options(opts)
209
- add_help_option(opts)
232
+ assign_each_options(opts)
210
233
 
211
234
  opts.on_tail('--version', 'show version') do
212
235
  puts ColorLS::VERSION
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ColorLS
4
- VERSION = '1.4.2'
4
+ VERSION = '1.4.3'
5
5
  end
@@ -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" "October 2020" "colorls 1.4.2" "colorls Manual"
4
+ .TH "COLORLS" "1" "November 2020" "colorls 1.4.2" "colorls Manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBcolorls\fR \- list directory contents with colors and icons
@@ -55,10 +55,6 @@ use format: across (\-x), horizontal (\-x), long (\-l), single\-column (\-1), ve
55
55
  list one file per line
56
56
  .
57
57
  .TP
58
- \fB\-l\fR, \fB\-\-long\fR
59
- use a long listing format
60
- .
61
- .TP
62
58
  \fB\-\-tree\fR
63
59
  shows tree view of the directory
64
60
  .
@@ -71,6 +67,22 @@ list entries by lines instead of by columns
71
67
  list entries by columns instead of by lines
72
68
  .
73
69
  .TP
70
+ \fB\-l\fR, \fB\-\-long\fR
71
+ use a long listing format
72
+ .
73
+ .TP
74
+ \fB\-o\fR
75
+ use a long listing format without group information
76
+ .
77
+ .TP
78
+ \fB\-g\fR
79
+ use a long listing format without owner information
80
+ .
81
+ .TP
82
+ \fB\-G\fR, \fB\-\-no\-group\fR
83
+ show no group information in a long listing
84
+ .
85
+ .TP
74
86
  \fB\-\-sd\fR, \fB\-\-sort\-dirs\fR, \fB\-\-group\-directories\-first\fR
75
87
  sort directories first
76
88
  .
@@ -17,11 +17,15 @@ _arguments -s -S \
17
17
  "--report[show brief report]" \
18
18
  "--format[use format: across (-x), horizontal (-x), long (-l), single-column (-1), vertical (-C)]" \
19
19
  "-1[list one file per line]" \
20
- "-l[use a long listing format]" \
21
- "--long[use a long listing format]" \
22
20
  "--tree[shows tree view of the directory]" \
23
21
  "-x[list entries by lines instead of by columns]" \
24
22
  "-C[list entries by columns instead of by lines]" \
23
+ "-l[use a long listing format]" \
24
+ "--long[use a long listing format]" \
25
+ "-o[use a long listing format without group information]" \
26
+ "-g[use a long listing format without owner information]" \
27
+ "-G[show no group information in a long listing]" \
28
+ "--no-group[show no group information in a long listing]" \
25
29
  "--sd[sort directories first]" \
26
30
  "--sort-dirs[sort directories first]" \
27
31
  "--group-directories-first[sort directories first]" \
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: colorls
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.3.pre.833
4
+ version: 1.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Athitya Kumar
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-12-02 00:00:00.000000000 Z
11
+ date: 2020-12-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: clocale
@@ -345,9 +345,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
345
345
  version: 2.5.0
346
346
  required_rubygems_version: !ruby/object:Gem::Requirement
347
347
  requirements:
348
- - - ">"
348
+ - - ">="
349
349
  - !ruby/object:Gem::Version
350
- version: 1.3.1
350
+ version: '0'
351
351
  requirements: []
352
352
  rubygems_version: 3.0.8
353
353
  signing_key: