Skip to content

Commit

Permalink
full detail show for StatStruct
Browse files Browse the repository at this point in the history
  • Loading branch information
IanButterworth committed Jan 31, 2021
1 parent 2801337 commit 7634bb4
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion base/stat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,26 @@ StatStruct(buf::Union{Vector{UInt8},Ptr{UInt8}}) = StatStruct(
ccall(:jl_stat_ctime, Float64, (Ptr{UInt8},), buf),
)

show(io::IO, st::StatStruct) = print(io, "StatStruct(mode=0o$(string(filemode(st), base = 8, pad = 6)), size=$(filesize(st)))")
function show(io::IO, st::Base.StatStruct)
str = sprint() do iob
println(iob, "StatStruct")
println(iob, "Name | Value")
println(iob, "--------|----------")
println(iob, "size | $(st.size)")
println(iob, "device | $(st.device)")
println(iob, "inode | $(st.inode)")
println(iob, "mode | 0o$(string(filemode(st), base = 8, pad = 6))")
println(iob, "nlink | $(st.nlink)")
println(iob, "uid | $(st.uid)")
println(iob, "gid | $(st.gid)")
println(iob, "rdev | $(st.rdev)")
println(iob, "blksize | $(st.blksize)")
println(iob, "blocks | $(st.blocks)")
println(iob, "mtime | $(st.mtime)")
println(iob, "ctime | $(st.ctime)")
end
print(io, str)
end

# stat & lstat functions

Expand Down

0 comments on commit 7634bb4

Please sign in to comment.