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:
Paulo 2017-07-09 11:05:18 +02:00 committed by Athitya Kumar
parent 0e2cbc852e
commit 52819d3e93
2 changed files with 10 additions and 6 deletions

View file

@ -17,11 +17,15 @@ module ColorLS
end
def ls
@contents = chunkify
@max_widths = @contents.transpose.map { |c| c.map(&:length).max }
@contents.each { |chunk| ls_line(chunk) }
print "\n"
display_report if @report
if @contents.empty?
print "Nothing to show here\n".colorize(:yellow)
else
@contents = chunkify
@max_widths = @contents.transpose.map { |c| c.map(&:length).max }
@contents.each { |chunk| ls_line(chunk) }
print "\n"
display_report if @report
end
true
end
@ -30,7 +34,6 @@ module ColorLS
def init_contents
@contents = Dir.entries(@input) - %w[. ..]
@contents.keep_if { |x| !x.start_with? '.' } unless @all
filter_contents if @show
sort_contents if @sort

View file

@ -30,6 +30,7 @@ java: "\ue204"
js: "\ue74e"
json: "\ue60b"
less: "\ue758"
log: "\uf18d"
lua: "\ue620"
md: "\uf48a"
mustache: "\ue60f"