mirror of
https://github.com/athityakumar/colorls.git
synced 2024-09-12 05:31:14 +02:00
lint(483): makes linter happy
This commit is contained in:
parent
2c524743a5
commit
f4649081e9
1 changed files with 7 additions and 9 deletions
|
@ -46,15 +46,16 @@ module ColorLS
|
|||
@time_style = long_style_options.key?(:time_style) ? long_style_options[:time_style] : ''
|
||||
@indicator_style = indicator_style
|
||||
@hard_links_count = long_style_options.key?(:hard_links_count) ? long_style_options[:hard_links_count] : true
|
||||
# how much characters an item occupies besides its name
|
||||
@additional_chars_per_item = 12 + (@show_git ? 4 : 0) + (@show_inode ? 10 : 0)
|
||||
@icons = icons
|
||||
|
||||
init_colors colors
|
||||
|
||||
init_icons
|
||||
end
|
||||
|
||||
def get_additional_chars_per_item
|
||||
12 + (@show_git ? 4 : 0) + (@show_inode ? 10 : 0)
|
||||
end
|
||||
|
||||
def ls_dir(info)
|
||||
if @tree[:mode]
|
||||
print "\n"
|
||||
|
@ -156,7 +157,7 @@ module ColorLS
|
|||
end
|
||||
|
||||
def item_widths
|
||||
@contents.map { |item| Unicode::DisplayWidth.of(item.show) + @additional_chars_per_item }
|
||||
@contents.map { |item| Unicode::DisplayWidth.of(item.show) + get_additional_chars_per_item }
|
||||
end
|
||||
|
||||
def filter_hidden_contents
|
||||
|
@ -342,10 +343,7 @@ module ColorLS
|
|||
logo = value.gsub(/\\u[\da-f]{4}/i) { |m| [m[-4..].to_i(16)].pack('U') }
|
||||
name = @hyperlink ? make_link(content) : content.show
|
||||
name += content.directory? && @indicator_style != 'none' ? '/' : ' '
|
||||
entry = "#{out_encode(name)}"
|
||||
if @icons
|
||||
entry = "#{out_encode(logo)} #{out_encode(name)}"
|
||||
end
|
||||
entry = @icons ? "#{out_encode(logo)} #{out_encode(name)}" : out_encode(name).to_s
|
||||
entry = entry.bright if !content.directory? && content.executable?
|
||||
|
||||
"#{inode(content)} #{long_info(content)} #{git_info(content)} #{entry.colorize(color)}#{symlink_info(content)}"
|
||||
|
@ -358,7 +356,7 @@ module ColorLS
|
|||
entry = fetch_string(content, *options(content))
|
||||
line << (' ' * padding)
|
||||
line << ' ' << entry.encode(Encoding.default_external, undef: :replace)
|
||||
padding = widths[i] - Unicode::DisplayWidth.of(content.show) - @additional_chars_per_item
|
||||
padding = widths[i] - Unicode::DisplayWidth.of(content.show) - get_additional_chars_per_item
|
||||
end
|
||||
print line << "\n"
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue