From aeb4b08c6c79cb232b42def602f18c36fb860a08 Mon Sep 17 00:00:00 2001 From: Rikuoh Tsujitani Date: Sat, 18 May 2024 11:56:26 +0900 Subject: [PATCH] -l --- ls.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ls.rb b/ls.rb index 95200da..b9c3849 100644 --- a/ls.rb +++ b/ls.rb @@ -15,8 +15,8 @@ end def list_filenames params = ARGV.getopts('a', 'r', 'l') - flags = params['a'] ? File::FNM_DOTMATCH : 0 - filenames = Dir.glob('*', flags) + filenames = params['a'] ? Dir.glob('*', File::FNM_DOTMATCH) : Dir.glob('*') + filenames = filenames.reverse if params['r'] params['l'] ? ownerinfo(filenames) : filenames if params['r'] filenames.reverse @@ -84,7 +84,7 @@ def file_type(file_stat) end def file_size(filenames) - filenames.map { |file| File.size(file) }.max.to_s.length + SIZE_INDENT + filenames.map { |file| File.size(file) }.max.to_s.length end def timestamp(file_stat)