This commit is contained in:
Rikuoh Tsujitani 2024-05-21 09:41:20 +09:00
parent aeb4b08c6c
commit 57987dc445
Signed by: riq0h
GPG key ID: 010F09DEA298C717

4
ls.rb
View file

@ -4,7 +4,7 @@ require 'optparse'
require 'etc' require 'etc'
COLUMNS = 3 COLUMNS = 3
SIZE_INDENT = 3 MARGIN = 3
def run def run
listed_filenames = list_filenames listed_filenames = list_filenames
@ -84,7 +84,7 @@ def file_type(file_stat)
end end
def file_size(filenames) def file_size(filenames)
filenames.map { |file| File.size(file) }.max.to_s.length filenames.map { |file| File.size(file) }.max.to_s.length + MARGIN
end end
def timestamp(file_stat) def timestamp(file_stat)