-l
This commit is contained in:
parent
03884289e3
commit
aeb4b08c6c
1 changed files with 3 additions and 3 deletions
6
ls.rb
6
ls.rb
|
@ -15,8 +15,8 @@ end
|
||||||
|
|
||||||
def list_filenames
|
def list_filenames
|
||||||
params = ARGV.getopts('a', 'r', 'l')
|
params = ARGV.getopts('a', 'r', 'l')
|
||||||
flags = params['a'] ? File::FNM_DOTMATCH : 0
|
filenames = params['a'] ? Dir.glob('*', File::FNM_DOTMATCH) : Dir.glob('*')
|
||||||
filenames = Dir.glob('*', flags)
|
filenames = filenames.reverse if params['r']
|
||||||
params['l'] ? ownerinfo(filenames) : filenames
|
params['l'] ? ownerinfo(filenames) : filenames
|
||||||
if params['r']
|
if params['r']
|
||||||
filenames.reverse
|
filenames.reverse
|
||||||
|
@ -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 + SIZE_INDENT
|
filenames.map { |file| File.size(file) }.max.to_s.length
|
||||||
end
|
end
|
||||||
|
|
||||||
def timestamp(file_stat)
|
def timestamp(file_stat)
|
||||||
|
|
Loading…
Reference in a new issue