mirror of
https://github.com/athityakumar/colorls.git
synced 2024-09-19 05:31:23 +02:00
Fixes empty dir bug (#46)
* Add entry to files.yaml to handle .log file * Update files.yaml, correcting a typo in log entry * Update on core.rb, to check if the directory is empty * Update on core.rb, rewrote test, because Travis saw it as an offense * Update on core.rb, typo in my test * Update core.rb, switch error message on empty folder
This commit is contained in:
parent
0e2cbc852e
commit
52819d3e93
2 changed files with 10 additions and 6 deletions
|
@ -17,11 +17,15 @@ module ColorLS
|
||||||
end
|
end
|
||||||
|
|
||||||
def ls
|
def ls
|
||||||
@contents = chunkify
|
if @contents.empty?
|
||||||
@max_widths = @contents.transpose.map { |c| c.map(&:length).max }
|
print "Nothing to show here\n".colorize(:yellow)
|
||||||
@contents.each { |chunk| ls_line(chunk) }
|
else
|
||||||
print "\n"
|
@contents = chunkify
|
||||||
display_report if @report
|
@max_widths = @contents.transpose.map { |c| c.map(&:length).max }
|
||||||
|
@contents.each { |chunk| ls_line(chunk) }
|
||||||
|
print "\n"
|
||||||
|
display_report if @report
|
||||||
|
end
|
||||||
|
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
@ -30,7 +34,6 @@ module ColorLS
|
||||||
|
|
||||||
def init_contents
|
def init_contents
|
||||||
@contents = Dir.entries(@input) - %w[. ..]
|
@contents = Dir.entries(@input) - %w[. ..]
|
||||||
|
|
||||||
@contents.keep_if { |x| !x.start_with? '.' } unless @all
|
@contents.keep_if { |x| !x.start_with? '.' } unless @all
|
||||||
filter_contents if @show
|
filter_contents if @show
|
||||||
sort_contents if @sort
|
sort_contents if @sort
|
||||||
|
|
|
@ -30,6 +30,7 @@ java: "\ue204"
|
||||||
js: "\ue74e"
|
js: "\ue74e"
|
||||||
json: "\ue60b"
|
json: "\ue60b"
|
||||||
less: "\ue758"
|
less: "\ue758"
|
||||||
|
log: "\uf18d"
|
||||||
lua: "\ue620"
|
lua: "\ue620"
|
||||||
md: "\uf48a"
|
md: "\uf48a"
|
||||||
mustache: "\ue60f"
|
mustache: "\ue60f"
|
||||||
|
|
Loading…
Reference in a new issue