-l
This commit is contained in:
parent
b6220c85c4
commit
93b13c84c5
1 changed files with 9 additions and 16 deletions
25
ls.rb
25
ls.rb
|
@ -83,22 +83,15 @@ def permission(file_stat)
|
||||||
end
|
end
|
||||||
|
|
||||||
def file_type(file_stat)
|
def file_type(file_stat)
|
||||||
case file_stat.ftype
|
{
|
||||||
when 'file'
|
'fifo' => 'p',
|
||||||
print '-'
|
'characterSpecial' => 'c',
|
||||||
when 'directory'
|
'directory' => 'd',
|
||||||
print 'd'
|
'blockSpecial' => 'b',
|
||||||
when 'characterSpecial'
|
'file' => '-',
|
||||||
print 'c'
|
'link' => 'l',
|
||||||
when 'blockSpecial'
|
'socket' => 's'
|
||||||
print 'b'
|
}[file_stat]
|
||||||
when 'fifo'
|
|
||||||
print 'p'
|
|
||||||
when 'link'
|
|
||||||
print 'l'
|
|
||||||
when 'socket'
|
|
||||||
print 's'
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def file_size(filenames)
|
def file_size(filenames)
|
||||||
|
|
Loading…
Reference in a new issue